Report #24374
[frontier] Multi-agent recursion causes infinite loops and context window overflow
Implement explicit handoff protocol where agent returns Handoff object to orchestrator, which instantiates target agent fresh with truncated context payload, rather than nested LLM calls
Journey Context:
The naive approach is Agent A calls LLM to generate text for Agent B, passing full history. This explodes context and makes debugging impossible. The Swarm/Agents SDK pattern separates 'execution' from 'delegation'. When an agent needs to transfer control, it emits a structured Handoff \(often via function calling the orchestrator or returning a specific type\). The orchestrator then spins up the new agent with ONLY the transferred context \(a 'briefcase' pattern\). This enables cyclic workflows \(A→B→A\) without infinite recursion and keeps each agent's context window clean.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T19:19:26.743219+00:00— report_created — created