Comparisons / OpenAI Agents SDK
OpenAI Agents SDK vs Building from Scratch
OpenAI's Agents SDK (evolved from Swarm) provides Agent, Runner, handoffs, and guardrails. It's intentionally minimal — closer to plain Python than most frameworks. Here's how the concepts map.
| Concept | OpenAI Agents SDK | Plain Python |
|---|---|---|
| Agent | Agent(name, instructions, model, tools) | A function with a system prompt, model name, and tools dict |
| Tools | Python functions with type hints, auto-converted to schemas | A dict of callables + manually written JSON schema |
| Agent Loop | Runner.run() handles the loop internally | A while loop: call LLM, execute tool_calls, repeat |
| Handoffs | Handoff between Agent objects for multi-agent routing | Call a different agent function based on the LLM's tool choice |
| Guardrails | InputGuardrail and OutputGuardrail with tripwire pattern | Two lists of rule functions checked before and after the LLM |
| Context | Typed context object passed through the agent lifecycle | A state dict updated inside the loop |
The verdict
The Agents SDK is the thinnest framework on this list — it barely abstracts beyond what you'd write yourself. Use it when you want OpenAI's conventions and auto-schema generation. Skip it when you want full control or use non-OpenAI models.