GuideIntermediate
Agents with Real SDKs: Claude Agent SDK and OpenAI Agents SDK
Build agents with the two official libraries the industry uses today: Anthropic's **Claude Agent SDK** and the **OpenAI Agents SDK**. You already know what an agent loop is; this guide teaches you to run it with a provider's SDK, to control it, and to decide which one fits you. You do it with a single case from start to finish: the support assistant for **Andén Norte**, a bus line that answers questions about its policies, looks up bookings, quotes refunds, and only issues them with human approval. First you write the loop by hand against the Messages API and the Responses API, so you see exactly what each SDK automates. Then you build the same agent with the Claude Agent SDK (built-in tools, in-process custom tools, permissions, approval with `can_use_tool`, hooks, subagents, MCP, and sessions) and with the OpenAI Agents SDK (`Agent` and `Runner`, function tools, typed context, sessions, handoffs, guardrails, approval with `needs_approval`, MCP, and tracing). At the end you put both behind a common interface, evaluate them with the same cases, measure their cost per run, choose with a written decision matrix, and deploy the result behind an API in a container. LangGraph is not taught here: this guide works directly with the providers' SDKs.
- 64
- lessons
- 8
- modules
- English · Spanish
- available in
- Free
- access
Outcomes
What you'll be able to do
- Explain what an agent SDK is (the harness: loop, tools, and context) and what you decide versus what the library decides
- Write the multi-step tool use loop against the Messages API and the Responses API, and read both wire formats
- Build an agent with the Claude Agent SDK: `query`, `ClaudeSDKClient`, built-in tools, custom tools on an in-process MCP server, resumable sessions
- Control what an agent does with permission modes, human approval (`can_use_tool`), audit hooks, and subagents with narrow tool sets
- Build the same agent with the OpenAI Agents SDK: `Agent`, `Runner`, function tools, typed context, structured output, and sessions
- Orchestrate a triage agent and a specialist with handoffs or with agents as tools, and protect them with guardrails and approval through `needs_approval`
- Connect MCP servers from both SDKs and read the traces of each run
- Put two implementations behind a common interface and evaluate them with the same case set, with trajectory and outcome checks
- Measure cost, turns, and latency per run and choose an SDK with written criteria
- Serve an agent behind FastAPI in a container, with secrets, spending limits, persistent sessions, and failure handling
Before you start
What you need to bring
It's for you if...
- Devs who already understand an agent loop (tools, `tool_use`, observe and repeat) and want to build it with a real SDK instead of simulating it
- Teams that have to choose between the Claude Agent SDK and the OpenAI Agents SDK and want to compare them with the same case and the same numbers
- Backend devs who need to take an agent into a service with permissions, human approval, controlled cost, and traces
Requirements and materials
- Intermediate Python with `async`/`await`, virtual environments, and `pip`
- Having completed the Agent Fundamentals and Tool Calling Guide, or knowing what `tool_use`, `tool_result`, and an agent loop are
- Recommended: the Building with LLMs in Code guide (first SDK call, structured outputs, single-turn tool calling)
- An Anthropic API key and an OpenAI API key with minimal credit; you can follow most of the guide with just one, and the comparison module needs both
Content
The syllabus, module by module
Open any of them to see its lessons.
- 1. Introduction to the guide: from a simulated loop to a real SDK
- 2. What an agent SDK actually does
- 3. The loop you already know
- 4. What you gain and what you give up
- 5. Environment, keys, and spending limits
- 6. The Andén Norte case
- 7. Versions, documentation, and model names
- 8. Project: the Andén workspace and the domain tests
- 1. Introduction to module 2: Manual tool use in both APIs
- 2. The Messages API tool loop
- 3. The Responses API function calling loop
- 4. Two wire formats side by side
- 5. A provider-neutral tool registry
- 6. The Anthropic Tool Runner
- 7. Limits, errors, and what hurts in a manual loop
- 8. Project: the Andén manual agent on both APIs
- 1. Introduction to Module 3: Claude Agent SDK foundations
- 2. Installing and your first `query()`
- 3. Reading the message stream
- 4. Built-in tools, `allowed_tools`, and `cwd`
- 5. Multi-turn with `ClaudeSDKClient`
- 6. Sessions: resume and fork
- 7. System prompts, settings, and model choice
- 8. Project: the Andén policy assistant
- 1. Introduction to Module 4: From an Assistant That Reads to an Agent That Acts
- 2. Custom Tools with an In-Process MCP Server
- 3. Connecting External MCP Servers
- 4. Permission Modes and Rules
- 5. Human Approval with `can_use_tool`
- 6. Hooks for Audit and Policy
- 7. Subagents
- 8. Project: The Andén Agent That Refunds Under Control
- 1. Introduction to Module 8: Opening the Branch
- 2. Serving the Agent Behind FastAPI
- 3. Containers and the Agent SDK Runtime
- 4. Secrets, Limits and Observability
- 5. Persistent sessions in production
- 6. Failure modes and recovery
- 7. The Final Project Brief
- 8. Final Project: The Andén Norte Assistant, End to End
Common questions
What people usually ask
No limit. It's a free guide: come in whenever you like, as often as you like.
No. Modules run from easier to harder, but you can jump to the one you need. Progress is saved per lesson.
Whatever is needed is listed under “What you need to bring”, above. If nothing is listed there, you can start from zero.
In the WhatsApp group, and every two weeks there's a live with an instructor where questions get worked through.
Start whenever you like
What students say
These reviews are from enrolled students who completed at least 50% of the course. We moderate reviews only on content grounds (spam, offensive language, personal data), never for being critical or negative.
No approved reviews yet.
Be the first to share your experience!