signalwire.livewire¶
signalwire.livewire
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
LiveWire -- LiveKit-compatible agents powered by SignalWire.
Developers familiar with livekit-agents can use the same class and function names; just change the import path to run on SignalWire infrastructure.
from signalwire.livewire import Agent, AgentSession, function_tool
NOT_GIVEN = _NOT_GIVEN
module-attribute
¶
BANNER = '\n __ _ _ ___\n / / (_) _____ | | / (_)_______\n / / / / | / / _ \\ | | /| / / / ___/ _ \\\n / /___/ /| |/ / __/ | |/ |/ / / / / __/\n/_____/_/ |___/\\___/ |__/|__/_/_/ \\___/\n\n LiveKit-compatible agents powered by SignalWire\n'
module-attribute
¶
TIPS = ['SignalWire agents support DataMap tools that execute server-side -- no webhook infrastructure needed. See: docs/datamap_guide.md', 'SignalWire Contexts & Steps give you mechanical state control over conversations -- no prompt engineering needed. See: docs/contexts_guide.md', 'SignalWire agents can transfer calls between agents with a single SwmlTransfer() action', 'SignalWire handles 18 built-in skills (datetime, math, web search, etc.) with one-liner integration via agent.AddSkill()', 'SignalWire agents support SMS, conferencing, call recording, and SIP -- all from the same agent', "Your agent's entire AI pipeline (STT, LLM, TTS, VAD) runs in SignalWire's cloud -- zero infrastructure to manage", 'SignalWire prefab agents (Survey, Receptionist, FAQ, Concierge) give you production patterns in 10 lines of code', "SignalWire's RELAY client gives you real-time WebSocket call control with 57+ methods -- play, record, detect, conference, and more", 'SignalWire agents auto-generate SWML documents -- the platform handles media, turn detection, and barge-in for you', 'You can host multiple agents on one server with AgentServer -- each with its own route, prompt, and tools']
module-attribute
¶
voice = _VoiceNamespace()
module-attribute
¶
llm_ns = _LLMNamespace()
module-attribute
¶
inference = _InferenceNamespace()
module-attribute
¶
cli_ns = _CLINamespace()
module-attribute
¶
__all__ = ['Agent', 'AgentSession', 'RunContext', 'function_tool', 'ChatContext', 'StopResponse', 'ToolError', 'AgentHandoff', 'AgentServer', 'JobContext', 'JobProcess', 'Room', 'DeepgramSTT', 'OpenAILLM', 'CartesiaTTS', 'ElevenLabsTTS', 'SileroVAD', 'InferenceSTT', 'InferenceLLM', 'InferenceTTS', 'voice', 'llm_ns', 'cli_ns', 'inference', 'run_app', 'NOT_GIVEN', 'BANNER', 'TIPS']
module-attribute
¶
StopResponse
¶
Bases: Exception
Signals that a tool should not trigger another LLM reply.
ToolError
¶
Bases: Exception
Signals a tool execution error.
AgentHandoff
¶
ChatContext
¶
RunContext
¶
Agent
¶
Mirrors a livekit Agent -- holds instructions and tool definitions.
instructions = instructions
instance-attribute
¶
session
property
writable
¶
__init__(*, instructions='', tools=None, chat_ctx=NOT_GIVEN, stt=NOT_GIVEN, tts=NOT_GIVEN, llm=NOT_GIVEN, vad=NOT_GIVEN, turn_detection=NOT_GIVEN, mcp_servers=NOT_GIVEN, allow_interruptions=NOT_GIVEN, min_endpointing_delay=NOT_GIVEN, max_endpointing_delay=NOT_GIVEN)
¶
on_enter()
async
¶
Called when the agent enters. Override in subclass.
on_exit()
async
¶
Called when the agent exits. Override in subclass.
on_user_turn_completed(turn_ctx=None, new_message=None)
async
¶
Called when the user finishes speaking. Override in subclass.
stt_node(audio=None, model_settings=None)
async
¶
Noop -- SignalWire handles STT in its control plane.
llm_node(chat_ctx=None, tools=None, model_settings=None)
async
¶
Noop -- SignalWire handles LLM in its control plane.
tts_node(text=None, model_settings=None)
async
¶
Noop -- SignalWire handles TTS in its control plane.
update_instructions(instructions)
async
¶
Update the agent's instructions mid-session.
update_tools(tools)
async
¶
Update the agent's tool list mid-session.
AgentSession
¶
Mirrors a livekit AgentSession -- orchestrator that binds an Agent to the SignalWire platform.
userdata
property
writable
¶
history
property
¶
__init__(*, stt=None, tts=None, llm=None, vad=None, turn_detection=None, tools=None, mcp_servers=None, userdata=None, allow_interruptions=True, min_interruption_duration=0.5, min_endpointing_delay=0.5, max_endpointing_delay=3.0, max_tool_steps=3, preemptive_generation=False)
¶
start(agent, *, room=None, record=False)
async
¶
Bind to an Agent and prepare the underlying SignalWire AgentBase.
say(text)
¶
Queue text to be spoken by the agent.
generate_reply(*, instructions=None)
¶
Trigger the agent to generate a reply. On SignalWire the prompt handles this; if instructions is provided they are noted.
interrupt()
¶
Noop -- SignalWire handles barge-in automatically.
update_agent(agent)
¶
Swap in a new Agent.
Room
¶
Stub -- SignalWire doesn't use the LiveKit room abstraction.
name = 'livewire-room'
class-attribute
instance-attribute
¶
JobProcess
¶
JobContext
¶
Mirrors a livekit JobContext -- provides room and connection info.
room = Room()
instance-attribute
¶
proc = JobProcess()
instance-attribute
¶
__init__()
¶
connect()
async
¶
Noop -- SignalWire agents connect automatically when the platform invokes the SWML endpoint.
wait_for_participant(*, identity=None)
async
¶
Noop -- SignalWire handles participant management automatically.
AgentServer
¶
OpenAILLM
¶
SileroVAD
¶
InferenceSTT
¶
InferenceLLM
¶
InferenceTTS
¶
function_tool(func=None, *, name=None, description=None)
¶
Mirrors the livekit @function_tool decorator.
Wraps a plain function so it can be passed into Agent(tools=[...]).
Parameters are extracted from type-hints; the docstring is used as the
description when description is not provided explicitly.
run_app(server)
¶
Print banner, print a random tip, run the agent.
This is the main entry point -- mirrors livekit.agents.cli.run_app.
plugins
¶
Copyright (c) 2025 SignalWire
This file is part of the SignalWire SDK.
Licensed under the MIT License. See LICENSE file in the project root for full license information.
LiveWire plugin stubs.
These classes mirror popular livekit-agents plugin constructors so that existing code compiles unchanged. On SignalWire the platform handles all STT/TTS/LLM/VAD infrastructure -- these are no-ops that log once.