The Agent class is the central orchestrator that brings together all other components in the Vision Agents framework. It manages the conversation flow, handles real-time audio/video processing, coordinates responses, and integrates with external tools via MCP (Model Context Protocol) servers. It is the main interface for building AI-powered video and voice applications. It supports both traditional STT/TTS workflows and modern realtime speech-to-speech models, making it flexible for various use cases.
Do not reuse an Agent instance. Create a new agent for each call. Calling
join() twice on the same agent raises RuntimeError.
from vision_agents.core import Agent, Userfrom vision_agents.plugins import openai, deepgram, elevenlabs, getstream# Traditional STT/TTS modeagent = Agent( edge=getstream.Edge(), agent_user=User(name="AI Assistant", id="agent"), instructions="You're a helpful AI assistant", llm=openai.LLM(model="gpt-5.4"), stt=deepgram.STT(), tts=elevenlabs.TTS(),)# Realtime modeagent = Agent( edge=getstream.Edge(), agent_user=User(name="AI Assistant", id="agent"), instructions="You're a helpful AI assistant", llm=openai.Realtime(model="gpt-realtime", voice="marin"),)
Constructor Parameters
edge (EdgeTransport): The edge network provider for video & audio transport (you can choose any provider here)
llm (LLM | AudioLLM | VideoLLM): The language model — can be a text LLM, audio-capable (AudioLLM), video-capable (VideoLLM), or a combined Realtime model
agent_user (User): The agent’s user information (name, id, etc.)
Optional Parameters
instructions (str): System instructions for the agent. Supports @file.md references to load instructions from markdown files (default: “Keep your replies short and dont use special characters.”)
stt (Optional[STT]): Speech-to-text service (automatically disabled in realtime mode)
tts (Optional[TTS]): Text-to-speech service (automatically disabled in realtime mode)
turn_detection (Optional[TurnDetector]): Turn detection service for managing conversation turns. Automatically disabled in realtime mode. Ignored automatically if the configured STT plugin already provides built-in turn detection (when stt.turn_detection is True, e.g. elevenlabs.STT, deepgram.STT)
processors (Optional[List[Processor]]): List of processors for video/audio processing
avatar (Optional[Avatar]): Avatar provider for lip-synced video output (for example anam.Avatar(...))
mcp_servers (Optional[List[MCPBaseServer]]): MCP servers for external tool access
options (Optional[AgentOptions]): Configuration options — see AgentOptions below
broadcast_metrics (bool): Broadcast agent metrics to call participants via custom events (default: False)
broadcast_metrics_interval (float): Interval in seconds between metrics broadcasts (default: 5.0)
multi_speaker_filter (Optional[AudioFilter]): Filter for multi-speaker audio routing. Defaults to FirstSpeakerWinsFilter, which locks onto the first active speaker and drops other participants’ audio until silence timeout or disconnect. Only activates when two or more participants have active audio tracks — see Multiple Speakers
tracer (Tracer): OpenTelemetry tracer for distributed tracing (default: trace.get_tracer("agents"))
profiler (Optional[Profiler]): Performance profiler for the agent and its plugins
AgentOptions
Field
Type
Default
Description
model_dir
str
System temp directory
Directory for downloaded model files (VAD, turn detection, etc.)
Mode Validation
When an AudioLLM is configured (currently Realtime models), STT, TTS, and turn detection are automatically disabled with a warning log. In non-realtime mode, the agent requires at least an audio processing path (STT, TTS, or turn detection) or video processors. Video-only agents without an LLM are allowed when video processors are configured.
Core Lifecycle Methods
async create_call(call_type: str, call_id: str) -> CallCreates a call on the edge provider. Calls authenticate() automatically.async join(call: Call, participant_wait_timeout: Optional[float] = 10.0) -> AsyncIterator[None]Joins a video call. Must be called as an async context manager.The agent can join the call only once. Once the call ends, the agent closes itself. join() always calls close() in its finally block.Parameters
call (Call): the call to join.
participant_wait_timeout (Optional[float]): timeout in seconds to wait for other participants to join before proceeding.
If 0, do not wait at all. If None, wait forever.
Default - 10.0. Delegates to wait_for_participant().
call = await agent.create_call(call_type="default", call_id="my-call")async with agent.join(call): await agent.simple_response("Say hi.") await agent.finish() # Wait for call to end
async wait_for_participant(timeout: Optional[float] = None) -> NoneWaits for at least one participant to join. Default None waits forever.async finish()Waits for the call to end gracefully. Subscribes to the call ended event. Returns immediately if not joined or already closed.async close()Cleans up all connections and resources. Safe to call multiple times. Called automatically when join() context exits.async authenticate()Authenticates the agent user with the edge provider. Idempotent — safe to call multiple times. Called automatically from join() and create_call(), so you usually don’t need to call it directly.
Response Methods
async simple_response(text: str, participant: Optional[Participant] = None, interrupt: bool = True)Sends a text prompt to the active inference flow. The LLM generates a response which is then spoken through TTS (or realtime audio output). Use interrupt=True when you want this request to preempt an in-flight response.
await agent.simple_response("Hello, how can I help you?", interrupt=True)
async say(text: str, interrupt: bool = False)Makes the agent speak text directly, bypassing the LLM. Works in transcribing (STT + LLM + TTS) mode only — the text is synthesized via TTS. In Realtime mode, say() logs a warning and does not produce audio (conversation history may still be updated). Use interrupt=True to stop current output before speaking.
await agent.say("Welcome to the call!", interrupt=False)
Monitoring Methods
idle_for() -> floatReturns the number of seconds the agent has been alone on the call (all human participants have left). Returns 0.0 while other participants are present or before join.on_call_for() -> floatReturns the number of seconds since the agent joined the call.
Observability
metrics — AgentMetrics property for performance data. See Telemetry.async send_metrics_event(event_type="agent_metrics", fields=None) — Broadcast metrics to call participants.async send_custom_event(data: dict) — Push custom data to call participants via the edge provider.
MCP Integration
The Agent supports Model Context Protocol (MCP) for external tool integration. MCP servers connect when the agent joins a call:
MCP tools are automatically registered with the LLM’s function registry and can be called during conversations. See the MCP guide for more.
Event System
The Agent makes it easy for developers to quickly subscribe and listen to events happening across all components. The event system merges all events across the plugin and core allowing you to listen to events in a single place using their respective type.
Core Events
Agent Lifecycle Events: UserTurnStartedEvent, UserTurnEndedEvent, UserTranscriptEvent, AgentTurnStartedEvent, AgentTurnEndedEvent, AgentJoinedCallEvent, AgentLeftCallEvent, AgentFinishEvent (emitted only when finish() is cancelled, not on normal call end)
from vision_agents.core.edge.events import AudioReceivedEvent@agent.events.subscribeasync def on_audio_received(event: AudioReceivedEvent): # Handle audio data pass
You can also use agent.subscribe(function) as an alternative to the decorator.
Debugging with local video files
For testing and debugging video processing without a live camera, you can use a local video file as the video source. This is useful for reproducible testing and development.
Video override only works when publish_video is True (requires an avatar or
a video publisher processor). Set the path before calling join().
Using the CLI
Pass the --video-track-override option when running your agent:
uv run agent.py run --video-track-override=/path/to/video.mp4
Using the API
from vision_agents.core import Agent, Useragent = Agent(...)agent.set_video_track_override_path("/path/to/video.mp4")
When a video override is set, the local video file plays in a loop at 30 FPS instead of any incoming video tracks from call participants. The track lifecycle remains intact (starts when a user joins, stops when they leave).
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Vision Agents","colors":{"primary":"#005FFF","light":"#005FFF","dark":"#005FFF"},"logo":{"light":"https://mintcdn.com/stream-52f5fdce/Nind0EHQ2u8VMFBc/logo/vision-agents.svg?fit=max\u0026auto=format\u0026n=Nind0EHQ2u8VMFBc\u0026q=85\u0026s=82b7b4cf9c716a47656a761f92951360","dark":"https://mintcdn.com/stream-52f5fdce/Nind0EHQ2u8VMFBc/logo/vision-agents-dark.svg?fit=max\u0026auto=format\u0026n=Nind0EHQ2u8VMFBc\u0026q=85\u0026s=8cbbd74ee4b664322324039d1c5fbba6"},"favicon":"https://mintcdn.com/stream-52f5fdce/Nind0EHQ2u8VMFBc/logo/vision-agents.svg?fit=max\u0026auto=format\u0026n=Nind0EHQ2u8VMFBc\u0026q=85\u0026s=82b7b4cf9c716a47656a761f92951360","navbar":{"links":[{"href":"mailto:nash@getstream.io","label":"Contact Us"},{"href":"https://getstream.io/try-for-free","label":"Try for Free"}],"primary":{"type":"button","label":"⭐ our project","href":"https://github.com/GetStream/vision-agents"}},"footer":{"socials":{"x":"https://x.com/visionagents_ai","github":"https://github.com/GetStream","linkedin":"https://linkedin.com/company/getstream-io"}},"integrations":{"gtm":{"tagId":"GTM-TZ27JWH3"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/GetStream/vision-agents"},{"anchor":"X Account","icon":"x-twitter","href":"https://x.com/visionagents_ai"},{"anchor":"Discord","icon":"discord","href":"https://discord.gg/RkhX9PxMS6"},{"anchor":"Contact Us","icon":"envelope","href":"mailto:nash@getstream.io"},{"anchor":"Crashout Buddy","icon":"robot","href":"https://emotional-support.visionagents.ai/"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"stream-52f5fdce","hasAudioNarration":false,"actualSubdomain":"stream-52f5fdce","customDomains":["visionagents.ai"],"gitSource":{"type":"github","owner":"getstream","repo":"agents-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6adac75a61549481e139fc3c","clientVersion":"0.0.4177","searchFilterCounts":[{"language":"default","tag":"Integrations","count":62},{"language":"default","tag":"Examples","count":20},{"language":"default","tag":"Fundamentals","count":17},{"language":"default","tag":"How-to Guides","count":15},{"language":"default","tag":"Text-to-Speech","count":13},{"language":"default","tag":"Language Models","count":11},{"language":"default","tag":"Speech-to-Text","count":11},{"language":"default","tag":"Core Reference","count":7},{"language":"default","tag":"Deploying Agents","count":6},{"language":"default","tag":"Realtime","count":6}]},"assistantConfig":{"deflection":{"enabled":true,"email":"visionagents@getstream.io","showHelpButton":true}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"snippets/showcase-page/showcase.css","content":".showcase-page{--text-primary: #1a1b25;--text-secondary: #5b6472;--text-emphasized: #5f6878;--background-primary: white;--border-default: #c0c8d2;--border-subtle: #ebeef1;--accent: #005fff;--accent-wash: #005fff10;--focus-ring: #005fff;--border-radius: 16px;--ease-out: cubic-bezier(0.23, 1, 0.32, 1);--dur-press: 160ms;@media (prefers-color-scheme: dark){--text-primary: #f6f8fa;--text-secondary: #9aa3b2;--text-emphasized: #aab2c0;--background-primary: #0e0e14;--border-default: #c0c8d270;--border-subtle: #d5dbe11a;--accent: #4d94ff;--accent-wash: #4d94ff1f;--focus-ring: #6aa8ff}display:grid;grid-template-columns:1fr min(42rem, 100%) 1fr;\u0026>*{grid-column:2}h1 {\n font-weight: 700;\n letter-spacing: -0.02em;\n text-wrap: balance;\n color: var(--text-primary);\n margin: 0;\n }\n\n h2 {\n font-weight: 700;\n font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem);\n letter-spacing: -0.02em;\n text-wrap: balance;\n color: var(--text-primary);\n margin: 0;\n }\n\n h3 {\n font-size: 16px;\n color: var(--text-primary);\n margin: 1rem 0 0.5rem 0;\n }\n\n p {\n font: 400 16px var(--font-sans, ui-sans-serif, system-ui, sans-serif);\n color: var(--text-primary);\n max-width: 45ch;\n }\n\n section {\n padding: 6rem 2rem;\n border-bottom: 1px solid var(--border-subtle);\n }\n\n /* Shared keyboard focus indicator for all interactive elements */\n .stack-item:focus-visible,\n .cta-primary:focus-visible,\n .cta-github:focus-visible,\n .cta-blog:focus-visible,\n .showcase-video iframe:focus-visible {\n outline: 2px solid var(--focus-ring);\n outline-offset: 3px;\n }\n\n .pill {\n font-size: 12px;\n color: var(--text-primary);\n border: 1px solid var(--border-default);\n border-radius: 22px;\n padding: 0.25rem 0.5rem;\n }\n\n /* Hero section styles */\n .hero {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 4rem;\n align-items: center;\n justify-items: center;\n text-align: center;\n }\n\n .hero h1 {\n font-size: clamp(2.5rem, 1.4rem + 4.8vw, 4rem);\n line-height: 1.02;\n max-width: 10ch;\n }\n\n .hero span {\n max-width: 45ch;\n }\n\n .emphasized {\n font-weight: 600;\n font-style: italic;\n color: var(--accent);\n }\n\n @media screen and (width \u003c=70rem) {\n .hero {\n grid-template-columns: 1fr;\n gap: 2rem;\n }\n }\n\n /* Showcase section styles */\n .showcase {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 2rem;\n }\n\n .showcase-reversed {\n flex-direction: row-reverse;\n }\n\n /* One-time entrance reveal (toggled by IntersectionObserver, never reverses on scroll-up) */\n @media (prefers-reduced-motion: no-preference) {\n .showcase[data-reveal] {\n transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);\n }\n\n .showcase[data-reveal='out'] {\n opacity: 0;\n transform: translateY(24px);\n }\n }\n\n @media screen and (width \u003c=70rem) {\n .showcase {\n flex-direction: column;\n gap: 2rem;\n }\n\n .showcase-content {\n width: 100%;\n }\n\n .showcase-reversed {\n flex-direction: column;\n }\n }\n\n @media screen and (width >70rem) {\n .showcase {\n grid-column: 1 / -1;\n width: min(64rem, 100%);\n margin-inline: auto;\n }\n\n .showcase-video,\n .showcase-content {\n flex: 1 1 0;\n min-width: 0;\n }\n }\n\n .showcase-content-prefix {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n justify-content: space-between;\n }\n\n .showcase-content-prefix-index {\n font-style: italic;\n font-size: small;\n }\n\n .showcase-content-prefix p {\n display: flex;\n align-items: center;\n font-size: 14px;\n font-weight: 400;\n color: var(--text-secondary);\n flex: 1;\n max-width: 100%;\n }\n\n .showcase-content-prefix div {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n justify-content: start;\n }\n\n .showcase-content-prefix p::after {\n content: \"\";\n display: block;\n width: 100%;\n height: 1px;\n margin-left: 0.5rem;\n background-color: var(--border-subtle);\n }\n\n .showcase-video {\n width: 100%;\n aspect-ratio: 16 / 9;\n }\n\n .showcase-video iframe {\n width: 100%;\n height: 100%;\n border-radius: var(--border-radius);\n }\n\n .showcase-content-stack {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n align-items: center;\n justify-content: start;\n margin: 1rem 0;\n padding-bottom: 1rem;\n border-bottom: 1px solid var(--border-subtle);\n }\n\n /* Tech stack logo chips */\n .stack-item {\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n gap: 0.6rem;\n font-size: 13px;\n line-height: 1;\n color: var(--text-primary);\n text-decoration: none;\n border: 1px solid var(--border-default);\n border-radius: 14px;\n padding: 1rem 1.25rem;\n min-width: 5.5rem;\n transition: transform 0.15s var(--ease-out), border-color 0.15s var(--ease-out),\n color 0.15s var(--ease-out), background-color 0.15s var(--ease-out);\n }\n\n @media (hover: hover) and (pointer: fine) {\n .stack-item:hover {\n transform: translateY(-3px);\n border-color: var(--accent);\n color: var(--accent);\n background-color: var(--accent-wash);\n }\n\n .stack-item:hover .stack-logo {\n background-color: var(--accent);\n }\n\n .stack-item:hover .stack-logo--mono {\n color: var(--accent);\n background-color: transparent;\n }\n }\n\n .stack-item:active {\n transform: translateY(-1px) scale(0.98);\n }\n\n .stack-logo {\n display: inline-block;\n width: 2.25rem;\n height: 2.25rem;\n flex-shrink: 0;\n background-color: currentColor;\n -webkit-mask: center / contain no-repeat;\n mask: center / contain no-repeat;\n }\n\n .stack-label {\n white-space: nowrap;\n font-size: 13px;\n font-weight: 500;\n }\n\n /* Per-provider mask icons (local, based on Simple Icons) */\n .stack-logo--googlegemini {\n -webkit-mask-image: url('../../logo/googlegemini.svg');\n mask-image: url('../../logo/googlegemini.svg');\n }\n\n .stack-logo--openai {\n -webkit-mask-image: url('../../logo/openai.svg');\n mask-image: url('../../logo/openai.svg');\n }\n\n .stack-logo--anthropic {\n -webkit-mask-image: url('../../logo/anthropic.svg');\n mask-image: url('../../logo/anthropic.svg');\n }\n\n .stack-logo--elevenlabs {\n -webkit-mask-image: url('../../logo/elevenlabs.svg');\n mask-image: url('../../logo/elevenlabs.svg');\n }\n\n .stack-logo--anam {\n -webkit-mask-image: url('../../logo/anam.svg');\n mask-image: url('../../logo/anam.svg');\n }\n\n .stack-logo--assemblyai {\n -webkit-mask-image: url('../../logo/assemblyai.svg');\n mask-image: url('../../logo/assemblyai.svg');\n }\n\n .stack-logo--inworld {\n -webkit-mask-image: url('../../logo/inworld.svg');\n mask-image: url('../../logo/inworld.svg');\n }\n\n /* Monogram fallback for providers without a Simple Icons logo */\n .stack-logo--mono {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2.25rem;\n height: 2.25rem;\n font-size: 16px;\n font-weight: 700;\n text-transform: uppercase;\n color: currentColor;\n background-color: transparent;\n border: 1.5px solid currentColor;\n border-radius: 50%;\n -webkit-mask: none;\n mask: none;\n }\n\n .showcase-content-description {\n border-bottom: 1px solid var(--border-subtle);\n margin-bottom: 2rem;\n color: var(--text-secondary);\n line-height: 1.5;\n max-width: 45ch;\n }\n\n .showcase-content-cta {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n justify-content: start;\n }\n\n /* Shared CTA base: one type scale + consistent hit target for all three */\n .cta-primary,\n .cta-github,\n .cta-blog {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 44px;\n padding: 0.5rem 1rem;\n font: 500 14px var(--font-sans, ui-sans-serif, system-ui, sans-serif);\n text-decoration: none;\n border: 0;\n border-radius: 0.5rem;\n touch-action: manipulation;\n transition: transform var(--dur-press) var(--ease-out),\n background-color var(--dur-press) var(--ease-out),\n box-shadow var(--dur-press) var(--ease-out);\n }\n\n /* Outline is drawn with an inset box-shadow, not a border, because Mintlify\n recolors link bottom-borders with its primary color. */\n .cta-primary,\n .cta-primary:hover,\n .cta-github,\n .cta-github:hover,\n .cta-blog,\n .cta-blog:hover {\n text-decoration: none;\n }\n\n .cta-primary {\n font-weight: 600;\n color: var(--background-primary);\n background-color: var(--text-primary);\n }\n\n .cta-github {\n color: var(--text-primary);\n box-shadow: inset 0 0 0 1px var(--border-default);\n }\n\n .github::before {\n content: '';\n display: inline-block;\n vertical-align: middle;\n margin-right: 0.5em;\n width: 1em;\n height: 1em;\n background: url('../../logo/github-icon-black.svg') no-repeat center center;\n background-size: 1em 1em;\n\n @media (prefers-color-scheme: dark) {\n background: url('../../logo/github-icon-white.svg') no-repeat center center;\n background-size: 1em 1em;\n }\n }\n\n .cta-blog {\n color: var(--text-secondary);\n }\n\n .cta-blog::after {\n content: '';\n display: inline-block;\n vertical-align: middle;\n margin-left: 0.25em;\n width: 1em;\n height: 1em;\n background: url('data:image/svg+xml;utf8,\u003csvg fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" viewBox=\"0 0 20 16\" xmlns=\"http://www.w3.org/2000/svg\">\u003cpath d=\"M2 8h12M10 4l4 4-4 4\"/>\u003c/svg>') no-repeat center center;\n background-size: 1em 1em;\n transition: transform var(--dur-press) var(--ease-out);\n }\n\n /* CTA feedback: hover lift (pointer devices only), press confirmation everywhere */\n @media (hover: hover) and (pointer: fine) {\n .cta-primary:hover,\n .cta-github:hover,\n .cta-blog:hover {\n transform: translateY(-1px);\n }\n\n .cta-blog:hover::after {\n transform: translateX(3px);\n }\n }\n\n .cta-primary:active,\n .cta-github:active,\n .cta-blog:active {\n transform: scale(0.97);\n }}"}],"page":{"pagePath":"core/agent-core","slug":"/core/agent-core","pageMetadata":{"title":"Agent Class","description":null,"href":"/core/agent-core"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,br:`br`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`Agent`}),` class is the central orchestrator that brings together all other components in the Vision Agents framework. It manages the conversation flow, handles real-time audio/video processing, coordinates responses, and integrates with external tools via MCP (Model Context Protocol) servers. It is the main interface for building AI-powered video and voice applications. It supports both traditional STT/TTS workflows and modern realtime speech-to-speech models, making it flexible for various use cases.`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Do not reuse an `,_jsx(_components.code,{children:`Agent`}),` instance. Create a new agent for each call. Calling\n`,_jsx(_components.code,{children:`join()`}),` twice on the same agent raises `,_jsx(_components.code,{children:`RuntimeError`}),`.`]})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`20`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`20`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` vision_agents.core `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent, User`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` vision_agents.plugins `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` openai, deepgram, elevenlabs, getstream`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Traditional STT/TTS mode`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`agent `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` edge`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`getstream.Edge(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` agent_user`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`User(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"AI Assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` instructions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"You're a helpful AI assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` llm`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`openai.LLM(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-5.4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` stt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`deepgram.STT(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` tts`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`elevenlabs.TTS(),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Realtime mode`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`agent `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` edge`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`getstream.Edge(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` agent_user`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`User(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"AI Assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` instructions`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"You're a helpful AI assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` llm`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`openai.Realtime(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`model`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"gpt-realtime\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`voice`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"marin\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`constructor-parameters`,children:`Constructor Parameters`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`edge`})}),` (`,_jsx(_components.code,{children:`EdgeTransport`}),`): The edge network provider for video \u0026 audio transport (you can choose any provider here)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`llm`})}),` (`,_jsx(_components.code,{children:`LLM | AudioLLM | VideoLLM`}),`): The language model — can be a text LLM, audio-capable (AudioLLM), video-capable (VideoLLM), or a combined Realtime model`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`agent_user`})}),` (`,_jsx(_components.code,{children:`User`}),`): The agent’s user information (name, id, etc.)`]}),`\n`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Optional Parameters`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`instructions`})}),` (`,_jsx(_components.code,{children:`str`}),`): System instructions for the agent. Supports `,_jsx(_components.code,{children:`@file.md`}),` references to load instructions from markdown files (default: “Keep your replies short and dont use special characters.”)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`stt`})}),` (`,_jsx(_components.code,{children:`Optional[STT]`}),`): Speech-to-text service (automatically disabled in realtime mode)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`tts`})}),` (`,_jsx(_components.code,{children:`Optional[TTS]`}),`): Text-to-speech service (automatically disabled in realtime mode)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`turn_detection`})}),` (`,_jsx(_components.code,{children:`Optional[TurnDetector]`}),`): Turn detection service for managing conversation turns. Automatically disabled in realtime mode. Ignored automatically if the configured STT plugin already provides built-in turn detection (when `,_jsx(_components.code,{children:`stt.turn_detection`}),` is `,_jsx(_components.code,{children:`True`}),`, e.g. `,_jsx(_components.code,{children:`elevenlabs.STT`}),`, `,_jsx(_components.code,{children:`deepgram.STT`}),`)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`processors`})}),` (`,_jsx(_components.code,{children:`Optional[List[Processor]]`}),`): List of processors for video/audio processing`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`avatar`})}),` (`,_jsx(_components.code,{children:`Optional[Avatar]`}),`): Avatar provider for lip-synced video output (for example `,_jsx(_components.code,{children:`anam.Avatar(...)`}),`)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`mcp_servers`})}),` (`,_jsx(_components.code,{children:`Optional[List[MCPBaseServer]]`}),`): MCP servers for external tool access`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`options`})}),` (`,_jsx(_components.code,{children:`Optional[AgentOptions]`}),`): Configuration options — see `,_jsx(_components.a,{href:`#agentoptions`,children:`AgentOptions`}),` below`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`broadcast_metrics`})}),` (`,_jsx(_components.code,{children:`bool`}),`): Broadcast agent metrics to call participants via custom events (default: `,_jsx(_components.code,{children:`False`}),`)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`broadcast_metrics_interval`})}),` (`,_jsx(_components.code,{children:`float`}),`): Interval in seconds between metrics broadcasts (default: `,_jsx(_components.code,{children:`5.0`}),`)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`multi_speaker_filter`})}),` (`,_jsx(_components.code,{children:`Optional[AudioFilter]`}),`): Filter for multi-speaker audio routing. Defaults to `,_jsx(_components.code,{children:`FirstSpeakerWinsFilter`}),`, which locks onto the first active speaker and drops other participants’ audio until silence timeout or disconnect. Only activates when two or more participants have active audio tracks — see `,_jsx(_components.a,{href:`/guides/multiple-speakers`,children:`Multiple Speakers`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`tracer`})}),` (`,_jsx(_components.code,{children:`Tracer`}),`): OpenTelemetry tracer for distributed tracing (default: `,_jsx(_components.code,{children:`trace.get_tracer(\"agents\")`}),`)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`profiler`})}),` (`,_jsx(_components.code,{children:`Optional[Profiler]`}),`): Performance profiler for the agent and its plugins`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`agentoptions`,children:`AgentOptions`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Default`}),_jsx(_components.th,{children:`Description`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`model_dir`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`str`})}),_jsx(_components.td,{children:`System temp directory`}),_jsx(_components.td,{children:`Directory for downloaded model files (VAD, turn detection, etc.)`})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`mode-validation`,children:`Mode Validation`}),`\n`,_jsxs(_components.p,{children:[`When an `,_jsx(_components.code,{children:`AudioLLM`}),` is configured (currently Realtime models), STT, TTS, and turn detection are automatically disabled with a warning log. In non-realtime mode, the agent requires at least an audio processing path (STT, TTS, or turn detection) or video processors. Video-only agents without an LLM are allowed when video processors are configured.`]}),`\n`,_jsx(Heading,{level:`2`,id:`core-lifecycle-methods`,children:`Core Lifecycle Methods`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`async create_call(call_type: str, call_id: str) -> Call`})})}),`\n`,_jsxs(_components.p,{children:[`Creates a call on the edge provider. Calls `,_jsx(_components.code,{children:`authenticate()`}),` automatically.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`async join(call: Call, participant_wait_timeout: Optional[float] = 10.0) -> AsyncIterator[None]`})})}),`\n`,_jsx(_components.p,{children:`Joins a video call. Must be called as an async context manager.`}),`\n`,_jsxs(_components.p,{children:[`The agent can join the call only once. Once the call ends, the agent closes itself. `,_jsx(_components.code,{children:`join()`}),` always calls `,_jsx(_components.code,{children:`close()`}),` in its `,_jsx(_components.code,{children:`finally`}),` block.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters`})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`call`})}),` (`,_jsx(_components.code,{children:`Call`}),`): the call to join.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`participant_wait_timeout`})}),` (`,_jsx(_components.code,{children:`Optional[float]`}),`): timeout in seconds to wait for other participants to join before proceeding.`,_jsx(_components.br,{}),`\n`,`If `,_jsx(_components.code,{children:`0`}),`, do not wait at all. If `,_jsx(_components.code,{children:`None`}),`, wait forever.`,_jsx(_components.br,{}),`\n`,`Default - `,_jsx(_components.code,{children:`10.0`}),`. Delegates to `,_jsx(_components.code,{children:`wait_for_participant()`}),`.`]}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`call `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` agent.create_call(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`call_type`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"default\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`call_id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"my-call\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` with`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` agent.join(call):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` agent.simple_response(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Say hi.\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` agent.finish() `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Wait for call to end`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`async wait_for_participant(timeout: Optional[float] = None) -> None`})})}),`\n`,_jsxs(_components.p,{children:[`Waits for at least one participant to join. Default `,_jsx(_components.code,{children:`None`}),` waits forever.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`async finish()`})})}),`\n`,_jsx(_components.p,{children:`Waits for the call to end gracefully. Subscribes to the call ended event. Returns immediately if not joined or already closed.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`async close()`})})}),`\n`,_jsxs(_components.p,{children:[`Cleans up all connections and resources. Safe to call multiple times. Called automatically when `,_jsx(_components.code,{children:`join()`}),` context exits.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`async authenticate()`})})}),`\n`,_jsxs(_components.p,{children:[`Authenticates the agent user with the edge provider. Idempotent — safe to call multiple times. Called automatically from `,_jsx(_components.code,{children:`join()`}),` and `,_jsx(_components.code,{children:`create_call()`}),`, so you usually don’t need to call it directly.`]}),`\n`,_jsx(Heading,{level:`3`,id:`response-methods`,children:`Response Methods`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`async simple_response(text: str, participant: Optional[Participant] = None, interrupt: bool = True)`})})}),`\n`,_jsxs(_components.p,{children:[`Sends a text prompt to the active inference flow. The LLM generates a response which is then spoken through TTS (or realtime audio output). Use `,_jsx(_components.code,{children:`interrupt=True`}),` when you want this request to preempt an in-flight response.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` agent.simple_response(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Hello, how can I help you?\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`interrupt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`True`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`async say(text: str, interrupt: bool = False)`})})}),`\n`,_jsxs(_components.p,{children:[`Makes the agent speak text directly, bypassing the LLM. Works in transcribing (STT + LLM + TTS) mode only — the text is synthesized via TTS. In Realtime mode, `,_jsx(_components.code,{children:`say()`}),` logs a warning and does not produce audio (conversation history may still be updated). Use `,_jsx(_components.code,{children:`interrupt=True`}),` to stop current output before speaking.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` agent.say(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Welcome to the call!\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`interrupt`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`False`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`monitoring-methods`,children:`Monitoring Methods`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`idle_for() -> float`})})}),`\n`,_jsxs(_components.p,{children:[`Returns the number of seconds the agent has been alone on the call (all human participants have left). Returns `,_jsx(_components.code,{children:`0.0`}),` while other participants are present or before join.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:_jsx(_components.code,{children:`on_call_for() -> float`})})}),`\n`,_jsx(_components.p,{children:`Returns the number of seconds since the agent joined the call.`}),`\n`,_jsx(Heading,{level:`3`,id:`observability`,children:`Observability`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`metrics`})}),` — `,_jsx(_components.code,{children:`AgentMetrics`}),` property for performance data. See `,_jsx(_components.a,{href:`/core/telemetry`,children:`Telemetry`}),`.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`async send_metrics_event(event_type=\"agent_metrics\", fields=None)`})}),` — Broadcast metrics to call participants.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`async send_custom_event(data: dict)`})}),` — Push custom data to call participants via the edge provider.`]}),`\n`,_jsx(Heading,{level:`2`,id:`mcp-integration`,children:`MCP Integration`}),`\n`,_jsx(_components.p,{children:`The Agent supports Model Context Protocol (MCP) for external tool integration. MCP servers connect when the agent joins a call:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` vision_agents.core `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent, User`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` vision_agents.core.mcp `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MCPServerRemote`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`github_server `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` MCPServerRemote(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` url`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://api.githubcopilot.com/mcp/\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`github_pat`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`agent `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` edge`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`getstream.Edge(),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` agent_user`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`User(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`name`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Assistant\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`id`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"agent\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`),`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` llm`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` mcp_servers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[github_server],`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`MCP tools are automatically registered with the LLM’s function registry and can be called during conversations. See the `,_jsx(_components.a,{href:`/guides/mcp-tool-calling`,children:`MCP guide`}),` for more.`]}),`\n`,_jsx(Heading,{level:`2`,id:`event-system`,children:`Event System`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`Agent`}),` makes it easy for developers to quickly subscribe and listen to events happening across all components. The event system merges all events across the plugin and core allowing you to listen to events in a single place using their respective type.`]}),`\n`,_jsx(Heading,{level:`3`,id:`core-events`,children:`Core Events`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Agent Lifecycle Events`}),`: `,_jsx(_components.code,{children:`UserTurnStartedEvent`}),`, `,_jsx(_components.code,{children:`UserTurnEndedEvent`}),`, `,_jsx(_components.code,{children:`UserTranscriptEvent`}),`, `,_jsx(_components.code,{children:`AgentTurnStartedEvent`}),`, `,_jsx(_components.code,{children:`AgentTurnEndedEvent`}),`, `,_jsx(_components.code,{children:`AgentJoinedCallEvent`}),`, `,_jsx(_components.code,{children:`AgentLeftCallEvent`}),`, `,_jsx(_components.code,{children:`AgentFinishEvent`}),` (emitted only when `,_jsx(_components.code,{children:`finish()`}),` is cancelled, not on normal call end)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Edge / Call Events`}),`: `,_jsx(_components.code,{children:`ParticipantJoinedEvent`}),`, `,_jsx(_components.code,{children:`ParticipantLeftEvent`}),`, `,_jsx(_components.code,{children:`CallEndedEvent`}),`, `,_jsx(_components.code,{children:`TrackAddedEvent`}),`, `,_jsx(_components.code,{children:`TrackRemovedEvent`}),`, `,_jsx(_components.code,{children:`AudioReceivedEvent`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`LLM Events`}),`: `,_jsx(_components.code,{children:`LLMResponseFinalEvent`}),`, `,_jsx(_components.code,{children:`LLMErrorEvent`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Tool Events`}),`: `,_jsx(_components.code,{children:`ToolStartEvent`}),`, `,_jsx(_components.code,{children:`ToolEndEvent`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Realtime Events`}),`: `,_jsx(_components.code,{children:`RealtimeConnectedEvent`}),`, `,_jsx(_components.code,{children:`RealtimeDisconnectedEvent`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`STT Events`}),`: `,_jsx(_components.code,{children:`STTConnectedEvent`}),`, `,_jsx(_components.code,{children:`STTDisconnectedEvent`}),`, `,_jsx(_components.code,{children:`STTErrorEvent`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`TTS Events`}),`: `,_jsx(_components.code,{children:`TTSSynthesisStartEvent`}),`, `,_jsx(_components.code,{children:`TTSSynthesisCompleteEvent`}),`, `,_jsx(_components.code,{children:`TTSConnectedEvent`}),`, `,_jsx(_components.code,{children:`TTSDisconnectedEvent`}),`, `,_jsx(_components.code,{children:`TTSErrorEvent`})]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`See `,_jsx(_components.a,{href:`/reference/events-reference`,children:`Events Reference`}),` for full field details.`]}),`\n`,_jsx(Heading,{level:`3`,id:`event-subscription`,children:`Event Subscription`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` vision_agents.core.edge.events `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` AudioReceivedEvent`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`@agent.events.subscribe`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` on_audio_received`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`event`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: AudioReceivedEvent):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Handle audio data`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` pass`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`You can also use `,_jsx(_components.code,{children:`agent.subscribe(function)`}),` as an alternative to the decorator.`]}),`\n`,_jsx(Heading,{level:`2`,id:`debugging-with-local-video-files`,children:`Debugging with local video files`}),`\n`,_jsx(_components.p,{children:`For testing and debugging video processing without a live camera, you can use a local video file as the video source. This is useful for reproducible testing and development.`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Video override only works when `,_jsx(_components.code,{children:`publish_video`}),` is `,_jsx(_components.code,{children:`True`}),` (requires an avatar or\na video publisher processor). Set the path `,_jsx(_components.strong,{children:`before`}),` calling `,_jsx(_components.code,{children:`join()`}),`.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`using-the-cli`,children:`Using the CLI`}),`\n`,_jsxs(_components.p,{children:[`Pass the `,_jsx(_components.code,{children:`--video-track-override`}),` option when running your agent:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`uv`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` agent.py`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` run`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --video-track-override=/path/to/video.mp4`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`using-the-api`,children:`Using the API`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` vision_agents.core `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent, User`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`agent `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Agent(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`...`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`agent.set_video_track_override_path(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"/path/to/video.mp4\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`When a video override is set, the local video file plays in a loop at 30 FPS instead of any incoming video tracks from call participants. The track lifecycle remains intact (starts when a user joins, stops when they leave).`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Agent Class","description":null,"href":"/core/agent-core"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Constructor Parameters","slug":"constructor-parameters","depth":2,"children":[{"title":"AgentOptions","slug":"agentoptions","depth":3,"children":[]},{"title":"Mode Validation","slug":"mode-validation","depth":3,"children":[]}]},{"title":"Core Lifecycle Methods","slug":"core-lifecycle-methods","depth":2,"children":[{"title":"Response Methods","slug":"response-methods","depth":3,"children":[]},{"title":"Monitoring Methods","slug":"monitoring-methods","depth":3,"children":[]},{"title":"Observability","slug":"observability","depth":3,"children":[]}]},{"title":"MCP Integration","slug":"mcp-integration","depth":2,"children":[]},{"title":"Event System","slug":"event-system","depth":2,"children":[{"title":"Core Events","slug":"core-events","depth":3,"children":[]},{"title":"Event Subscription","slug":"event-subscription","depth":3,"children":[]}]},{"title":"Debugging with local video files","slug":"debugging-with-local-video-files","depth":2,"children":[{"title":"Using the CLI","slug":"using-the-cli","depth":3,"children":[]},{"title":"Using the API","slug":"using-the-api","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"stream-52f5fdce","siteName":"Vision Agents","title":"Agent Class - Vision Agents","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-08-26T17:23:38.949Z","originalFileLocation":"core/agent-core.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Vision Agents\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Agent Class - Vision Agents\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Vision Agents\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://visionagents.ai/core/agent-core\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://stream-52f5fdce.mintlify.site/_mintlify/api/og/v2?division=Core+Reference\u0026amp;title=Agent+Class\u0026amp;theme=af85708a53d7b9b6ee7b0100\u0026amp;signature=bf94cc58fbc1325ef302f1913f0485115e2a5ddcb9f8d62245a89ac4f0a4f7e9\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Agent Class - Vision Agents\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://stream-52f5fdce.mintlify.site/_mintlify/api/og/v2?division=Core+Reference\u0026amp;title=Agent+Class\u0026amp;theme=af85708a53d7b9b6ee7b0100\u0026amp;signature=bf94cc58fbc1325ef302f1913f0485115e2a5ddcb9f8d62245a89ac4f0a4f7e9\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/stream-52f5fdce/RlK2yeftnq0CwuIc/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Vision Agents\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#005FFF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://visionagents.ai/core/agent-core\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/core/agent-core.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://visionagents.ai/#organization\",\"name\":\"Vision Agents\",\"url\":\"https://visionagents.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/stream-52f5fdce/Nind0EHQ2u8VMFBc/logo/vision-agents.svg?fit=max\u0026auto=format\u0026n=Nind0EHQ2u8VMFBc\u0026q=85\u0026s=82b7b4cf9c716a47656a761f92951360\"}},{\"@type\":\"WebSite\",\"@id\":\"https://visionagents.ai#website\",\"name\":\"Vision Agents\",\"url\":\"https://visionagents.ai\",\"publisher\":{\"@id\":\"https://visionagents.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://visionagents.ai/core/agent-core#webpage\",\"url\":\"https://visionagents.ai/core/agent-core\",\"name\":\"Agent Class\",\"dateModified\":\"2026-08-26T17:23:38.949Z\",\"isPartOf\":{\"@id\":\"https://visionagents.ai#website\"},\"breadcrumb\":{\"@id\":\"https://visionagents.ai/core/agent-core#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://visionagents.ai/core/agent-core#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Core Reference\",\"item\":\"https://visionagents.ai/core/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Agent Class\",\"item\":\"https://visionagents.ai/core/agent-core\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://visionagents.ai/core/agent-core#article\",\"headline\":\"Agent Class\",\"name\":\"Agent Class\",\"url\":\"https://visionagents.ai/core/agent-core\",\"mainEntityOfPage\":{\"@id\":\"https://visionagents.ai/core/agent-core#webpage\"},\"dateModified\":\"2026-08-26T17:23:38.949Z\",\"publisher\":{\"@id\":\"https://visionagents.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://visionagents.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Vision Agents\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Vision Agents\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/core/agent-core.md","siteName":"Vision Agents","nav":{"global":{"anchors":[{"anchor":"GitHub","icon":"github","href":"https://github.com/GetStream/vision-agents"},{"anchor":"X Account","icon":"x-twitter","href":"https://x.com/visionagents_ai"},{"anchor":"Discord","icon":"discord","href":"https://discord.gg/RkhX9PxMS6"},{"anchor":"Contact Us","icon":"envelope","href":"mailto:nash@getstream.io"},{"anchor":"Crashout Buddy","icon":"robot","href":"https://emotional-support.visionagents.ai/"}]},"tabs":[{"tab":"Fundamentals","groups":[{"group":"Getting Started","pages":[{"title":"Overview","href":"/introduction/overview"},{"title":"Quickstart","href":"/introduction/quickstart"},{"title":"Voice Agents","href":"/introduction/voice-agents"},{"title":"Video Agents","href":"/introduction/video-agents"}]},{"group":"AI Technologies","pages":[{"title":"Text To Speech (TTS)","href":"/ai-technologies/text-to-speech"},{"title":"Speech To Text (STT)","href":"/ai-technologies/speech-to-text"},{"title":"Speech To Speech (STS)","href":"/ai-technologies/speech-to-speech"},{"title":"Turn Detection","href":"/ai-technologies/turn-detection"},{"title":"Model Context Protocol (MCP)","href":"/ai-technologies/model-context-protocol"}]},{"group":"Core Reference","pages":[{"title":"Overview","description":"Modular architecture for real-time voice and video AI agents","href":"/core/overview"},{"title":"Agent Class","href":"/core/agent-core"},{"title":"LLM Class","description":null,"href":"/core/llm-core"},{"title":"Speech-to-Text and Text-to-Speech Class","href":"/core/stt-tts-core"},{"title":"Realtime Class","href":"/core/realtime-core"},{"title":"Processors Class","href":"/core/processors-core"},{"title":"Avatar Class","href":"/core/avatar-core"}]},{"group":"Reference","pages":[{"title":"Events Reference","href":"/reference/events-reference"}]}]},{"tab":"How-to Guides","pages":[{"title":"How-to Guides","href":"/guides/deploying-overview"}]},{"tab":"Examples","pages":[{"title":"Examples","href":"/examples/simple-agent"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/integrations/introduction-to-integrations"}]},{"tab":"Showcase","pages":[{"title":"Showcase","href":"/showcase/showcase-page"}]}]},"basePath":"","title":"Agent Class - Vision Agents","deploymentId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","buildId":"dpl_HhUetB7eHHDAmK9T1Teip38TgFx9","dynamics":[],"chunks":[]}