Learn about AI agent patterns and practices from Anthropic’s article "Building effective agents" and its follow-up video.
- Introduction
- Background: What Is an AI Agent?
- AI Agent Patterns
- Best Practices
- Conclusion
- References
Introduction
There’s a growing buzz around AI agents—some even call 2025 “The Year of AI Agents.”
This reading note summarizes key design patterns and best practices for AI agents, based on Anthropic’s article and their follow-up video.
Note: This article was translated from my original post.
Background: What Is an AI Agent?
The term “AI agent” means different things to different people right now.
In this article, we refer to most systems described as AI agents under the broad term agentic systems, which can be divided into:
- Workflow: A system where LLMs and tools interact through predefined flows
- Agent: A system where the LLM dynamically decides its process and tool usage, autonomously managing how to complete tasks
Let’s explore the design patterns for these agentic systems.
AI Agent Patterns
The following diagrams are cited from here.
Augmented LLM
This “Augmented LLM” is the building block of agentic systems.
Each system is built around an LLM extended with:
- Retrieval
- Tools
- Memory
These extensions can be implemented more easily with tools like MCP.
From here on, “LLM call” refers to this Augmented LLM.
Workflow: Prompt chaining
- A workflow pattern that splits a task into sequential steps and passes outputs to the next
- Best for tasks that can be broken down into clear procedures
- Use case examples:
- Create marketing copy > Translate it
- Draft a document outline > Review > Write based on outline
Workflow: Routing
- A workflow pattern that classifies input and routes it to the appropriate process
- Best for complex workflows with clear task categories
- Use case examples:
- Classify customer support inquiries by type
- Use different models based on question difficulty to optimize cost and speed
Workflow: Parallelization
- A workflow pattern that splits a task and processes it in parallel, then aggregates the results
- Includes both: splitting into different tasks, or running the same task multiple times for variety
- Ideal for speeding up processing or generating outputs vetted from multiple perspectives
- Use case examples:
- Generate answers while checking for harmful content in parallel
- Evaluate LLM responses from different angles
- Check code vulnerabilities with multiple prompts
- Reduce false positives when flagging inappropriate content with multiple prompts
Workflow: Orchestrator-workers
- The orchestrator LLM breaks down a task dynamically, assigns work to worker LLMs, and integrates the results
- Best for complex tasks where needed subtasks are not known
- Different from Parallelization because task division is dynamic and input-specific
- Use case examples:
- Coding tasks requiring complex edits across multiple files
- Search tasks gathering and analyzing data from various sources
Workflow: Evaluator-optimizer
- One LLM generates output, another evaluates and provides feedback in a repeated loop
- Effective when clear evaluation criteria exist and feedback improves output quality
- Use case examples:
- Literary translation
- Tasks requiring multiple rounds of search and analysis
Agent
- In the Agent pattern, the system dynamically plans, executes tasks, and uses tools based on the goal—getting feedback from the environment and human
- LLM logic itself is simple, but tool design and instruction are key
- Suited for open-ended, non-routine tasks with unclear steps
- Use case examples:
- Coding agents
- Agents which use computer
Best Practices
Now let’s look at practices for building AI agents.
Keep it as simple as possible
When building with LLMs, start simple. Add complexity only when needed.
That means you often don’t need a full agent system. A single LLM call using in-context examples or retrieval is often enough.
Consider using an agent system only if more complex behavior is needed. For predefined tasks, a workflow is suitable, while an agent is better when more flexible and adaptive behavior is required.
Be cautious with frameworks
There are many frameworks for building AI agents, and more appear daily.
Examples:
Still, it’s best to begin with direct use of LLM APIs.
Frameworks may simplify development, but they also add abstraction layers that obscure internal behavior and prompt debugging. They can make even simple systems overly complex.
Start with plain API calls—then consider frameworks as needed.
Build products that get better with better models
Don’t build AI products that become obsolete when better models appear.
Instead, build products that become more valuable as better models emerge.
AI model progress isn’t slowing down.
What makes a good use case for AI agents?
AI agents shine in tasks that:
- Require both conversation and action
- Have clear success criteria
- Allow feedback loops
- Benefit from human oversight
Typical good fits:
- Customer support
- Coding agents
Tool design matters
Tool definitions and design are crucial.
Just like prompt engineering for the main prompt, tool design deserves careful thought.
Key considerations:
- Use output formats that are easy for the model to handle
- e.g. When returning code, using Markdown is easier for the model to handle than writing it inside JSON, because it requires less escaping
- Leave enough tokens for the model to "think"
- Stick to formats commonly seen in training data (internet text)
- Avoid unnecessary burdens
- e.g. don’t force exact line counts or string escaping
- Think from the model’s perspective
- Is the tool explanation clear? Can it be clearer by renaming parameters or rewording?
- Test how the model uses the tools
- Run lots of examples, look for mistakes, improve iteratively
- Add safeguards
- Tweak descriptions and arguments to prevent misuse
Put as much effort into the Agent–Computer Interface (ACI) as you would in Human–Computer Interface (HCI).
Reference Implementation
Anthropic has released reference implementations of these patterns:
They’re a great starting point to try these ideas out.
Conclusion
This reading note summarizes AI agent patterns and practices from Anthropic’s article.
Hope you found it useful!
[Related Posts]