Skip to main content
Events are typed Python objects for communication between your agent and the Cartesia platform. Your agent receives input events from the harness and yields output events to control the conversation.
To learn which events trigger your agent and how to customize this behavior (e.g., responding to DTMF, preventing interruptions), see Controlling the Conversational Loop.

Input Events

Input events are received by your agent from the Cartesia harness. All input events include an optional history field containing the complete conversation history. When history is None, the event is being used within a history list; when history contains a list, the event has the full conversation context attached.

Call Lifecycle

User Turn Events

Agent Turn Events (in history)

Handoff Event

Custom Event

Received when your client application sends a custom WebSocket event to the call stream. The event carries a metadata dict with whatever key-value pairs the client included:

Output Events

Output events are yielded by your agent to control the conversation.

Speech

You can choose to send messages with AgentSendText.
By default, users can interrupt the agent. However, if you have a disclaimer or another important message that you wish be uninterruptible, you can set the interruptible flag as false.

Call Control

Dynamic Configuration

Update call settings (voice, pronunciation, language) mid-conversation using AgentUpdateCall:
AgentUpdateCall Parameters: All fields are optional—only set fields are updated.

Tool Events

These are emitted by LlmAgent to track tool execution:

Logging

Custom Events

Send arbitrary metadata from your agent to the harness:
Pair with UserCustomSent for bidirectional metadata exchange.

Voice & Language Control

Change voice or speech recognition language mid-call:
The language field sets the ASR (speech recognition) language. Pass any language code supported by Ink STT, or "multilingual" for automatic language detection.

Event History

All input events include an optional history field containing the conversation history. When history is None, the event is inside a history list; when it contains a list, full conversation context is attached. LlmAgent handles this automatically—you only need to understand history if building custom agents.

Accessing History

Events in the history list have history=None to avoid redundant nesting. The event types are the same as regular input events:
LlmAgent automatically converts the event history to LLM messages:
  • User messages: From UserTextSent events
  • Assistant messages: From AgentTextSent events
  • Tool calls: From AgentToolCalled and AgentToolReturned events
This means the LLM sees full context including previous tool calls and results, enabling it to reference that information without making redundant API calls.
If building a custom agent (not using LlmAgent), you can use history for context, summarization, or pattern detection: