Lesson 09.03 · Phase 09 · Frameworks & SDKs
OpenAI Agents SDK
The Agents SDK is a declarative agent plus a Runner that owns the loop. Its four ideas are function tools from type hints, handoffs that are really tools which switch the active agent, guardrails that can stop a run early, and typed final output. Rebuild them in 250 lines and the SDK reads like a config file.
Learning objectives
- Implement functiontool, Agent, Runner.run, handoffs, input guardrails and outputtype with the standard library.
- Explain why a handoff is a tool call whose result is a change of agent.
- Run the same app on the real SDK, offline, with its ScriptedModel.
- Know two defaults that surprise people: the 10-turn budget and guardrails running in parallel with the model.
A support bot starts as one agent with ten tools and a 2,000-word system prompt covering billing, shipping, returns and "please don't do homework". It gets worse at everything as the prompt grows. You split it into a triage agent and specialists, and now you need a way to pass the conversation between them, a way to reject off-topic requests cheaply, and a final answer your backend can parse instead of free text.
Loading the full lesson…