
Openai Agents Sdk
Ship multi-agent Python apps with OpenAI Agents SDK—Runner, tools, guardrails, sessions, and Azure via LiteLLM.
Overview
OpenAI Agents SDK is an agent skill most often used in Build (also Ship) that teaches Python development with the `openai-agents` package—Runner, tools, guardrails, sessions, streaming, tracing, and Azure OpenAI via Lite
Install
npx skills add https://github.com/laguagu/claude-code-nextjs-skills --skill openai-agents-sdkWhat is this skill?
- Covers `openai-agents` install, env vars, and OpenAI vs Azure OpenAI (LiteLLM) setup
- Documents `Runner.run_sync` / `Runner.run_streamed`, `@function_tool`, and `AgentOutputSchema` patterns
- Sessions with `SQLiteSession`, guardrails, multi-agent handoffs, streaming, and tracing
- Quick-reference table maps basic agent, Azure/LiteLLM, and common SDK patterns
- Triggers on `agents` imports and Runner/function-tool usage in Python codebases
- Quick-reference pattern table for basic agent, Azure/LiteLLM, and core SDK flows
Adoption & trust: 574 installs on skills.sh; 42 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are wiring Python agents with handoffs and tools but the OpenAI Agents SDK surface area (Runner, sessions, Azure) is easy to misconfigure.
Who is it for?
Solo builders adding a Python agent backend, internal copilot, or multi-agent workflow with the official OpenAI Agents SDK.
Skip if: Teams only building React chat UIs without a Python agent runtime, or projects standardized on non-OpenAI agent frameworks with no `agents` package.
When should I use this skill?
Building AI agents, multi-agent handoffs, function tools, guardrails, sessions, streaming, or tracing with `openai-agents` / `agents`—including Azure OpenAI via LiteLLM; triggers on `agents` imports, Runner, `@function_t
What do I get? / Deliverables
You get copy-ready patterns for agents, tools, sessions, and provider setup so your agent loop runs correctly on OpenAI or Azure and is easier to trace in production.
- Agent definitions with Runner sync/async invocation
- Function tools, guardrails, and optional SQLite session wiring
- Environment configuration for OpenAI or Azure via LiteLLM
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Agent runtime, tools, and orchestration are core product build work for solo builders adding copilots and automations. agent-tooling is the canonical shelf for SDK-level agent frameworks rather than generic backend CRUD.
Where it fits
Scaffold a support agent with `@function_tool` hooks into your SaaS API and Runner async loops.
Wire Azure OpenAI through LiteLLM env vars before deploying the agent service.
Enable streaming and tracing on Runner paths before a limited beta launch.
Debug handoff failures and session persistence using SDK tracing patterns.
How it compares
Framework skill for the `openai-agents` Python SDK—not a drop-in React chat component or a generic prompt-only workflow.
Common Questions / FAQ
Who is openai-agents-sdk for?
Python-focused solo and indie builders using Claude Code or similar agents to implement AI agents, tools, handoffs, and Azure-backed models with the OpenAI Agents SDK.
When should I use openai-agents-sdk?
During Build when scaffolding agent backends and agent-tooling; during Ship when tuning streaming, tracing, and LiteLLM/Azure routing; whenever code imports `agents` or uses Runner and `@function_tool`.
Is openai-agents-sdk safe to install?
Treat it as third-party procedural guidance—review the Security Audits panel on this Prism page and avoid pasting production API keys into untrusted sessions.
SKILL.md
READMESKILL.md - Openai Agents Sdk
# OpenAI Agents SDK (Python) Use this skill when developing AI agents using OpenAI Agents SDK (`openai-agents` package). ## Quick Reference ### Installation ```bash pip install openai-agents ``` ### Environment Variables ```bash # OpenAI (direct) OPENAI_API_KEY=sk-... LLM_PROVIDER=openai # Azure OpenAI (via LiteLLM) LLM_PROVIDER=azure AZURE_API_KEY=... AZURE_API_BASE=https://your-resource.openai.azure.com AZURE_API_VERSION=2024-12-01-preview ``` ### Basic Agent ```python from agents import Agent, Runner agent = Agent( name="Assistant", instructions="You are a helpful assistant.", model="gpt-5.4", # or "gpt-5.4-mini", "gpt-5.4-nano" ) # Synchronous result = Runner.run_sync(agent, "Tell me a joke") print(result.final_output) # Asynchronous result = await Runner.run(agent, "Tell me a joke") ``` ### Key Patterns | Pattern | Purpose | |---------|---------| | Basic Agent | Simple Q&A with instructions | | Azure/LiteLLM | Azure OpenAI integration | | AgentOutputSchema | Strict JSON validation with Pydantic | | Function Tools | External actions (@function_tool) | | Streaming | Real-time UI (Runner.run_streamed) | | Handoffs | Specialized agents, delegation | | Agents as Tools | Orchestration (agent.as_tool) | | LLM as Judge | Iterative improvement loop | | Guardrails | Input/output validation | | Sessions | Automatic conversation history | | Multi-Agent Pipeline | Multi-step workflows | | Sandboxing | Isolated execution environment for agents | | Subagents | Spawn specialized subordinate agents (Python + TS) | | Observability | Built-in execution graph recording | ## Preferred: Live Docs via MCP Model names and API details change frequently. When available, consult the **OpenAI Developer Docs MCP server** (`openaiDeveloperDocs`) before relying on the static references below. Setup (Codex CLI): ```bash codex mcp add openaiDeveloperDocs --url https://developers.openai.com/mcp ``` Or config (`~/.codex/config.toml`, VS Code `.vscode/mcp.json`, Cursor `~/.cursor/mcp.json`): ```toml [mcp_servers.openaiDeveloperDocs] url = "https://developers.openai.com/mcp" ``` Key tools: `mcp__openaiDeveloperDocs__search_openai_docs`, `fetch_openai_doc`, `list_api_endpoints`, `get_openapi_spec`. **Rules:** Cite fetched docs. Never speculate on field names, defaults, or current model IDs — fetch first. Keep quotes under 125 chars. Fallback when MCP is unavailable: `https://developers.openai.com/api/docs/llms.txt` (plain-text index of all API docs; each entry has a `.md` twin at `/api/docs/<slug>.md`). ## Reference Documentation Offline/quick-lookup snippets. Verify model names and API signatures against the MCP or docs when accuracy matters. - [agents.md](references/agents.md) - Agent creation, Azure/LiteLLM integration - [tools.md](references/tools.md) - Function tools, hosted tools, agents as tools - [structured-output.md](references/structured-output.md) - Pydantic output, AgentOutputSchema - [streaming.md](references/streaming.md) - Streaming patterns, SSE with FastAPI - [handoffs.md](references/handoffs.md) - Agent delegation - [guardrails.md](references/guardrails.md) - Input/output validation - [sessions.md](references/sessions.md) - Sessions, conversation history - [patterns.md](references/patterns.md) - Multi-agent workflows, LLM as judge, tracing ## Official Documentation - **Docs:** https://openai.github.io/openai-agents-python/ - **Examples:** https://github.com/openai/openai-agents-python/tree/main/exa