Signals
LiveWire provides error and signal classes that tool handlers can throw or return to control agent behavior.
StopResponse
Extends Error. When thrown inside a tool handler, signals that the tool should
not trigger another LLM reply. Use this when the tool’s side effect is the
final action and no further conversation is needed.
Constructor
message
Optional error message. Defaults to "StopResponse".
ToolError
Extends Error. Signals a tool execution failure. Throw this when a tool
encounters a problem that should be reported back to the LLM so it can
communicate the issue to the user or retry.
Constructor
message
Error message describing what went wrong. This is sent back to the LLM.
AgentHandoff
A signal class for handing off a conversation to a different agent in multi-agent
scenarios. Created via the handoff() helper function.
Properties
agent
The target Agent for the handoff.
returns
Optional return message for the handoff.
handoff()
Factory function that creates an AgentHandoff instance.
agent
The target agent to hand off to.
returns
Optional return value for the handoff.
ChatContext
A minimal class mirroring the LiveKit ChatContext. Stores an in-memory list
of chat messages. On SignalWire, the platform manages conversation history
for the active call — this class exists so that existing livekit-agents code
that references ChatContext compiles without errors, and so callers can
stage messages in prewarm code.
Properties
messages
Appended chat messages. Each entry is stored as { role, content }.
append
Append a message to messages. The stored entry uses content (not text)
as the body key — text is renamed to match the on-wire message shape.
role
The message role ("user", "assistant", "system", etc.).
text
The message content.