Building Effective AI Agents: Anthropic's Guide to Agentic Systems

Anthropic recommends building AI agents using simple, composable patterns rather than complex frameworks, as the most successful implementations prioritize the right level of complexity for the specific task. The core philosophy is to start with the simplest possible solution—often a single LLM call—and only increase complexity when it demonstrably improves outcomes.

Distinguishing Workflows from Agents

Anthropic categorizes all LLM-driven systems as "agentic systems," but makes a critical architectural distinction between workflows and agents:

  • Workflows: Systems where LLMs and tools are orchestrated through predefined code paths. These offer predictability and consistency for well-defined tasks.
  • Agents: Systems where LLMs dynamically direct their own processes and tool usage, maintaining control over how they accomplish tasks. These are best for open-ended problems where the required steps cannot be hardcoded.

The Building Blocks of Agentic Systems

Every agentic system begins with the augmented LLM, which is an LLM enhanced with retrieval, tools, and memory. Anthropic suggests using the Model Context Protocol (MCP) to integrate third-party tools via a simple client implementation.

Compositional Workflows

When a task can be decomposed into predictable steps, workflows provide a reliable alternative to full autonomy:

  • Prompt Chaining: Decomposes a task into a sequence of steps where each LLM call processes the previous output. This is ideal for tasks like generating marketing copy and then translating it.
  • Routing: Classifies input to direct it to a specialized follow-up task. This allows for separation of concerns, such as routing customer service queries to different specialized prompts or directing easy questions to smaller models (e.g., Claude Haiku 4.5) and hard questions to more capable ones (e.g., Claude Sonnet 4.5).
  • Parallelization: Runs multiple LLM calls simultaneously. This includes Sectioning (breaking a task into independent subtasks, such as running a guardrail check in parallel with a response) and Voting (running the same task multiple times to get diverse outputs for higher confidence).
  • Orchestrator-Workers: A central LLM dynamically breaks down tasks and delegates them to worker LLMs. This is used for complex tasks where subtasks are unpredictable, such as making changes to multiple files in a coding project.
  • Evaluator-Optimizer: A loop where one LLM generates a response and another provides feedback for iterative refinement. This is effective for literary translation or complex search tasks requiring multiple rounds of analysis.

Autonomous Agents

Agents are used for open-ended problems where the LLM must plan and operate independently. They rely on a loop of tool use based on environmental feedback (ground truth) to assess progress.

Key Characteristics of Agents:

  • Dynamic Planning: Agents determine their own path to completion.
  • Human-in-the-Loop: Agents can pause for human feedback at checkpoints or blockers.
  • Stopping Conditions: To maintain control, agents typically include maximum iteration limits.

Anthropic cites their coding agent for SWE-bench tasks and their "computer use" reference implementation as primary examples of autonomous agents.

Best Practices for Implementation

Frameworks vs. Direct API Use

While frameworks like the Claude Agent SDK, AWS Strands, Rivet, and Vellum simplify low-level tasks, Anthropic warns that they can create abstraction layers that obscure prompts and responses, making debugging harder. They recommend starting with LLM APIs directly to maintain transparency.

Designing the Agent-Computer Interface (ACI)

Effective agents require high-quality tool documentation and design. Anthropic suggests treating tool definitions with the same rigor as prompt engineering:

  • Avoid Formatting Overhead: Use formats the model has seen naturally on the internet. Avoid requiring the model to perform complex calculations (like line counts for diffs) or excessive string-escaping (like JSON for code).
  • Poka-yoke (Error-Proofing): Design tool arguments to make mistakes harder. For example, Anthropic improved their SWE-bench agent by requiring absolute filepaths instead of relative filepaths, eliminating a common failure point.
  • Clear Documentation: Provide example usage, edge cases, and input format requirements within the tool definition.

Practical Applications

Anthropic identifies two high-value domains for agentic systems:

  1. Customer Support: Combines conversational interfaces with tools to pull customer data and perform actions (e.g., issuing refunds), where success is measured by user-defined resolutions.
  2. Coding Agents: Highly effective because code solutions are verifiable through automated tests, allowing agents to iterate based on objective feedback.

Core Principles for Success

To build reliable and maintainable agents, Anthropic emphasizes three principles:

  1. Simplicity: Maintain a simple design and avoid unnecessary complexity.
  2. Transparency: Explicitly show the agent's planning steps.
  3. ACI Optimization: Carefully craft tool documentation and testing to ensure the model can use tools flawlessly.

Sources

Related