16 - Agent Frameworks
Frameworks package the agent loop, tool schemas, state, approvals, multi-agent wiring and tracing so you don't rebuild them for every project - and they hide those mechanics, which is why this module comes after you built the loop by hand. You learn what each major framework is built around, how to choose one (or none), and build the same agent in seven of them.
- Explain what an agent framework adds to a raw model API loop and what it hides, and place frameworks on the layer map
- Compare LangChain/LangGraph, OpenAI Agents SDK, Claude Agent SDK, Google ADK, CrewAI, Microsoft Agent Framework and PydanticAI by abstraction, state, human-in-the-loop, durability and model neutrality
- Implement human approval and resumable runs in each framework's native style
- Choose a framework for a project with a written rationale backed by measurements
- Agent Foundations - the loop, tools, evaluation
- Agent Patterns & Multi-Agent - the patterns frameworks implement
- Python 3.10+; a local OpenAI-compatible model server or a hosted API
Where This Module Fits
flowchart LR
C["01 Choosing a<br/>framework"] --> G["02 LangChain /<br/>LangGraph"]
C --> O["03 OpenAI<br/>Agents SDK"]
C --> CL["04 Claude<br/>Agent SDK"]
C --> A["05 Google ADK"]
C --> CR["06 CrewAI"]
C --> M["07 Microsoft Agent<br/>Framework"]
C --> P["08 PydanticAI"]
G & O & CL & A & CR & M & P -.-> LAB["🧪 Lab: one agent,<br/>many frameworks"]
style C fill:#e8e2d9,stroke:#ccc4b8
style LAB fill:#dde4dc,stroke:#b0c4b0
Chapters 2-8 are independent: read chapter 1, then the frameworks you are considering. Running agents in production - durable execution, security, observability, cost - is Production Agents.
Chapter Map
| # | Chapter | You will learn | Time |
|---|---|---|---|
| 1 | Choosing an Agent Framework | What frameworks add and hide, the layer map, comparison, decision guide, when to use none | 45 min |
| 2 | LangChain and LangGraph | create_agent and middleware; state graphs, checkpoints, interrupt()/Command, Store | 50 min |
| 3 | OpenAI Agents SDK | Agents, handoffs, guardrails, sessions, approvals with RunState, tracing | 40 min |
| 4 | Claude Agent SDK | The Claude Code harness as a library: built-in tools, permissions, hooks, subagents, skills | 40 min |
| 5 | Google ADK | LlmAgent, Runner and sessions, graph Workflows, callbacks, confirmation, deploy | 45 min |
| 6 | CrewAI | Crews of role-playing agents, processes, Flows with typed state | 40 min |
| 7 | Microsoft Agent Framework | Agents, graph workflows with checkpoints, orchestrations, migration from AutoGen/Semantic Kernel | 40 min |
| 8 | PydanticAI | Typed agents, dependency injection, deferred tools, testing, durable execution | 35 min |
| 9 | Q&A Review Bank | 31 questions across the module | 45 min |
Code Lab
| Lab | What you build | Runs on |
|---|---|---|
| One Agent, Many Frameworks | The Lab 13 shop agent with a refund approval step in LangChain, OpenAI Agents SDK, ADK, CrewAI, MAF and PydanticAI (graded on state), plus a Claude Agent SDK version | A local OpenAI-compatible model (laptop) or any hosted API; Claude Agent SDK needs an Anthropic key |
Mini-Project
Choose a framework for a real agent at your work, with evidence:
- A task set of 20+ inputs with state-based or rubric checks.
- Two candidate frameworks, the tools shared as plain functions, one approval step in each.
- Task success (with confidence intervals), tokens, latency and lines of framework-specific code for each.
- A one-page decision covering deployment, durability, observability, lock-in and upgrade risk - not just the numbers.
Review
- Q&A Review Bank - consolidated questions for this module
- Module quiz - every Check Yourself question in this module, in course order
Previous: 15 - Agent Patterns & Multi-Agent · Next: 17 - Production Agents
Section Appendix
Summary & Key Terms - a quick recap of this section and its essential vocabulary.