Patterns
for Building
AI Agents

Practical strategies for taking AI agents to production.

  • Design Patterns
  • Context Engineering
  • Eval Workflows
  • Security
Patterns for Building AI Agents stacked on a shelf.

32,500 Books Printed

Combined across both books, distributed to people across the globe.

Principles of Building AI Agents displayed on an event.

Principles

Start with the first book in the agentic series to learn the fundamentals

Sam Bhagwat introducing Principles of Building AI Agents.

Sam Bhagwat

Sam Bhagwat (CEO of Mastra) goes over a few chapters of his new book “Principles of Building AI Agents”

Read and shared worldwide.

Get your free copy of “Patterns”

What's inside?

Practical patterns for taking AI agents from prototype to production. Learn strategies emerging from teams pushing agents into production at prominent AI companies.

  • Whiteboard Agent Capabilities
  • Evolve Your Agent Architecture
  • Dynamic Agents
  • Human-in-the-Loop

  • Parallelize Carefully
  • Share Context Between Subagents
  • Avoid Context Failure Modes
  • Compress Context
  • Feed Errors Into Context

  • List Failure Modes
  • List Critical Business Metrics
  • Cross-Reference Failure Modes and Success Metrics
  • Iterate Against Your Evals
  • Create an Eval Test Suite
  • Have SMEs Label Data
  • Create Datasets from Production Data
  • Evaluate Production Data

  • Prevent the Lethal Trifecta
  • Sandbox Code Execution
  • Granular Agent Access Control
  • Agent Guardrails

5. What's Next(ish)