跳转到内容

RealtimeSessionEventTypes

此内容尚不支持你的语言。

type RealtimeSessionEventTypes<TContext> = object;
Type Parameter Default type

TContext

unknown

agent_end: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>, output: string];

Triggered when an agent ends its work on a response.


agent_handoff: [context: RunContext<RealtimeContextData<TContext>>, fromAgent: AgentWithOrWithoutHistory<TContext>, toAgent: AgentWithOrWithoutHistory<TContext>];

Triggered when an agent hands off to another agent.


agent_start: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>, turnInput?: AgentInputItem[]];

Triggered when an agent starts its work on a response.


agent_tool_end: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>, tool: FunctionTool<RealtimeContextData<TContext>>, result: string, details: object];

Triggered when an agent ends a tool call.


agent_tool_start: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>, tool: FunctionTool<RealtimeContextData<TContext>>, details: object];

Triggered when an agent starts a tool call.


audio: [event: TransportLayerAudio];

Triggered when there is new audio data available for playing to the user.


audio_interrupted: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>];

Triggered when the agent is interrupted. Can be listened to by the user to stop audio playback or give visual indicators to the user.


audio_start: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>];

Triggered when the agent starts generating audio.


audio_stopped: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>];

Triggered when the agent stops generating audio.


error: [error: RealtimeSessionError];

Triggered when an error occurs.


guardrail_tripped: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>, error: OutputGuardrailTripwireTriggered<RealtimeGuardrailMetadata>, details: object];

Triggered when an output guardrail is tripped.


history_added: [item: RealtimeItem];

Triggered when a new item is added to the history. At this point the transcript/response might still be in progress.


history_updated: [history: RealtimeItem[]];

Triggered when the history got updated. Contains the full history of the conversation.


mcp_tool_call_completed: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>, toolCall: RealtimeMcpCallItem];

Triggered when an MCP tool call is completed.


mcp_tools_changed: [tools: RealtimeMcpToolInfo[]];

Triggered when the set of currently available MCP tools changes (e.g. after a list-tools result arrives, or when the active agent changes). Carries the list of available tools filtered by the active agent’s server_labels.


tool_approval_requested: [context: RunContext<RealtimeContextData<TContext>>, agent: AgentWithOrWithoutHistory<TContext>, approvalRequest: RealtimeToolApprovalRequest | RealtimeMcpApprovalRequest];

Triggered when a tool approval is requested.


transport_event: [event: TransportEvent];

Emits all the raw events from the transport layer.