Loading...
Loading...
OpenAI Agents SDK (Python) development. Use when building AI agents, multi-agent workflows, tool integrations, or streaming applications with the openai-agents package.
npx skill4agent add laguagu/claude-code-nextjs-skills openai-agents-sdkopenai-agentspip install openai-agents# 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-previewfrom agents import Agent, Runner
agent = Agent(
name="Assistant",
instructions="You are a helpful assistant.",
model="gpt-5.2", # or "gpt-5", "gpt-5.2-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")| 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 |