pip install openai-agents
from agents import Agent, Runner
agent = Agent(name="Assistant", instructions="You are a helpful assistant")
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")
print(result.final_output)
# Code within the code,
# Functions calling themselves,
# Infinite loop's dance.
Overview
OpenAI Agent SDK is a lightweight yet powerful framework designed for building multi-agent workflows. The framework enables developers to create, coordinate, and monitor AI agents with a focus on simplicity and control. Itβs compatible with any model providers that support the OpenAI Chat Completions API format.
Features
-
Core Agent Components
- Agent Configuration with Instructions
- Tool Integration Support
- Configurable Guardrails
- Agent-to-Agent Handoffs
-
Tracing & Monitoring
- Built-in Run Tracking
- Debugging Capabilities
- Workflow Optimization Tools
- Support for External Destinations
- Logfire Integration
- AgentOps Integration
- Braintrust Integration
-
Safety & Control
- Input Validation
- Output Validation
- Configurable Safety Checks
- Handoff Control Mechanisms
Design Principles
-
Lightweight Architecture
- Minimal dependencies
- Simple API design
- Focus on essential functionality
-
Extensibility
- Custom span support
- Pluggable tracing system
- Flexible tool integration
-
Developer Experience
- Easy setup process
- Clear documentation
- Comprehensive examples
- Built-in debugging tools
-
Interoperability
- Compatible with OpenAI Chat Completions API
- Support for multiple model providers
- Integration with existing tools and frameworks
Built with OpenAI Agent SDK
Examples of applications and systems built using the framework:
-
Multi-Agent Systems
- Coordinated agent workflows
- Complex task delegation
- Agent communication networks
-
Monitored Applications
- Traced agent interactions
- Debuggable workflows
- Performance optimization systems
-
Safety-First Applications
- Input/output validated systems
- Controlled agent handoffs
- Guardrail-protected workflows
Authors
Core Contributors:
- @rm-openai
- @dmitry-openai
- @jhills20
- @stevenheidel
- @pierDipi
- @chuang-openai
Note: The OpenAI Agent SDK is actively maintained and developed as an open-source framework, encouraging community contributions while maintaining high standards for code quality and security.