AI / Core OpenAI Codex Application Fundamentals Interview Questions
What is the OpenAI Agents SDK and what are its four core primitives?
The OpenAI Agents SDK (launched March 2025, evolved from the experimental Swarm project) is an open-source, lightweight framework for building multi-step agentic workflows on top of the Responses API and other providers. It is available for Python (openai-agents) and TypeScript.
| Primitive | Purpose | Key behaviour |
|---|---|---|
| Agents | AI models equipped with instructions and tools | Execute tasks, call tools, produce outputs |
| Handoffs | Delegation mechanism between specialised agents | One agent passes control to another better suited for a sub-task |
| Guardrails | Input/output validation layer | Validate, filter, or block inputs/outputs before/after model calls |
| Tracing | Built-in observability for agent runs | Logs all steps, tool calls, and decisions for debugging and evals |
from agents import Agent, Runner # Define an agent coding_agent = Agent( name="CodingAgent", instructions="You are an expert Python developer. Write clean, tested code.", tools=[web_search_tool, code_interpreter_tool], model="gpt-5.5", ) # Run the agent import asyncio result = asyncio.run(Runner.run( coding_agent, "Write a Python function that parses JWT tokens and validates expiry.", )) print(result.final_output)
Provider agnostic: despite being OpenAI's SDK, it works with 100+ other LLMs via the Chat Completions API - including models from Anthropic, Mistral, and others via LiteLLM. This prevents vendor lock-in.
When to use Responses API vs Agents SDK: use the Responses API when a single model call with tools and your own application logic is sufficient. Use the Agents SDK when your application owns orchestration, tool execution, approvals, and state management across a multi-agent system.
More Related questions...