Give each AI agent one job and only its tools
Give each AI agent one job and only the tools that job needs. Using a travel booking desk as the example, this lesson splits one agent with every permission into a planner, a booker and a messenger. Then it enforces the split in an MCP gateway that checks permission on every tool call.
What you will learn: - Write down the job before you design the agents - See why one agent with every permission drifts - Split the work into a planner, a booker and a messenger - Give each agent its own tools in an MCP gateway and check permission on every call
#aiagents #multiagent #mcp
Chapters
- Write down the travel desk job
- See why one agent with every permission drifts
- Scope each agent
- Split it into planner, booker and messenger
- Walk the MCP gateway
- Borrow the plan mode idea
- Check permission on every tool call
Transcript
Write down the travel desk job
KaaS Travel is booking for a staff and the flight got cancelled. There are two two two problem statement. One is without flight being cancelled, you are able to book for the capped price which has been allotted for that person, and the second time the flight has been cancelled, so you need to rebook, but the price is higher than the cap which is allotted. Now it needs to go to the human in the loop that is the manager, it needs to get the approval, and after getting the approval, it will allow booking. She must land 90 minutes before her two o'clock meeting. A fare over you know 400 pound cap needs Dana, her manager, and success is you define the goal basically. Success is ticket in time so that both people can meet and speak. If you provide all these in a single agent, what will happen is like you need to provide access to everything. In a in this system, this is more of a very small example. In this system, probably it is okay.
See why one agent with every permission drifts
But if you are providing a single agent with all the permissions, then in a larger system, the main complexity will come in when to call what and what are all the steps to follow. You can provide those more in the prompts or markdown. It is not enforced that what is allowed, what is not allowed, and you are not able to you know get a deterministic result every time. So you if you run for 10 times, maybe seven out of ten times it will do good, even with a frontier model like Opus 5.5 or or even Fable then it can provide result, but you can't be sure whether it is the deterministic result what you want. So that is where the multi-agent will help.
Scope each agent
You define exact scope for your agent, what it can do, what tools it can call, and what is the success means, then it will be able to perform.
Split it into planner, booker and messenger
We have three agents. One is trip planner. What is available, what flights are available, and then it will only read the trip and search for the flight, and then the booker agent, the booker agent will find and check whether the fare is okay. Is it beyond the cap or not, and it will try to book the flight. If it is if the fare is above the cap, then it won't book it, instead, it will it will go for human in the loop to find whether whether it is okay or not, and then the messenger the messenger will message to the client and to the person that okay the ticket is booked, and this is the message out of it. Now this is the code base. I will share share the exact code as well here. So this is the folder where you can see and you can check the examples. Maybe I will see whether I am sharing this screen. Yeah, so in this example, you can verify how you can run this. You can run the demo, you can you know, run the demo case where it is approved, not approved, and so on.
Walk the MCP gateway
I am not going so deep into the actual code of it, but rather it is more into for each user. You need to define what are all the allowed tools and you need to handle okay from these list of tools. Like you go, you might have 10 different tools, but for that particular user, these are the permitted tools. Then you need to select and share this is the only tools which is allowed. So when you are listing tools, you need to keep the permission in check. Like this is the permitted tools, and this is the only thing which has been assessed by that agent. So when you are building a multi multi-agent system, then if you define this permission boundary more smaller, then it will be much easier for you to control. A simple example is like when you have that agent which will only read and do research, and it won't write anything to the specific coding agent, is an example. If it is just in the planning mode, you might have used Claude Code or any of the coding agent in plan mode. Where planning mode is primarily it shouldn't write anything to the code base, it should write only the plan that is outside the code base, and then it will only do the research, it will read the code and do that.
Borrow the plan mode idea
How they are basically doing it in a in a plain simple term, what is plan mode? It's very simple, like they are just restricting okay. Claude Code have these 10 different permissions read, write, grep, bash, whatever tool it has access to. They just restrict it in this mode. Only these permissions are allowed. Read, grep, and don't run anything which mutates any of the code base. That way you will be getting that you know in that plan mode, it won't deviate from just planning. The same applies for not just for coding agent, but for any agentic system you build, you need to have that layer in place, and you need to have whether this is allowed or not.
Check permission on every tool call
When that tool is called, you need to run okay. Whether this is allowed for this person, yes, it is allowed. Then it needs to allow, okay. For this person, this is allowed. Now the logical piece of it, whether this fare is over the cap. these are all the logical pieces on the agent level when you are actually checking, okay. This fare is actually over the cap. Then you need to make sure what you know response you need to send.
This lesson comes with Pro, $149 a year: Get Pro. This lesson is cut from the free Lightning session Build a Multi-Agent System with MCP. The Live Labs build the same system with you, free, on Thursdays: see the Live Labs.
