Skip to content
OpenAI Agents SDK
Search
Ctrl
K
Cancel
Python SDK
Select theme
Dark
Light
Auto
Select language
English
日本語
中文
한국어
Overview
Quickstart
Guides
Agents
Running Agents
Results
Tools
Orchestrating multiple agents
Handoffs
Context management
Sessions
Models
Guardrails
Streaming
Human-in-the-loop
Model Context Protocol (MCP)
Tracing
Configuring the SDK
Troubleshooting
Release process
Voice Agents
Overview
Quickstart
Building Voice Agents
Transport Mechanisms
Extensions
Use any model with the AI SDK
Connect Realtime Agents to Twilio
Cloudflare Workers Transport
API Reference
@openai/agents
Main API
Classes
Agent
AgentHooks
AgentsError
BatchTraceProcessor
ConsoleSpanExporter
GuardrailExecutionError
Handoff
InputGuardrailTripwireTriggered
MaxTurnsExceededError
MCPServerSSE
MCPServerStdio
MCPServerStreamableHttp
MemorySession
ModelBehaviorError
NoopSpan
NoopTrace
OpenAIChatCompletionsModel
OpenAIConversationsSession
OpenAIProvider
OpenAIResponsesModel
OpenAITracingExporter
OutputGuardrailTripwireTriggered
RequestUsage
RunAgentUpdatedStreamEvent
RunContext
RunHandoffCallItem
RunHandoffOutputItem
RunItemStreamEvent
RunMessageOutputItem
Runner
RunRawModelStreamEvent
RunReasoningItem
RunResult
RunState
RunToolApprovalItem
RunToolCallItem
RunToolCallOutputItem
Span
StreamedRunResult
SystemError
ToolCallError
Trace
TraceProvider
Usage
UserError
Interfaces
AgentConfiguration
Editor
GuardrailFunctionOutput
InputGuardrail
InputGuardrailFunctionArgs
InputGuardrailMetadata
InputGuardrailResult
MCPServer
MCPToolFilterContext
MCPToolFilterStatic
Model
ModelProvider
OutputGuardrail
OutputGuardrailDefinition
OutputGuardrailFunctionArgs
OutputGuardrailMetadata
OutputGuardrailResult
Session
Shell
TracingExporter
TracingProcessor
Type Aliases
AgentConfigWithHandoffs
AgentInputItem
AgentOptions
AgentOutputItem
AgentOutputType
ApplyPatchCallItem
ApplyPatchCallItem
ApplyPatchCallResultItem
ApplyPatchCallResultItem
ApplyPatchOperation
ApplyPatchOperation
ApplyPatchResult
ApplyPatchTool
AssistantMessageItem
AssistantMessageItem
CallModelInputFilter
CallModelInputFilterArgs
Computer
ComputerCallResultItem
ComputerCallResultItem
ComputerTool
ComputerUseCallItem
ComputerUseCallItem
FunctionCallItem
FunctionCallItem
FunctionCallResultItem
FunctionCallResultItem
FunctionTool
FunctionToolResult
GetAllMcpToolsOptions
HandoffEnabledFunction
HandoffInputData
HostedMCPTool
HostedTool
HostedToolCallItem
HostedToolCallItem
IndividualRunOptions
InputGuardrailFunction
JsonSchemaDefinition
MCPListToolsSpanData
MCPToolCacheKeyGenerator
MCPToolFilterCallable
ModelInputData
ModelRequest
ModelResponse
ModelSettings
ModelSettingsToolChoice
NonStreamRunOptions
OpenAITracingExporterOptions
OutputGuardrailFunction
ReasoningItem
ReasoningItem
ResponseStreamEvent
RunConfig
RunItem
RunStreamEvent
SerializedHandoff
SerializedOutputType
SerializedTool
SessionInputCallback
ShellAction
ShellCallItem
ShellCallItem
ShellCallResultItem
ShellCallResultItem
ShellOutputResult
ShellResult
ShellTool
StreamEvent
StreamEvent
StreamEventGenericItem
StreamEventGenericItem
StreamEventResponseCompleted
StreamEventResponseCompleted
StreamEventResponseStarted
StreamEventResponseStarted
StreamEventTextStream
StreamEventTextStream
StreamRunOptions
SystemMessageItem
TextOutput
Tool
ToolCallOutputContent
ToolCallOutputContent
ToolCallStructuredOutput
ToolCallStructuredOutput
ToolEnabledFunction
ToolExecuteArgument
ToolOptions
ToolOutputFileContent
ToolOutputFileContent
ToolOutputImage
ToolOutputImage
ToolOutputText
ToolOutputText
ToolsToFinalOutputResult
ToolToFinalOutputFunction
ToolUseBehavior
ToolUseBehaviorFlags
UnknownContext
UnknownItem
UnknownItem
UserMessageItem
UserMessageItem
Variables
OPENAI_DEFAULT_MODEL_ENV_VARIABLE_NAME
RuntimeEventEmitter
withAgentSpan
withCustomSpan
withFunctionSpan
withGenerationSpan
withGuardrailSpan
withHandoffSpan
withMCPListToolsSpan
withResponseSpan
withSpeechGroupSpan
withSpeechSpan
withTranscriptionSpan
Functions
addTraceProcessor
applyDiff
applyPatchTool
assistant
codeInterpreterTool
computerTool
createAgentSpan
createCustomSpan
createFunctionSpan
createGenerationSpan
createGuardrailSpan
createHandoffSpan
createMCPListToolsSpan
createMCPToolStaticFilter
createResponseSpan
createSpeechGroupSpan
createSpeechSpan
createTranscriptionSpan
defineOutputGuardrail
extractAllTextOutput
fileSearchTool
generateGroupId
generateSpanId
generateTraceId
getAllMcpTools
getCurrentSpan
getCurrentTrace
getDefaultModel
getDefaultModelSettings
getGlobalTraceProvider
getHandoff
getLogger
getOrCreateTrace
getTransferMessage
gpt5ReasoningSettingsRequired
handoff
hostedMcpTool
imageGenerationTool
invalidateServerToolsCache
isGpt5Default
mcpToFunctionTool
resetCurrentSpan
run
setCurrentSpan
setDefaultModelProvider
setDefaultOpenAIClient
setDefaultOpenAIKey
setDefaultOpenAITracingExporter
setOpenAIAPI
setTraceProcessors
setTracingDisabled
setTracingExportApiKey
shellTool
startOpenAIConversationsSession
startTraceExportLoop
system
tool
user
webSearchTool
withTrace
@openai/agents/realtime
Classes
ModelBehaviorError
OpenAIRealtimeBase
OpenAIRealtimeSIP
OpenAIRealtimeWebRTC
OpenAIRealtimeWebSocket
OutputGuardrailTripwireTriggered
RealtimeAgent
RealtimeSession
UserError
Interfaces
RealtimeOutputGuardrail
RealtimeTransportLayer
Type Aliases
ApiKey
FunctionTool
OpenAIRealtimeBaseOptions
OpenAIRealtimeEventTypes
OpenAIRealtimeModels
OpenAIRealtimeWebRTCOptions
OpenAIRealtimeWebSocketOptions
RealtimeAgentConfiguration
RealtimeAudioFormat
RealtimeBaseItem
RealtimeClientMessage
RealtimeContextData
RealtimeItem
RealtimeMcpCallItem
RealtimeMessageItem
RealtimeSessionConfig
RealtimeSessionConnectOptions
RealtimeSessionEventTypes
RealtimeSessionOptions
RealtimeSessionPayload
RealtimeToolCallItem
RealtimeTransportEventTypes
RealtimeTransportLayerConnectOptions
TransportError
TransportEvent
TransportLayerAudio
TransportLayerResponseCompleted
TransportLayerResponseStarted
TransportLayerTranscriptDelta
TransportToolCallEvent
WebRTCState
WebSocketState
Variables
DEFAULT_OPENAI_REALTIME_MODEL
DEFAULT_OPENAI_REALTIME_SESSION_CONFIG
utils
Functions
backgroundResult
isBackgroundResult
tool
@openai/agents-core
API
Classes
Agent
AgentHooks
AgentsError
BatchTraceProcessor
ConsoleSpanExporter
GuardrailExecutionError
Handoff
InputGuardrailTripwireTriggered
MaxTurnsExceededError
MCPServerSSE
MCPServerStdio
MCPServerStreamableHttp
MemorySession
ModelBehaviorError
NoopSpan
NoopTrace
OutputGuardrailTripwireTriggered
RequestUsage
RunAgentUpdatedStreamEvent
RunContext
RunHandoffCallItem
RunHandoffOutputItem
RunItemStreamEvent
RunMessageOutputItem
Runner
RunRawModelStreamEvent
RunReasoningItem
RunResult
RunState
RuntimeEventEmitter
RunToolApprovalItem
RunToolCallItem
RunToolCallOutputItem
Span
StreamedRunResult
SystemError
ToolCallError
Trace
TraceProvider
Usage
UserError
Interfaces
AgentConfiguration
Editor
GuardrailFunctionOutput
InputGuardrail
InputGuardrailFunctionArgs
InputGuardrailMetadata
InputGuardrailResult
MCPServer
MCPToolFilterContext
MCPToolFilterStatic
Model
ModelProvider
OutputGuardrail
OutputGuardrailDefinition
OutputGuardrailFunctionArgs
OutputGuardrailMetadata
OutputGuardrailResult
Session
Shell
TracingExporter
TracingProcessor
Type Aliases
AgentConfigWithHandoffs
AgentInputItem
AgentOptions
AgentOutputItem
AgentOutputType
ApplyPatchCallItem
ApplyPatchCallItem
ApplyPatchCallResultItem
ApplyPatchCallResultItem
ApplyPatchOperation
ApplyPatchResult
ApplyPatchTool
AssistantMessageItem
AssistantMessageItem
CallModelInputFilter
CallModelInputFilterArgs
Computer
ComputerCallResultItem
ComputerCallResultItem
ComputerTool
ComputerUseCallItem
ComputerUseCallItem
FunctionCallItem
FunctionCallItem
FunctionCallResultItem
FunctionCallResultItem
FunctionTool
FunctionToolResult
GetAllMcpToolsOptions
HandoffEnabledFunction
HandoffInputData
HostedMCPTool
HostedTool
HostedToolCallItem
HostedToolCallItem
IndividualRunOptions
InputGuardrailFunction
JsonSchemaDefinition
MCPListToolsSpanData
MCPToolCacheKeyGenerator
MCPToolFilterCallable
ModelInputData
ModelRequest
ModelResponse
ModelSettings
ModelSettingsToolChoice
NonStreamRunOptions
OutputGuardrailFunction
ReasoningItem
ReasoningItem
ResponseStreamEvent
RunConfig
RunItem
RunStreamEvent
SerializedHandoff
SerializedOutputType
SerializedTool
SessionInputCallback
ShellAction
ShellCallItem
ShellCallItem
ShellCallResultItem
ShellCallResultItem
ShellOutputResult
ShellResult
ShellTool
StreamEvent
StreamEvent
StreamEventGenericItem
StreamEventGenericItem
StreamEventResponseCompleted
StreamEventResponseCompleted
StreamEventResponseStarted
StreamEventResponseStarted
StreamEventTextStream
StreamEventTextStream
StreamRunOptions
SystemMessageItem
TextOutput
Tool
ToolCallOutputContent
ToolCallOutputContent
ToolCallStructuredOutput
ToolCallStructuredOutput
ToolEnabledFunction
ToolExecuteArgument
ToolOptions
ToolOutputFileContent
ToolOutputFileContent
ToolOutputImage
ToolOutputImage
ToolOutputText
ToolOutputText
ToolsToFinalOutputResult
ToolToFinalOutputFunction
ToolUseBehavior
ToolUseBehaviorFlags
UnknownContext
UnknownItem
UnknownItem
UserMessageItem
UserMessageItem
Variables
ApplyPatchOperation
OPENAI_DEFAULT_MODEL_ENV_VARIABLE_NAME
withAgentSpan
withCustomSpan
withFunctionSpan
withGenerationSpan
withGuardrailSpan
withHandoffSpan
withMCPListToolsSpan
withResponseSpan
withSpeechGroupSpan
withSpeechSpan
withTranscriptionSpan
Functions
addTraceProcessor
applyDiff
applyPatchTool
assistant
computerTool
createAgentSpan
createCustomSpan
createFunctionSpan
createGenerationSpan
createGuardrailSpan
createHandoffSpan
createMCPListToolsSpan
createMCPToolStaticFilter
createResponseSpan
createSpeechGroupSpan
createSpeechSpan
createTranscriptionSpan
defineOutputGuardrail
extractAllTextOutput
generateGroupId
generateSpanId
generateTraceId
getAllMcpTools
getCurrentSpan
getCurrentTrace
getDefaultModel
getDefaultModelSettings
getGlobalTraceProvider
getHandoff
getLogger
getOrCreateTrace
getTransferMessage
gpt5ReasoningSettingsRequired
handoff
hostedMcpTool
invalidateServerToolsCache
isGpt5Default
mcpToFunctionTool
resetCurrentSpan
run
setCurrentSpan
setDefaultModelProvider
setTraceProcessors
setTracingDisabled
shellTool
startTraceExportLoop
system
tool
user
withTrace
@openai/agents-openai
API
Classes
OpenAIChatCompletionsModel
OpenAIConversationsSession
OpenAIProvider
OpenAIResponsesModel
OpenAITracingExporter
Type Aliases
OpenAITracingExporterOptions
Functions
codeInterpreterTool
fileSearchTool
imageGenerationTool
setDefaultOpenAIClient
setDefaultOpenAIKey
setDefaultOpenAITracingExporter
setOpenAIAPI
setTracingExportApiKey
startOpenAIConversationsSession
webSearchTool
@openai/agents-realtime
API
Classes
ModelBehaviorError
OpenAIRealtimeBase
OpenAIRealtimeSIP
OpenAIRealtimeWebRTC
OpenAIRealtimeWebSocket
OutputGuardrailTripwireTriggered
RealtimeAgent
RealtimeSession
UserError
Interfaces
RealtimeOutputGuardrail
RealtimeTransportLayer
Type Aliases
ApiKey
FunctionTool
OpenAIRealtimeBaseOptions
OpenAIRealtimeEventTypes
OpenAIRealtimeModels
OpenAIRealtimeWebRTCOptions
OpenAIRealtimeWebSocketOptions
RealtimeAgentConfiguration
RealtimeAudioFormat
RealtimeBaseItem
RealtimeClientMessage
RealtimeContextData
RealtimeItem
RealtimeMcpCallItem
RealtimeMessageItem
RealtimeSessionConfig
RealtimeSessionConnectOptions
RealtimeSessionEventTypes
RealtimeSessionOptions
RealtimeSessionPayload
RealtimeToolCallItem
RealtimeTransportEventTypes
RealtimeTransportLayerConnectOptions
TransportError
TransportEvent
TransportLayerAudio
TransportLayerResponseCompleted
TransportLayerResponseStarted
TransportLayerTranscriptDelta
TransportToolCallEvent
WebRTCState
WebSocketState
Variables
DEFAULT_OPENAI_REALTIME_MODEL
DEFAULT_OPENAI_REALTIME_SESSION_CONFIG
utils
Functions
backgroundResult
isBackgroundResult
tool
@openai/agents-extensions
API
Classes
AiSdkModel
CloudflareRealtimeTransportLayer
TwilioRealtimeTransportLayer
Type Aliases
TwilioRealtimeTransportLayerOptions
Functions
aisdk
parseArguments
toolChoiceToLanguageV2Format
Python SDK
View on GitHub
View on npm
Select theme
Dark
Light
Auto
Select language
English
日本語
中文
한국어
View on GitHub
View on npm
RuntimeEventEmitter
RuntimeEventEmitter:
any
;