openai-agents-sdk

OpenAI Agents SDK (Python) development. Use when building AI agents, multi-agent handoffs, function tools, guardrails, sessions, streaming, or tracing with the `openai-agents` / `agents` Python package — including Azure OpenAI via LiteLLM. Triggers on imports from `agents`, uses of `Runner.run_sync`/`Runner.run_streamed`, `@function_tool`, `AgentOutputSchema`, `SQLiteSession`, or questions about the openai-agents-python SDK.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "openai-agents-sdk" with this command: npx skills add laguagu/claude-code-nextjs-skills/laguagu-claude-code-nextjs-skills-openai-agents-sdk

OpenAI Agents SDK (Python)

Use this skill when developing AI agents using OpenAI Agents SDK (openai-agents package).

Quick Reference

Installation

pip install openai-agents

Environment Variables

# 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

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

PatternPurpose
Basic AgentSimple Q&A with instructions
Azure/LiteLLMAzure OpenAI integration
AgentOutputSchemaStrict JSON validation with Pydantic
Function ToolsExternal actions (@function_tool)
StreamingReal-time UI (Runner.run_streamed)
HandoffsSpecialized agents, delegation
Agents as ToolsOrchestration (agent.as_tool)
LLM as JudgeIterative improvement loop
GuardrailsInput/output validation
SessionsAutomatic conversation history
Multi-Agent PipelineMulti-step workflows
SandboxingIsolated execution environment for agents
SubagentsSpawn specialized subordinate agents (Python + TS)
ObservabilityBuilt-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):

codex mcp add openaiDeveloperDocs --url https://developers.openai.com/mcp

Or config (~/.codex/config.toml, VS Code .vscode/mcp.json, Cursor ~/.cursor/mcp.json):

[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.

Official Documentation

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

nextjs-seo

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

nextjs-shadcn

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

本地图片语义搜索

本地图片语义搜索工具,基于 CLIP 模型实现中英文图片内容的语义理解检索,类似小米相册 AI 搜索功能。使用场景:(1) 用户想用自然语言搜索本地图片 (2) 用户需要搜索中文关键词相关的图片 (3) 用户提到"搜图片"、"找图片"、"图片搜索"、"AI相册"等关键词

Registry SourceRecently Updated
Coding

Mini Coder Max

Autonomous coding agent that systematically plans, implements, reviews, and delivers high-quality code. Handles tasks of any complexity by following a struct...

Registry SourceRecently Updated