AgentSession
AgentSession<UserData> is the orchestrator that binds an
Agent to the SignalWire platform.
When start() is called, it translates the LiveWire agent definition into a SignalWire
AgentBase instance, mapping
instructions to prompts, tools to SWAIG functions, and LLM model settings to
SignalWire AI parameters.
Constructor
stt
STT provider instance. Accepted for API compatibility; SignalWire handles speech recognition automatically. Logs an informational message on first use.
tts
TTS provider instance. Accepted for API compatibility; SignalWire handles text-to-speech automatically. Logs an informational message on first use.
llm
LLM provider or model string. If provided, the model name is extracted (stripping
any provider prefix like "openai/") and set on the underlying SignalWire agent.
vad
VAD provider instance. Accepted for API compatibility; SignalWire handles voice activity detection automatically.
turnDetection
Turn detection configuration. Accepted for API compatibility; SignalWire handles turn detection automatically.
tools
Optional additional tools merged with the agent’s tools when start() is called.
mcpServers
Accepted for LiveKit parity. MCP servers are not yet supported in LiveWire — logs a one-time advisory and has no effect.
userData
Arbitrary data attached to the session. Accessible from tool handlers via
RunContext.userData.
allowInterruptions
Forwarded to the SignalWire AI params when the session starts.
minInterruptionDuration
Accepted for LiveKit parity. Forwarded to the SignalWire AI params when the session starts.
minEndpointingDelay
Minimum endpointing delay in seconds. Forwarded to the SignalWire AI params when the session starts.
maxEndpointingDelay
Maximum endpointing delay in seconds. Forwarded to the SignalWire AI params when the session starts.
maxToolSteps
Accepted for LiveKit parity. SignalWire handles tool-execution depth automatically — logs a one-time advisory if set to a non-default value.
preemptiveGeneration
Accepted for LiveKit parity. Stored on the session but not currently used.
Properties
userData
Getter/setter for the session’s user data. Defaults to an empty object.
Methods
Bind an Agent and prepare the underlying SignalWire AgentBase.
Queue text to be spoken by the agent.
Trigger the agent to generate a reply.
No-op. SignalWire handles barge-in automatically.
Swap in a new Agent mid-session.
getSwAgent
Returns the underlying SignalWire AgentBase instance, or undefined
if start() has not been called yet. Useful for testing or advanced configuration.