Design patterns for AI agent systems¶
Go deeper · 45 min · code optional
Before this: Architecture patterns · After this: Design principles Hands-on version: 3 The agent loop
Foundation: basic architecture patterns¶
Simple model¶
When to use¶
- Tasks require only text generation
- No external actions or tool usage needed
- Direct question-answer scenarios from training data
- Document summarization or code generation from specifications
Characteristics¶
- Fast and cost-effective
- Easy to implement with direct LLM API calls
- Limited to text processing, analysis, or generation
Example use cases¶
- Text completion and generation
- Simple question answering
- Content summarization
- Code generation from clear specifications
Single agent¶
When to use¶
- Tasks require actions beyond text generation
- Solution involves known action sequences with action-perception loops
- Can be handled effectively by one type of expertise
- Tasks involve API calls with result validation
- No need for specialized domain expertise or complex collaboration
Characteristics¶
- Flexible with tool usage capabilities
- Moderate complexity
- Can handle action-taking with appropriate tools
- May struggle with highly complex multi-step tasks
Example use cases¶
- Simple automation tasks
- Basic tool calling scenarios
- Straightforward decision-making
- Tasks requiring validation loops
Multi-agent workflow¶
When to use¶
- Solution can be expressed as a well-defined workflow
- Benefits from specialized expertise or domain separation
- Different parts of the task require distinct domain knowledge
- Collaboration pattern between agents is well-understood
- Each agent's role and handoffs follow established processes
Characteristics¶
- Structured and maintainable
- Clear agent responsibilities
- Orchestrated, predictable execution flow
- Requires upfront design
- Less flexible than autonomous approaches
Example use cases¶
- Content creation pipeline (research, writing, editing agents)
- Customer service routing (triage, specialist, resolution)
- Financial analysis (market data, risk assessment, portfolio optimization)
- Data processing workflows with specialized steps
Workflow patterns (explicit control)¶
Workflow patterns provide developer-defined execution paths with predictable behavior. These patterns borrow concepts from graph theory to model multi-agent orchestration as computational graphs where nodes represent computational units and edges define control flow between nodes.
Sequential workflows¶
Sequential workflows implement linear execution where each node's output feeds into the next node (A → B → C), ensuring ordered processing with predictable execution timing.
Conditional workflows¶
Conditional workflows use logic-based edges to determine the next node based on conditions, enabling branching execution paths and dynamic routing.
Supervisor workflows¶
A supervisor workflow is a conditional workflow variant where a central control node evaluates requests and routes tasks to specialized agents based on task characteristics.
Hierarchical workflows¶
Parallel workflows¶
Autonomous patterns (emergent control)¶
Autonomous patterns enable runtime-determined execution based on task state and agent reasoning. The critical concept is that the flow of control is driven by an AI model and dynamically determined at runtime. Rather than following prescribed paths, agents orchestrate through communication and shared understanding of the current task context.
These patterns exist on a spectrum of control, from structured orchestration to fully emergent behavior.
Plan-based orchestration pattern¶
Handoff pattern¶
Conversation-driven pattern (AI-driven conversation pattern)¶
When multiple agents actually help¶
The most consequential decision on this page, and the one most often made by default rather than deliberately. Multi-agent architectures are attractive because they map neatly onto how we think about teams. That is not evidence that they work better.
Two companies shipping real agents published opposite conclusions one day apart in June 2025, and reading them as a pair teaches the actual criterion:
- Cognition argued against multi-agent systems: sub-agents lose the context the main agent had, make conflicting assumptions, and produce work that does not compose. Their prescription was a single agent with a continuous context.
- Anthropic described a multi-agent research system that worked, where parallel sub-agents each explored a different line of enquiry and returned findings.
Both are right, and the difference between the cases is the criterion:
| Multi-agent tends to work | Multi-agent tends to fail |
|---|---|
| Read-heavy work: search, research, review | Work that writes or edits shared state |
| Sub-tasks that are genuinely independent | Sub-tasks that depend on each other's decisions |
| Findings compose by concatenation | Results must be reconciled into one coherent artefact |
| Parallelism is the point | The task is sequential anyway |
Cognition later revised their position: what works is multiple agents contributing intelligence while writes stay single-threaded. That is the rule worth remembering. Parallelise the reading; keep one writer.
Each agent multiplies the cost and the failure surface
Every sub-agent has its own context, resends its own history, and can fail in its own plausible-looking way. Three agents is not three times the cost — it is three times the cost plus the coordination overhead plus the tokens spent passing context between them.
It also multiplies what you must trace. Debugging "why did it do that?" across four agents needs correlated traces from the start, not after the first incident.
The order to try: one agent with more tools, then one agent with better retrieval, then sub-agents for parallel read-only work, then multiple writers. Most teams that reach for the last one have not exhausted the first.
Pattern selection criteria¶
By task¶
- Well-defined, repeatable processes → Workflow patterns (Sequential, Conditional, Parallel)
- Dynamic, exploratory tasks → Autonomous patterns (Conversation-driven)
- Complex planning required → Plan-Based Orchestration
- Domain expertise needed → Handoff patterns
- Emergent solutions required → AI-Driven Conversation
By system requirement¶
- High predictability needed → Workflow patterns
- Maximum autonomy required → AI-Driven Conversation
- Resource constraints → Handoff patterns (minimal coordination overhead)
- Scalability concerns → Parallel Workflows or Handoff patterns
- Transparency required → Conversation-driven patterns (shared visibility)
By implementation constraint¶
- Developer resources available → Workflow patterns (explicit control)
- Rapid prototyping needed → Conversation-driven patterns (simple implementation)
- Production reliability critical → Workflow patterns with explicit task management
- Human oversight required → Any pattern with human-in-the-loop integration
- Complex task decomposition → Plan-Based Orchestration
Go deeper¶
- Anthropic: building effective agents — where most of this vocabulary comes from, and clear that the simplest pattern that works is the right one.
- Foundry Agent Service — these patterns as a managed service.
- Microsoft Agent Framework — graph-based orchestration on .NET and Python.
- LangGraph — supervisor, hierarchical and parallel patterns as explicit graphs with checkpointing.
- OpenAI Agents SDK — handoffs as a first-class concept, which is the pattern most frameworks model worst.
- C# samples in this repository — the handoff, tool and workflow patterns as single-file programs you can run with
dotnet run. - Build the loop yourself — about thirty lines. Do this once and every pattern above reads differently.