Deep Dive: Agent Orchestration Patterns
Summary
Follows a dispatched agent through its full lifecycle - foreground vs background execution, auto-backgrounding of long tasks, sidechain transcripts for resume, layered tool filtering, and result handoff - then catalogs six reusable orchestration patterns: worker pool, pipeline, supervisor-worker, adversarial verification, fork-join, and resume chain. The adversarial verification agent, which must run real commands and issue a PASS/FAIL verdict while being forbidden from editing the project, gets special attention as a defense against LLM self-verification failure modes.
Key Takeaways
- Never trust an implementer's self-verification: a separate read-only agent must build, test, and probe adversarially
- Re-inject critical constraints every turn - long conversations make agents forget their rules
- Layer tool filtering: global denylist, per-agent-type restrictions, then per-instance allowances
- Every agent creation needs matching cleanup - eight resource types released in one finally block
- Explicit communication beats assumption: teammates are told exactly which tool makes messages visible
- Token economy is architectural: read-only scouts skip project docs and run on cheaper models
Reliability Note
English summary of a contributed deep-dive article (original text in Chinese) analyzing a reverse-engineered Claude Code snapshot. Unofficial - verify against official Anthropic docs and behavior.
Flows informed by this source
6Implement the Six Core Orchestration Patterns
Worker pool, pipeline, supervisor-worker, adversarial, fork-join, resume chain - build the reusable orchestration patterns every serious multi-agent system converges on.
+1 more steps to Done
Best forproduction-grade builds with strict verification
Stand Up an Adversarial Verification Agent
Stop trusting your agent's own 'it works': dispatch a read-only verifier that must run real commands, probe adversarially, and return an evidence-backed PASS/FAIL verdict.
+1 more steps to Done
Best forproduction-grade builds with strict verification
Choose the Right Dispatch: Spawn, Fork, or Direct
Three ways to hand work to a sub-agent - fresh-context spawn, cache-sharing fork, or just doing it yourself - and the decision matrix for picking per task.
+1 more steps to Done
Best forproduction-grade builds with strict verification
Sub-Agent Delegation with Context Isolation
Delegate bounded work to sub-agents that run in fresh context and return only distilled results - the pattern behind scalable long tasks.
+1 more steps to Done
Best forproduction-grade builds with strict verification
Verification Loops: Never Trust an Unrun Edit
Wire verification into your agent so every edit is checked by machines - syntax, tests, behavior - before it counts as done.
+1 more steps to Done
Best forbuilders who have shipped a basic app before
Observability for Agent Runs
Instrument your agent like production software: traces, session replay, cost tracking, and failure analysis on open standards.
+1 more steps to Done
Best forbuilders who have shipped a basic app before