Agent-to-Agent Handoffs & Shared State
Claude Code Agents: Advanced Orchestration
Chapter 7 · Agent-to-Agent Handoffs & Shared State
Chapter 1 of this course warned that Fundamentals' own "an agent starts cold" problem compounds across a chain — each handoff is a fresh opportunity for context to get lost. This chapter covers the actual mechanics of doing a handoff well, and why a long chain often needs more than just passing results from one step to the next.
What a Handoff Actually Requires
Fundamentals' Chapter 3 established what a good brief needs: the goal, known context, constraints, and the expected form of the result. A handoff between two agents is really the same thing, except the "known context" section is populated automatically from the prior agent's own final report, rather than written by a human from scratch. The job of designing a good handoff is making sure that automatic transfer actually carries forward everything the next agent genuinely needs — the same standard a well-written human brief would meet.
Passing a Full Report vs. a Distilled Summary
There's a real design choice in how much of a prior agent's output to hand to the next one. Passing the full report verbatim preserves everything, at the cost of length and noise — echoing Fundamentals' own point that unfiltered exploratory detail clutters a context without adding proportional value. Passing a distilled summary is cleaner, but introduces a real risk: whoever (or whatever) does the distilling might drop something the next agent actually needed, simply because it didn't look important at the time.
Shared State Beyond a Single Handoff
In a chain longer than two agents, a pure point-to-point handoff — where each agent only ever sees the immediately preceding agent's output — has a real limitation: something stated once at the very start of the chain (an original constraint, for instance) can silently disappear a couple of hops downstream if each successive summary only distills forward what the immediately prior step itself covered. A shared state — a running document or object carried alongside the chain, not just handed step to step — solves this by keeping information that matters for the whole chain visible throughout it, not just to whichever agent happened to receive it most recently.
A Worked Example
Consider a research agent, feeding a planning agent, feeding a coding agent — the same shape as this course's own Chapter 11 capstone. Suppose the original task states a hard constraint from Fundamentals' own Chapter 8 example: the public API signatures must not change. If that constraint is only ever passed forward as part of each step's own distilled summary, there's a real risk it gets quietly dropped by the second hop — the planning agent might mention it, but a summary of the planning agent's own output handed to the coding agent might not repeat it explicitly. Carrying that constraint in a shared state document, visible to every agent in the chain regardless of how many hops have happened, guarantees the coding agent still sees it at the very end, not just the step immediately after it was first stated.
| Aspect | Point-to-Point Handoff | Shared State |
|---|---|---|
| What persists | Only what the immediately prior step's own output included | Anything deliberately added, visible to every later step |
| Risk | Something stated early can silently drop after a few hops | Can grow unmanaged if everything gets added indiscriminately |
| Best suited for | Short chains, two or three steps | Longer chains where early constraints must stay visible throughout |
Hands-On Exercises
Explain the trade-off between passing a prior agent's full report versus a distilled summary to the next agent in a chain.
📄 View solutionA four-agent chain relies purely on point-to-point handoffs, with no shared state. A constraint stated at the very start doesn't appear anywhere in the fourth agent's own brief. Explain why this happened, using this chapter's own material.
📄 View solutionA team, having learned about shared state, decides to add every single detail from every agent's output into it, reasoning "more shared context can only help." Using this chapter's own warning box, explain what's wrong with this approach.
📄 View solutionChapter 7 Quick Reference
- A handoff is the same brief-writing skill from Fundamentals Ch.3, populated automatically from the prior agent's own report
- Full report: nothing lost, but noisy. Distilled summary: cleaner, but risks dropping something needed
- Shared state keeps information relevant to the whole chain visible throughout — not just to the immediately next step
- Carry original hard constraints explicitly in shared state — they're exactly what silently drops after a few hops otherwise
- Indiscriminately dumping everything into shared state just recreates the same context-bloat problem one level removed