# AI Agent Design Patterns

URL: https://aiseason.tech/ai-agent-design-patterns

Most working AI agents are built from a handful of repeatable shapes. A design pattern is one of those shapes: a known way to arrange model calls, tools and control flow so the system is reliable. This guide covers the patterns worth knowing (prompt chaining, routing, parallelisation, orchestrator-workers, evaluator-optimizer, ReAct, reflection, planning and multi-agent), when to use each, and the harness that every pattern runs inside.

| Fact | Value |
| --- | --- |
| A design pattern is | A reusable arrangement of LLM calls, tools and control flow that solves a common problem |
| Workflow | Steps are fixed in code; the model fills in each step |
| Agent | The model decides the next step in a loop, using tools, until the goal is met |
| Core agent pattern | ReAct: reason, act with a tool, observe the result, repeat |
| Rule of thumb | Use the simplest pattern that passes your tests |
| Harness | The loop, context, tools and limits around the model. It matters as much as the model |

### What are AI agent design patterns?

**AI agent design patterns are proven ways of structuring an LLM application: how many model calls there are, what each one sees, which tools it can use and who decides what happens next.** They give you a vocabulary for design decisions, in the same way software design patterns do for ordinary code.

Patterns fall into two families. In an **agentic workflow** you decide the path in code. In an **agent** the model decides the path at run time. Neither is better in general; each fits different problems.

### Workflow vs agent: what is the difference?

|  | Workflow | Agent |
| --- | --- | --- |
| Who decides the next step | Your code | The model |
| Path | Known in advance | Discovered while running |
| Cost and latency | Predictable | Variable |
| Easy to test | Yes | Harder; needs evaluation runs |
| Best for | Well-defined tasks: extract, classify, summarise, draft | Open-ended tasks: research, debugging, multi-step support |

> Start with a single model call. Move to a workflow when one call is not enough, and to an agent only when the steps genuinely cannot be listed in advance.

### The five agentic workflow patterns

#### 1. Prompt chaining

Split a task into fixed steps, where each model call works on the previous output. Example: write an outline, check the outline against rules, then write the article. Use it when the task breaks cleanly into stages and you want to check quality between them.

#### 2. Routing

A first call classifies the input and sends it to a specialised prompt, tool set or model. Example: a support bot that sends billing questions, technical questions and refund requests down different paths. Use it when inputs fall into distinct categories that need different handling.

#### 3. Parallelisation

Run several calls at once and combine the results. Either split a job into independent parts (sectioning) or run the same job several times and vote. Example: one call checks a reply for accuracy while another checks it for unsafe content.

#### 4. Orchestrator-workers

A lead model breaks the task into sub-tasks at run time, hands them to worker calls, and combines the answers. Unlike parallelisation, the sub-tasks are not known beforehand. Example: a coding agent that decides which files need changes and assigns each.

#### 5. Evaluator-optimizer

One call produces a draft; a second call reviews it against clear criteria and sends feedback; the loop repeats until the reviewer passes it. Use it when you can state what good looks like and a second look measurably improves the result, as in translation or code review.

### Agent patterns: ReAct, reflection, planning and multi-agent

#### The ReAct pattern

**ReAct (reason and act) is the basic agent loop: the model thinks about what to do, calls a tool, reads the result, and repeats until it can answer.** Almost every tool-using agent is a ReAct loop underneath.

```python
def react_agent(question: str, tools: dict, max_steps: int = 8) -> str:
    messages = [{"role": "user", "content": question}]
    for _ in range(max_steps):
        reply = call_model(messages, tools)      # reason: answer or pick a tool
        messages.append(reply)
        if not reply.tool_calls:                  # no tool needed: finished
            return reply.content
        for call in reply.tool_calls:             # act
            result = tools[call.name](**call.args)
            messages.append(tool_result(call.id, result))  # observe
    return "Stopped: step limit reached."
```

#### The reflection pattern

The agent reviews its own output before returning it, or after a failure, and tries again with what it learned. Reflection works best when there is a real signal to reflect on: a failing test, a validation error, a tool's error message. Self-criticism without evidence adds cost and little else.

#### The planning pattern

The agent first writes a plan (a to-do list of steps), then executes the steps, updating the plan as it learns. Planning helps on long tasks where a plain loop loses track. Writing the plan to a file or state field keeps it in view as the context fills up.

#### Multi-agent patterns

Several agents, each with its own prompt, tools and context, work together. The common shapes are a **supervisor** that delegates to specialists, **handoffs** where one agent passes the conversation to another, and **sub-agents** that do a side task in a clean context and return a summary. The main benefit is context isolation, not teamwork for its own sake. See [A2A](https://aiseason.tech/a2a-protocol) for agents that talk across systems.

### Which pattern should you use?

| If your task is… | Start with | Example |
| --- | --- | --- |
| One clear transformation | A single call with a good prompt | Summarise a meeting |
| A fixed sequence of stages | Prompt chaining | Outline, then draft, then translate |
| Different kinds of input | Routing | Triage support tickets |
| Independent checks or parts | Parallelisation | Guardrail check beside the main answer |
| Sub-tasks unknown in advance | Orchestrator-workers | Multi-file code change |
| Quality that improves with review | Evaluator-optimizer | Polished translation |
| Open-ended, tool-heavy work | ReAct agent | Research a question on the web |
| Very long tasks | ReAct with planning | Build a small app end to end |
| Too much context for one agent | Supervisor with sub-agents | Research plus coding plus review |

### Harness engineering: the system around the model

**An agent harness is everything around the model that turns it into an agent: the loop, the system prompt, the tool definitions, how context is assembled and trimmed, permissions, retries and stop conditions.** Two agents using the same model can perform very differently because their harnesses differ.

- **The loop**: step limits, timeouts and what happens when a tool fails.
- **Context**: what the model sees on each step, and what is summarised or stored outside. See [agent memory](https://aiseason.tech/ai-agent-memory).
- **Tool surface**: few, well-described tools with validated inputs. See [tool calling](https://aiseason.tech/tool-calling).
- **Checks**: tests, validators and human approval for risky actions. See [agent security](https://aiseason.tech/ai-agent-security).
- **Observability**: traces of every step so you can see why a run failed. See [agent evaluation](https://aiseason.tech/ai-agent-evaluation).

Improving the harness is usually the cheapest way to improve an agent, ahead of changing the model.

### How AI Season teaches design patterns

Session 4 of the [AI Season curriculum](https://aiseason.tech/curriculum) is Design Patterns and Harness Engineering. Students implement ReAct, planning, reflection and routing by hand, then rebuild them in [LangGraph](https://aiseason.tech/langgraph-tutorial), and learn to choose the smallest pattern that works. Cohort 02 starts 1st January 2027.

### Frequently asked questions

**What are the main AI agent design patterns?**
The workflow patterns are prompt chaining, routing, parallelisation, orchestrator-workers and evaluator-optimizer. The agent patterns are ReAct (tool use in a loop), reflection, planning and multi-agent collaboration.

**What is the difference between a workflow and an agent?**
In a workflow, your code fixes the sequence of steps and the model completes each one. In an agent, the model chooses the next step itself in a loop. Workflows are more predictable; agents handle open-ended tasks.

**What is the ReAct pattern?**
ReAct stands for reason and act. The model reasons about the task, calls a tool, observes the result and repeats until it can give a final answer. It is the loop inside most tool-using agents.

**What is the reflection pattern in AI agents?**
Reflection is when an agent checks its own output or a failure, then revises. It works best with a concrete signal such as a failed test or validation error.

**What is agent harness engineering?**
Harness engineering is designing the system around the model: the loop, context management, tools, permissions and stop conditions. It often improves an agent more than switching models.

**Do I need a multi-agent system?**
Usually not at first. A single agent with good tools handles most tasks. Add more agents when one context window is overloaded or when tasks need clearly separate roles.

---

_Last updated: 2026-11-16. Canonical page: https://aiseason.tech/ai-agent-design-patterns. Source: AI Season (https://aiseason.tech/)._
