Skip to main content

Documentation Index

Fetch the complete documentation index at: https://visionagents.ai/llms.txt

Use this file to discover all available pages before exploring further.

Reference of every event the agent emits, with fields and import paths.
For an overview of how events are dispatched and patterns for using them, see the Event System Guide.
For most app logic, prefer agent.simple_response(..., interrupt=...), agent.say(..., interrupt=...), and agent.metrics over wiring up low-level events.

Base Event Structure

All events inherit from BaseEvent:
FieldTypeDescription
typestrEvent type identifier (e.g. "agent.user_transcript")
event_idstrUnique UUID for this event instance
timestampdatetimeWhen the event was created (UTC)
session_idstr | NoneCurrent session identifier
participantParticipant | NoneParticipant the event relates to, when applicable
user_metadataAny | NoneOptional caller-supplied metadata
Plugin-emitted events extend PluginBaseEvent, which adds two fields:
FieldTypeDescription
plugin_namestr | NoneName of the plugin that emitted the event
plugin_versionstr | NoneVersion of the plugin

Agent Lifecycle Events

High-level events emitted by the agent itself as a call progresses through user and agent turns. Import: from vision_agents.core.agents.events import ...

UserTranscriptEvent

Emitted with the final user transcript that triggers an LLM turn. This is the event most apps should listen to for “what did the user say” — it fires in both classic STT and realtime modes.
from vision_agents.core.agents.events import UserTranscriptEvent

@agent.events.subscribe
async def on_user_transcript(event: UserTranscriptEvent):
    print(f"User said: {event.text}")
FieldTypeDescription
textstrFinal transcribed user text
participantParticipant | NoneWho spoke

UserTurnStartedEvent

Emitted when the user starts speaking.
FieldTypeDescription
participantParticipant | NoneWho started speaking

UserTurnEndedEvent

Emitted when the user stops speaking.
FieldTypeDescription
participantParticipant | NoneWho stopped speaking

AgentTurnStartedEvent

Emitted when the agent starts speaking (first audio chunk leaving the pipeline). Carries only the BaseEvent fields.

AgentTurnEndedEvent

Emitted when the agent stops speaking. Use interrupted to tell barge-in from natural completion.
from vision_agents.core.agents.events import AgentTurnEndedEvent

@agent.events.subscribe
async def on_agent_turn_ended(event: AgentTurnEndedEvent):
    if event.interrupted:
        print("User barged in")
FieldTypeDescription
interruptedboolTrue if the turn was cut short by a user interruption

AgentJoinedCallEvent

Emitted after the agent has joined a call.
FieldTypeDescription
callCallThe call that was joined

AgentLeftCallEvent

Emitted when the agent leaves a call.
FieldTypeDescription
callCallThe call that was left

AgentFinishEvent

Emitted when agent.finish() has completed. Carries only the BaseEvent fields.

Edge / Call Events

Events emitted by the edge transport for participant and track activity on the call. Import: from vision_agents.core.edge.events import ...

ParticipantJoinedEvent

Emitted when a participant (other than the agent) joins the call.
from vision_agents.core.edge.events import ParticipantJoinedEvent

@agent.events.subscribe
async def on_join(event: ParticipantJoinedEvent):
    print(f"{event.participant.user_id} joined")
FieldTypeDescription
participantParticipantJoined participant
callCallThe call

ParticipantLeftEvent

Emitted when a participant (other than the agent) leaves the call.
FieldTypeDescription
participantParticipantParticipant that left
callCallThe call

CallEndedEvent

Emitted when a call ends.
FieldTypeDescription
callCallThe call that ended

TrackAddedEvent

Emitted when a track is added to the call.
FieldTypeDescription
track_idstr | NoneTrack identifier
track_typeTrackType | NoneTrack type (audio/video)

TrackRemovedEvent

Emitted when a track is removed from the call.
FieldTypeDescription
track_idstr | NoneTrack identifier
track_typeTrackType | NoneTrack type (audio/video)

AudioReceivedEvent

Emitted when audio is received from a participant. High-volume — silence it with agent.events.silent(AudioReceivedEvent) if you don’t need it.
FieldTypeDescription
pcm_dataPcmData | NoneAudio data

LLM Events

Events from non-realtime LLM interactions. Import: from vision_agents.core.llm.events import ...

LLMResponseCompletedEvent

Emitted when the LLM finishes a response.
from vision_agents.core.llm.events import LLMResponseCompletedEvent

@agent.events.subscribe
async def on_response(event: LLMResponseCompletedEvent):
    print(f"Response: {event.text}")
    print(f"Model: {event.model}")
    print(f"Tokens: {event.input_tokens} in, {event.output_tokens} out")
    print(f"Latency: {event.latency_ms}ms")
FieldTypeDescription
textstrComplete response text
originalAnyRaw response from provider
item_idstr | NoneResponse item identifier
latency_msfloat | NoneTotal request-to-response time
time_to_first_token_msfloat | NoneTime to first token (streaming)
input_tokensint | NoneInput/prompt tokens consumed
output_tokensint | NoneOutput tokens generated
total_tokensint | NoneTotal tokens used
modelstr | NoneModel identifier

LLMResponseChunkEvent

Emitted for each chunk during streaming responses.
FieldTypeDescription
deltastr | NoneText delta for this chunk
content_indexint | NoneIndex of content part
item_idstr | NoneResponse item identifier
output_indexint | NoneOutput index
sequence_numberint | NoneSequence number
is_first_chunkboolWhether this is the first chunk
time_to_first_token_msfloat | NoneTime to this first chunk

LLMResponseFinalEvent

Emitted when a final LLM response is received.
FieldTypeDescription
textstrFull LLM response text
modelstr | NoneModel identifier

LLMErrorEvent

Emitted when a non-realtime LLM error occurs.
FieldTypeDescription
errorException | NoneThe exception
error_codestr | NoneError code
contextstr | NoneAdditional context
request_idstr | NoneRequest identifier
is_recoverableboolWhether the error is recoverable
error_messagestrProperty: human-readable error message

Realtime LLM Events

Events specific to realtime LLM connections (e.g. OpenAI Realtime, Gemini Live). Import: from vision_agents.core.llm.events import ...

RealtimeConnectedEvent

Emitted when a realtime connection is established.
FieldTypeDescription
session_idstr | NoneSession identifier
session_configdict[str, Any] | NoneSession configuration
capabilitieslist[str] | NoneAvailable capabilities

RealtimeDisconnectedEvent

Emitted when the realtime connection closes.
FieldTypeDescription
session_idstr | NoneSession identifier
reasonstr | NoneDisconnection reason
cleanboolWhether disconnect was clean
For conversation content in a realtime session, subscribe to UserTranscriptEvent (see Agent Lifecycle Events) — it fires for both realtime and classic STT modes.

Tool Events

Events for function calling / tool use. Import: from vision_agents.core.llm.events import ...

ToolStartEvent

Emitted when tool execution begins.
from vision_agents.core.llm.events import ToolStartEvent

@agent.events.subscribe
async def on_tool_start(event: ToolStartEvent):
    print(f"Calling {event.tool_name}")
    print(f"Args: {event.arguments}")
FieldTypeDescription
tool_namestrName of the tool being called
argumentsdict | NoneArguments passed to the tool
tool_call_idstr | NoneUnique call identifier

ToolEndEvent

Emitted when tool execution completes.
from vision_agents.core.llm.events import ToolEndEvent

@agent.events.subscribe
async def on_tool_end(event: ToolEndEvent):
    if event.success:
        print(f"{event.tool_name} returned: {event.result}")
        print(f"Took {event.execution_time_ms}ms")
    else:
        print(f"{event.tool_name} failed: {event.error}")
FieldTypeDescription
tool_namestrName of the tool
successboolWhether execution succeeded
resultAnyReturn value (if success)
errorstr | NoneError message (if failed)
tool_call_idstr | NoneUnique call identifier
execution_time_msfloat | NoneExecution duration

STT Events

Connection-state and error events from the speech-to-text plugin. Transcripts themselves surface as UserTranscriptEvent (see Agent Lifecycle Events). Import: from vision_agents.core.stt.events import ...

STTConnectedEvent

Emitted when an STT connection is established. Carries only the PluginBaseEvent fields.

STTDisconnectedEvent

Emitted when an STT connection is closed.
FieldTypeDescription
reasonstr | NoneDisconnection reason
cleanboolWhether disconnect was clean

STTErrorEvent

Emitted when STT encounters an error.
FieldTypeDescription
errorException | NoneThe exception that occurred
error_codestr | NoneError code identifier
contextstr | NoneAdditional context
error_messagestrProperty: human-readable error message

TTS Events

Events from speech synthesis. Import: from vision_agents.core.tts.events import ...

TTSSynthesisStartEvent

Emitted when TTS synthesis begins.
FieldTypeDescription
textstr | NoneText being synthesized
synthesis_idstrUnique ID for this synthesis
model_namestr | NoneTTS model name
voice_idstr | NoneVoice identifier
estimated_duration_msfloat | NoneEstimated audio duration

TTSSynthesisCompleteEvent

Emitted when TTS synthesis finishes.
from vision_agents.core.tts.events import TTSSynthesisCompleteEvent

@agent.events.subscribe
async def on_complete(event: TTSSynthesisCompleteEvent):
    print(f"Synthesis took {event.synthesis_time_ms}ms")
    print(f"Audio duration: {event.audio_duration_ms}ms")
FieldTypeDescription
synthesis_idstr | NoneUnique ID for this synthesis
textstr | NoneText that was synthesized
total_audio_bytesintTotal bytes of audio
synthesis_time_msfloatProcessing time
audio_duration_msfloat | NoneResulting audio duration
chunk_countintNumber of chunks produced
real_time_factorfloat | NoneSynthesis speed vs real-time

TTSConnectedEvent

Emitted when a TTS connection is established. Carries only the PluginBaseEvent fields.

TTSDisconnectedEvent

Emitted when a TTS connection is closed.
FieldTypeDescription
reasonstr | NoneDisconnection reason
cleanboolWhether disconnect was clean

TTSErrorEvent

Emitted when TTS encounters an error.
FieldTypeDescription
errorException | NoneThe exception
error_codestr | NoneError code
contextstr | NoneAdditional context
error_messagestrProperty: human-readable error message

Video Processor Events

Vision plugins (Roboflow, Ultralytics, Huggingface, etc.) emit subclasses of VideoProcessorDetectionEvent whenever they finish processing a frame. Import: from vision_agents.core.events import VideoProcessorDetectionEvent

VideoProcessorDetectionEvent

Base class for detection events from any video processor plugin. Plugins extend it with their own fields (detected objects, bounding boxes, raw provider output).
FieldTypeDescription
model_idstr | NoneIdentifier of the model used
inference_time_msfloat | NoneTime taken for inference
detection_countintNumber of objects detected
To subscribe, import the plugin-specific subclass (for example roboflow.DetectionCompletedEvent). See Create your own plugin for the conventions plugin events follow.
This event is used by MetricsCollector to record video processing metrics. See Telemetry for details.

ExceptionEvent

Wraps any unhandled exception raised by a subscriber. The event system catches handler failures and re-emits them as ExceptionEvent so that other handlers and the agent itself keep running. Subscribe if you want a single place to log handler errors.
FieldTypeDescription
excExceptionThe exception that was raised
handlerCallableThe handler function that failed

Subscribing to Events

All events can be subscribed to using the @agent.events.subscribe decorator:
@agent.events.subscribe
async def my_handler(event: EventType):
    # Handle event
    pass
Subscribe to multiple event types using union types:
@agent.events.subscribe
async def my_handler(event: UserTranscriptEvent | LLMResponseCompletedEvent):
    print(event)
Event handlers must be async functions. Non-async handlers raise RuntimeError at subscribe time.
See the Event System Guide for the dispatch model (fire-and-forget, fanout, error isolation) and the patterns that go with it.