Agent Patterns¶
Reference implementations for the agent architecture patterns described in Chapter 6: Agent Architecture. Each example is self-contained with its own README, dependencies, and runnable code.
All examples use the shared provider library for LLM access via OpenRouter.
Patterns¶
| Pattern | Description | Difficulty |
|---|---|---|
| Chat Agent | Interactive conversational agent with tool use, context management, and human escalation | Intermediate |
| Background Agent | Autonomous task processor with checkpointing, monitoring, and resource budgets | Intermediate |
| Agent Hub | Central orchestrator that routes requests to specialist agents via a two-model pattern | Advanced |
| Streaming Chat | SSE streaming agent with tool calling via MCP during response generation | Advanced |
Which Pattern to Start With¶
- New to agents? Start with Chat Agent. The feedback loop is immediate and you will learn what works before automating.
- Need autonomous processing? Use Background Agent for well-defined, repetitive tasks that run without human supervision.
- Scaling to multiple agents? The Agent Hub provides centralized routing, observability, and circuit breakers across specialist agents.
- Need low-latency responses with tools? Streaming Chat combines token streaming with mid-response tool execution.
Related Resources¶
- Building Your First Agent -- Step-by-step guide from design to deployment
- Agent Failure Recovery -- Workflow for diagnosing and recovering from the seven failure modes
- Agent Design Checklist -- Pre-deployment checklist covering all seven failure modes