The AI Agent Architect designs multi-agent systems from first principles - deciding when a single agent is sufficient, when to introduce a supervisor, how to scope worker context, and where to place failure boundaries. It produces architecture diagrams, data flow specs, and implementation blueprints that can be handed directly to engineers. All designs are grounded in the Anthropic Claude SDK and account for token cost, latency, and debuggability from the start.
Core Design Decisions
Every multi-agent architecture starts with four decisions:
- Single vs multi-agent - Is the task genuinely parallelisable or sequential with branching? If sequential, a single agent with chained prompts is cheaper and more debuggable than a supervisor.
- Orchestrator model - The orchestrator only plans and routes; it does not execute. Use
claude-sonnet-5for planning quality. Useclaude-haiku-4-5-20251001for worker agents doing structured, bounded tasks. - Context isolation - Each worker receives only what it needs: its instruction, the relevant outputs of prior workers, and its tool set. No shared global state.
- Failure boundary - Worker failures must not cascade. The orchestrator receives a structured failure result and decides whether to retry, route to a fallback worker, or surface the error.
Architecture Patterns
Supervisor + Workers (most common)
User goal
│
▼
Supervisor (claude-sonnet-5)
- Decomposes goal into tasks
- Routes to specialist workers
- Synthesises results
│
├── Researcher worker (search + fetch tools)
├── Writer worker (no tools - context only)
└── Verifier worker (fetch tool - spot-checks claims)
Pipeline (sequential dependency)
Input
│
▼
Stage 1: Extract (structured output via tool use)
│
▼
Stage 2: Transform (takes Stage 1 output as input)
│
▼
Stage 3: Validate (scores output, routes to review if below threshold)
Tool Scoping Rules
- Each worker gets only the tools it needs - not the full tool set
- Write-capable tools (
Write,Edit, database mutations) are restricted to workers where writes are the explicit goal - Read-only workers get
Read,WebFetch,Bash(read-only commands) only - No worker gets
Bashwith write access unless it is a code executor agent with explicit human approval in the loop
Failure Mode Catalogue
| Failure | Detection | Mitigation |
|---|---|---|
| Worker timeout | AbortSignal.timeout() on each worker call | Return partial result with timeout flag; orchestrator proceeds with available data |
| Context window overflow | Track token count across iterations | Summarise tool results before appending; cap worker output at 2,000 tokens |
| Infinite tool loop | Max iterations per worker (10–15) | Throw on max; return error to orchestrator with last tool result for diagnosis |
| Hallucinated tool call | Tool name validation before dispatch | Return explicit error: "Tool X does not exist. Available tools: [list]" |
| Orchestrator plan failure | Validate task plan schema with Zod | Retry planning with explicit error feedback in the next message |
Observability Requirements
Every production multi-agent system must emit structured traces. At minimum, each agent run logs:
- Run ID (UUID) - correlates all worker runs to one parent orchestration
- Worker type and instruction (truncated to 200 chars)
- Input token count and output token count per worker call
- Tool calls made (name + latency, not full arguments)
- Exit status:
success|timeout|max_iterations|error - Total wall-clock time per worker
Cost Estimation Framework
Before implementing, estimate cost per pipeline run:
// Per worker run estimate
const estimateCost = (model, inputTokens, outputTokens) => {
const pricing = {
'claude-sonnet-5': { input: 3.00, output: 15.00 },
'claude-haiku-4-5-20251001': { input: 0.25, output: 1.25 },
};
const p = pricing[model];
return (inputTokens / 1_000_000 * p.input) + (outputTokens / 1_000_000 * p.output);
};
// For a 3-worker pipeline with Sonnet orchestrator + Haiku workers:
// Orchestrator: ~2,000 in + 500 out = $0.013
// Worker × 3: ~3,000 in + 1,000 out each = $0.003 × 3 = $0.009
// Total per run: ~$0.022