---
title: "Agentic Pattern Language: sourced patterns for working with AI agents"
description: "Named patterns for working with AI agents, each quoted from the people who published or run it."
url: https://agenticpatternlanguage.com/
---

# A *pattern language* for working with agents

Each pattern is named, numbered and quoted from the people who published it or run it.

[Sponsored by Socratify AI](https://socratify.ai/?prompt=I%20want%20to%20get%20better%20at%20working%20with%20AI%20agents.%20Coach%20me%20through%20a%20real%20task.&source_host=agenticpatternlanguage.com&source_path=%2F&utm_source=agenticpatternlanguage.com&utm_medium=sponsor&utm_campaign=agenticpatternlanguage&utm_content=hero)

[ 6Orchestrator and workers](https://agenticpatternlanguage.com/patterns/orchestrator-workers/)

* Person
* Model call
* Agent
* Tool
* Code
* Context

[How to read](https://agenticpatternlanguage.com/notation/)

[People and agents5](https://agenticpatternlanguage.com/#people-and-agents) [Systems of agents13](https://agenticpatternlanguage.com/#systems-of-agents) [One agent11](https://agenticpatternlanguage.com/#one-agent) [One call6](https://agenticpatternlanguage.com/#one-call) [Practices2](https://agenticpatternlanguage.com/#practices)

## People and agents

1. [1 Plan before coding Have the agent research and write a plan, and approve it yourself before it edits anything.](https://agenticpatternlanguage.com/patterns/plan-before-coding/)
2. [2 Human approval A person approves sensitive or irreversible actions before the agent takes them.](https://agenticpatternlanguage.com/patterns/human-approval/)
3. [29 Asynchronous coding agent Hand a task to an agent that works unattended in the cloud and returns a pull request to review.](https://agenticpatternlanguage.com/patterns/background-agent/)
4. [30 Parallel agents in separate worktrees Run several agents at once, each in its own checkout, then review and merge each one.](https://agenticpatternlanguage.com/patterns/parallel-agents-in-worktrees/)
5. [33 Checkpoint and rewind Snapshot the code before each agent turn, and go back to it when the agent goes off track.](https://agenticpatternlanguage.com/patterns/checkpoint-and-rewind/)

## Systems of agents

1. [3 Prompt chaining Split a task into fixed steps; each call works on the output of the one before.](https://agenticpatternlanguage.com/patterns/prompt-chaining/)
2. [4 Routing Classify each input, then send it to the prompt, model or agent built for that kind.](https://agenticpatternlanguage.com/patterns/routing/)
3. [5 Parallelization Run independent subtasks or repeated attempts at once, then combine the results.](https://agenticpatternlanguage.com/patterns/parallelization/)
4. [6 Orchestrator and workers A lead model splits a task as it goes, hands the parts to workers and combines their results.](https://agenticpatternlanguage.com/patterns/orchestrator-workers/)
5. [7 Evaluator and optimizer One model writes, another judges against clear criteria, and the loop repeats until it passes.](https://agenticpatternlanguage.com/patterns/evaluator-optimizer/)
6. [8 Advisor A fast, cheap model does the work and asks a stronger model for guidance at hard moments.](https://agenticpatternlanguage.com/patterns/advisor/)
7. [9 Handoff One agent passes the conversation to another that specializes in what comes next.](https://agenticpatternlanguage.com/patterns/handoff/)
8. [13 Subagent with its own context window Send a side task to a subagent with a fresh context window; only its short summary comes back.](https://agenticpatternlanguage.com/patterns/subagent-own-context-window/)
9. [20 Guardrails Screen user input before the agent sees it, and its output and actions before they take effect.](https://agenticpatternlanguage.com/patterns/guardrails/)
10. [26 Plan-and-execute A planner model writes the whole plan, executors carry out the steps, and the planner replans.](https://agenticpatternlanguage.com/patterns/plan-and-execute/)
11. [32 LLM cascade A cheap model answers first; only answers that fail a confidence check go to a stronger model.](https://agenticpatternlanguage.com/patterns/llm-cascade/)
12. [34 Multi-agent debate Have agents argue over each other’s answers for several rounds, then let a judge settle the result.](https://agenticpatternlanguage.com/patterns/multi-agent-debate/)
13. [37 Dual LLM Keep untrusted text away from the model that can act; a second model with no tools reads it instead.](https://agenticpatternlanguage.com/patterns/dual-llm/)

## One agent

1. [10 Agent loop A model uses tools in a loop, deciding each next step from what the last one returned.](https://agenticpatternlanguage.com/patterns/agent-loop/)
2. [11 Reflection The agent critiques its own output or past attempts, then tries again.](https://agenticpatternlanguage.com/patterns/reflection/)
3. [12 Compaction When the context window fills, summarize the conversation and continue from the summary.](https://agenticpatternlanguage.com/patterns/compaction/)
4. [14 Structured note-taking The agent writes notes to a file outside its context window and reads them back later.](https://agenticpatternlanguage.com/patterns/structured-note-taking/)
5. [15 Tool result clearing Replace old tool results in the history with a short placeholder once the agent has used them.](https://agenticpatternlanguage.com/patterns/tool-result-clearing/)
6. [16 Just-in-time context retrieval Keep file paths, queries and links in context; load the data with tools only when it is needed.](https://agenticpatternlanguage.com/patterns/just-in-time-context-retrieval/)
7. [21 Sandboxing Run the agent inside set limits on files and network so it can act without asking each time.](https://agenticpatternlanguage.com/patterns/sandboxing/)
8. [22 Code actions The agent writes code that calls its tools, and an interpreter runs it and returns the result.](https://agenticpatternlanguage.com/patterns/code-actions/)
9. [27 Todo list The agent keeps a task list in its context and rewrites it as it works, so the goal stays in view.](https://agenticpatternlanguage.com/patterns/todo-list/)
10. [28 Skills Keep each skill’s name and description in context; load its instructions only when a task needs it.](https://agenticpatternlanguage.com/patterns/skills/)
11. [35 Tool search Give the agent a search over its tools, and load only the tool definitions a task needs.](https://agenticpatternlanguage.com/patterns/tool-search/)

## One call

1. [17 LLM as a judge One model call grades another model’s output against written criteria.](https://agenticpatternlanguage.com/patterns/llm-as-a-judge/)
2. [18 Retrieval-augmented generation One retrieval step before the call: add passages relevant to the query to the prompt.](https://agenticpatternlanguage.com/patterns/retrieval-augmented-generation/)
3. [23 Contextual retrieval Before indexing, prepend to each chunk a short model-written note on where it sits in its document.](https://agenticpatternlanguage.com/patterns/contextual-retrieval/)
4. [24 Reranking Retrieve many candidates, then let a reranker keep only the most relevant few for the model.](https://agenticpatternlanguage.com/patterns/reranking/)
5. [25 Query rewriting Have a model rewrite the user’s query, with the conversation so far, before searching with it.](https://agenticpatternlanguage.com/patterns/query-rewriting/)
6. [36 Spotlighting Mark untrusted text inside the prompt so the model can tell it apart from your instructions.](https://agenticpatternlanguage.com/patterns/spotlighting/)

## Practices

1. [19 Eval-driven development Write evals first, run them on every change, and turn each reported failure into a test case.](https://agenticpatternlanguage.com/patterns/eval-driven-development/)
2. [31 Test-first development Write the tests first and confirm they fail; the agent then works until they pass.](https://agenticpatternlanguage.com/patterns/test-first-development/)
