New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
Two agents share one job, and you can't tell which one is supposed to answer a given message until you've read both of their prompts.
What you'll have at the end
A one-page contract naming which agent owns which part of the task and what state passes between them at the handoff
You need
Two working agents, each already good at its own job, with no written rule yet for which one answers a message that could plausibly belong to either.
Not covered
Gating what the owning agent may do once it has the message, such as issuing the refund itself; this covers only who owns the message and what crosses at the handoff, not what either agent is allowed to do unsupervised.
Leans on
Decide between LangGraph, CrewAI, and a plain agent loop
Pick the framework these two agents run on first if that's still open; it decides whether the handoff mechanism this recipe designs around is a built-in feature or something wired by hand.
Log every tool call so you can find what broke a run
Once the contract is live, a message the rule routed wrong is exactly what this recipe's log lets you catch after the fact, long after the batch test here has stopped watching.
Should your agent ask before it deletes, sends, or pays?
If the risk is what the owning agent does once it has the message, like issuing the actual refund, rather than who gets the message in the first place, that recipe covers gating the action itself.
Checked 15 Aug 2026
Part of the AI Agents cookbook