Skip to main content
Guide5 min read

Cross-agent context handoff: the four patterns that actually work

Multi-agent systems live or die by the handoff. Here are four patterns — full, summary, structured-state, and shared-memory — with concrete trade-offs and when to use each.

When agent A passes a task to agent B, what does B receive? "Everything" is too expensive. "Nothing" loses the thread. The answer is one of four patterns — and picking the wrong one is how multi-agent systems quietly become incoherent.

What "handoff" actually means

Three things travel between agents during a handoff:

  1. The task. What B is being asked to do.
  2. The context. What B needs to know to do it.
  3. The continuation. What happens after B finishes — return to A, finish the conversation, hand off again.

Most architectural confusion comes from conflating these. The patterns below separate them cleanly.

For the larger architectural frame see hierarchical agent supervisor pattern and agent-to-agent communication protocols.

Pattern 1: full-context handoff

B receives the entire conversation history A had with the user.

When to use: debugging, prototyping, very short pipelines (2 agents, 5 turns).

Pros:

  • Zero information loss.
  • B can re-derive any decision A made.

Cons:

  • Token cost grows linearly with history.
  • B's prompt becomes a mix of A's persona and its own — degrades behaviour.
  • Sensitive data leaks across role boundaries.

Use it as the lazy default until cost or quality forces a change. It always changes.

Pattern 2: summary handoff

A produces a structured summary; B receives the summary, not the history.

{
  "task": "Write SQL to compute Q1 churn for tenant X",
  "context_summary": "User asked about churn. Confirmed tenant=X. Time range Q1 2026. Requested CSV output.",
  "decisions_made": ["scope=tenant X", "output=CSV"],
  "open_questions": []
}

When to use: linear pipelines where agent B is a specialist that does not need turn-by-turn nuance.

Pros:

  • 5–20× token savings vs. full context.
  • B's prompt stays focused.

Cons:

  • The summariser is a failure point. A bad summary is a silent quality regression.
  • Hard to recover lost context if B asks a follow-up.

Mitigation: log the full pre-summary context with the trace ID. If B fails, you can replay with full context for debugging.

Pattern 3: structured-state handoff

Both agents read and write a typed state object. The conversation history is not transferred — the state is.

interface PipelineState {
  user_request: string;
  tenant_id: string;
  schema_explored: boolean;
  query_drafted: string | null;
  query_validated: boolean;
  result: QueryResult | null;
}

A writes to the state, hands off (passing only the state ref). B reads, mutates, returns. The state is the single source of truth.

When to use: structured pipelines with well-defined steps. Most production multi-agent systems.

Pros:

  • Token-efficient — only the state is in context, not the conversation.
  • Type-safe boundaries between agents.
  • Excellent for observability — each agent's contribution to the state is visible.
  • Resumable: a failed run restarts from the last good state.

Cons:

  • Requires upfront schema design. Schema evolution is painful mid-flight.
  • Agents that need free-form conversational context have to fall back to one of the other patterns.

This is the LangGraph default. AutoGen, CrewAI, and most production frameworks support it.

Pattern 4: shared-memory handoff

Agents do not transfer context at all. They both read from a shared memory store. The handoff transfers only task identity and continuation.

A: "B, please answer task #4521 from memory store ms_42."
B: <reads ms_42, sees task #4521, sees relevant facts, answers>

When to use: long-running pipelines with many agents over hours/days. Agents that need both episodic memory and current task context.

Pros:

  • Decouples context from the wire protocol entirely.
  • Multiple agents can work in parallel against the same memory.
  • Memory persists across sessions; handoff is fast.

Cons:

Picking the pattern

Decision Pattern
2 agents, prototype Full context
Linear pipeline, well-known specialists Summary
Structured pipeline, production reliability Structured state
Long-running, parallel, persistent Shared memory

It is normal to mix patterns within one system: structured state at the supervisor level, full context within a sub-agent, shared memory for cross-session facts.

The metadata every handoff needs

Whichever pattern, every handoff payload should carry:

  • Trace ID. Without it, debugging is hopeless.
  • Caller chain. Who delegated to whom (matters for audit trails).
  • Budget remaining. Tokens, time, retries left.
  • Constraints. What B is not allowed to do (e.g., "do not call external APIs").

Make these fields mandatory at the framework level. Optional fields get skipped, then debugging is impossible.

Anti-patterns

  • Handoff via shared mutable state without a schema. Every agent invents a different shape; integration tests catch nothing.
  • Free-text instructions in the handoff. "Continue what I was doing" — B will hallucinate what that means.
  • No return path. B finishes; nothing knows. Always specify where output goes.
  • Cycle without budget. A → B → A → B... loops cost real money. Cap depth.

What is changing

The MCP working group's draft A2A extension formalises a structured-state handoff format. Expect this to land in 2026 spec drops; LangGraph, AutoGen, and CrewAI will adapt within a quarter. If you start a multi-agent system today, model your handoff after structured-state — it will port forward cleanly.

Loadout

Build your AI agent loadout

Directory
Contact
© 2026 Loadout. Built on Angular 21 SSR.