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.
userData
Arbitrary data attached to the session. Accessible from tool handlers via
RunContext.userData.
voiceOptions
Voice configuration (voice, engine, language) passed through to the
SignalWire AI config.
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.