<aside>

**Foundation Patterns | Advanced Patterns | Cross-Cutting | Pitfalls | Example**

</aside>

<aside>

A practical framework for designing AI agents from prototype to production

Six core patterns. When to use each, how they work, and the trade-offs that matter.

Built from designing and shipping agentic workflows in SaaS - the patterns I reach for, the trade-offs that decide between them, and the failure modes worth avoiding.


When to Use This

<aside> <img src="/icons/bullseye_orange.svg" alt="/icons/bullseye_orange.svg" width="40px" />

TL;DR

<aside> <img src="/icons/light-bulb_orange.svg" alt="/icons/light-bulb_orange.svg" width="40px" />

Key Principle

The right pattern is the simplest one that still meets the quality bar. Most production agent systems are single agents or sequential chains, not multi-agent systems.

</aside>

</aside>

<aside>

Decision Framework

Goal: Pick the right pattern in under a minute by answering four questions in order.

  1. Fixed or dynamic flow? Fixed → workflow agent (sequential, parallel, loop). Dynamic → LLM-driven router (coordinator, agent-as-tool).
  2. Sub-tasks independent or ordered? Independent → parallel. Ordered → sequential.
  3. Need a quality bar or guardrail? Yes → wrap output in a loop (review & critique).
  4. Who owns state? Sub-agent owns state → coordinator. Primary agent owns state → agent-as-tool.

<aside> <img src="/icons/light-bulb_orange.svg" alt="/icons/light-bulb_orange.svg" width="40px" />

Pro Tip!

If you can't answer Q1 cleanly, you don't have a flow yet, you have a prompt. Stay with a single agent until the path forks for a real reason.

</aside>

Pattern Selector

If you need… Use this pattern Why
A quick prototype or single-turn task Single agent Lowest setup cost, maximum flexibility
A repeatable pipeline with fixed steps Sequential Predictable, easy to debug step by step
Independent sub-tasks, latency matters Parallel Concurrent execution cuts wall-clock time
Output must meet a non-negotiable criterion Loop (review & critique) Iterative refinement until pass or max-iter
Dynamic routing across specialists Coordinator LLM picks the right sub-agent at runtime
Primary agent stays in control, calls helpers Agent as tool Stateless calls, central state ownership
</aside>

<aside>

1. Single Agent

Goal: Handle the entire task with one LLM, one system prompt, and an optional tool list.

When to Use

How It Works

Trade-offs

Example

A trip-planning assistant that takes a destination and returns a draft itinerary in one shot.

<aside> <img src="/icons/light-bulb_orange.svg" alt="/icons/light-bulb_orange.svg" width="40px" />

Pro Tip!

If your prompt grows past one screen, the task is asking for decomposition. Move to sequential or coordinator before patching the prompt again.

</aside>

Flow

---
config:
  layout: elk
  elk:
    nodePlacementStrategy: NETWORK_SIMPLEX
---
flowchart TD
    U["User Request"] e1@==> A["LLM Agent<br><i>system prompt + tools</i>"]
    A [email protected]>|"optional call"| T1["Tool A"]
    A [email protected]>|"optional call"| T2["Tool B"]
    T1 [email protected]>|"result"| A
    T2 [email protected]>|"result"| A
    A e6@==> R["Response"]

    e1@{ animation: slow }
    e2@{ animation: slow }
    e3@{ animation: slow }
    e4@{ animation: slow }
    e5@{ animation: slow }
    e6@{ animation: slow }

    style U fill:#F0F4F8,stroke:#37474F,stroke-width:2px,color:#333
    style A fill:#E8DFF5,stroke:#5E35B1,stroke-width:2px,color:#333
    style T1 fill:#FFF8E1,stroke:#F57F17,stroke-width:2px,color:#333
    style T2 fill:#FFF8E1,stroke:#F57F17,stroke-width:2px,color:#333
    style R fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px,color:#333

</aside>

<aside>

2. Sequential Agent

Goal: Run a fixed pipeline of sub-agents where the output of step N becomes the input to step N+1.

When to Use

How It Works

Trade-offs

Example

Trip planner: food_finder runs first, then transportation_agent reads the food output from session state and plans transit around it.

</aside>

<aside>

</aside>

<aside>

</aside>

<aside>

</aside>

<aside>

</aside>

<aside>

</aside>