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
NIEVA

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.

Common questions

What people usually ask

Start whenever you like

Reviews

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!