AgentsLiveWire

AgentSession

View as MarkdownOpen in Claude

AgentSession 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 timing parameters to SignalWire AI parameters.

1from signalwire.livewire import Agent, AgentSession
2
3agent = Agent(instructions="You are a helpful assistant.")
4session = AgentSession()
5await session.start(agent)

Constructor Parameters

tools
Optional[list[Any]]

Additional tools to register alongside the agent’s tools.

userdata
AnyDefaults to {}

Arbitrary data attached to the session.

allow_interruptions
boolDefaults to True

Whether the user can interrupt the agent while it is speaking. Maps to SignalWire’s barge_confidence parameter.

min_interruption_duration
floatDefaults to 0.5

Minimum duration in seconds before an interruption is recognized.

min_endpointing_delay
floatDefaults to 0.5

Minimum silence duration in seconds to finalize speech. Maps to SignalWire’s end_of_speech_timeout parameter (converted to milliseconds).

max_endpointing_delay
floatDefaults to 3.0

Maximum silence duration in seconds before forcing endpointing. Maps to SignalWire’s attention_timeout parameter (converted to milliseconds).

max_tool_steps
intDefaults to 3

Maximum number of tool execution steps per turn.

preemptive_generation
boolDefaults to False

Whether to start generating a response before the user finishes speaking.

The stt, tts, llm, vad, turn_detection, and mcp_servers parameters are accepted for LiveKit API compatibility but are no-ops — SignalWire’s control plane handles the full media pipeline automatically. MCP servers are not yet supported in LiveWire.

Properties

userdata
Any

Arbitrary data attached to the session. Accessible from tool handlers via RunContext.userdata. Defaults to an empty dict.

history
list[dict[str, str]]

Conversation history as a list of {"role": ..., "content": ...} dicts.

Methods