Skip to content
AI Agents
Text size 2 of 4

Reference shelf

Patterns cheat sheet

The core agent and workflow patterns on one page.

The core agent and workflow patterns on one page. Reach for the simplest one that solves the task, and only add autonomy when the problem genuinely needs it.

The golden rule

A workflow with fixed steps is predictable, cheap, and easy to debug. An agent that decides its own path is flexible but slower, pricier, and harder to trust. Start with a workflow; upgrade to an agent only when the steps cannot be known in advance.

Workflow patterns

Deterministic pipelines where you own the control flow. The model fills in the hard parts, but the path is fixed and repeatable.

Prompt chaining

Break the task into a fixed sequence of calls, each using the last one's output. Add a check between steps to catch errors early.

Use when: a task splits into clear, ordered subtasks

Routing

Classify the input first, then send it to a handler specialized for that category. Keeps each path simple and separately tunable.

Use when: distinct kinds of input need different handling

Parallelization

Run calls concurrently, then combine. Either section the work, or sample multiple answers and vote for the best.

Use when: subtasks are independent, or you want several attempts

Orchestrator-workers

A lead model breaks the goal into subtasks on the fly and dispatches them to workers, then synthesizes the results.

Use when: the subtasks are not known ahead of time

Evaluator-optimizer

One model generates, another critiques against a rubric, and the loop repeats until the output passes or a budget runs out.

Use when: there are clear criteria and iteration helps

Agentic patterns

The model drives its own control flow, deciding what to do next from what it has seen. More capable, and more to get wrong.

ReAct

Interleave a short reasoning step with each tool call in a loop, so the agent adapts to results and its trace stays inspectable.

Use when: open-ended tasks that need tools and adaptation

Plan-and-execute

Draft the whole plan up front, then execute the steps, re-planning only when reality diverges. Fewer wasted calls than pure step-by-step.

Use when: multi-step tasks that benefit from thinking first

Reflection

The agent reviews its own output against the goal and revises, catching mistakes a single forward pass would ship.

Use when: quality matters and errors are self-detectable

Tool use

Give the model typed functions to call. Return errors as observations so it can recover instead of failing the run.

Use when: the agent must act on the world, not just talk

RAG

Retrieve relevant passages and put them in the prompt, so answers are grounded in real data rather than the model's memory.

Use when: the knowledge is external, current, or too big for context

Multi-agent supervisor

A supervisor routes work to specialist agents and merges their output. Add it only when one well-equipped agent genuinely is not enough.

Use when: distinct expertise or parallel roles help

Wrap everything in guardrails

Whatever pattern you pick, validate untrusted inputs and risky outputs around the loop, cap iterations and cost, and keep a human in the loop for high-stakes actions. Autonomy without limits is how agents blow up.