> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# AgentSession

> Session orchestrator that binds an Agent to the SignalWire platform.

[agent]: /docs/server-sdks/reference/python/agents/livewire/agent

[agentbase]: /docs/server-sdks/reference/python/agents/agent-base

[runcontext-userdata]: /docs/server-sdks/reference/python/agents/livewire/run-context

[functiontool]: /docs/server-sdks/reference/python/agents/livewire/function-tool

[start]: /docs/server-sdks/reference/python/agents/livewire/agent-session/start

[say]: /docs/server-sdks/reference/python/agents/livewire/agent-session/say

[generatereply]: /docs/server-sdks/reference/python/agents/livewire/agent-session/generate-reply

[interrupt]: /docs/server-sdks/reference/python/agents/livewire/agent-session/interrupt

[updateagent]: /docs/server-sdks/reference/python/agents/livewire/agent-session/update-agent

`AgentSession` is the orchestrator that binds an
[`Agent`][agent] to the SignalWire platform.
When `start()` is called, it translates the LiveWire agent definition into a SignalWire
[`AgentBase`][agentbase] instance, mapping
instructions to prompts, tools to SWAIG functions, and timing parameters to
SignalWire AI parameters.

```python {4}
from signalwire.livewire import Agent, AgentSession

agent = Agent(instructions="You are a helpful assistant.")
session = AgentSession()
await session.start(agent)
```

## **Constructor Parameters**

**`tools`** `Optional[list[Any]]`

Additional tools to register alongside the agent's tools.

---

**`userdata`** `Any` — default: \{}

Arbitrary data attached to the session.

---

**`allow_interruptions`** `bool` — default: True

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

---

**`min_interruption_duration`** `float` — default: 0.5

Minimum duration in seconds before an interruption is recognized.

---

**`min_endpointing_delay`** `float` — default: 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`** `float` — default: 3.0

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

---

**`max_tool_steps`** `int` — default: 3

Maximum number of tool execution steps per turn.

---

**`preemptive_generation`** `bool` — default: 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`][runcontext-userdata].
Defaults to an empty dict.

---

**`history`** `list[dict[str, str]]`

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

---

## **Methods**

#### [start](/docs/server-sdks/reference/python/agents/livewire/agent-session/start)

Bind an Agent and prepare the underlying SignalWire AgentBase.

#### [say](/docs/server-sdks/reference/python/agents/livewire/agent-session/say)

Queue text to be spoken by the agent.

#### [generate\_reply](/docs/server-sdks/reference/python/agents/livewire/agent-session/generate-reply)

Trigger the agent to generate a reply.

#### [interrupt](/docs/server-sdks/reference/python/agents/livewire/agent-session/interrupt)

No-op. SignalWire handles barge-in automatically.

#### [update\_agent](/docs/server-sdks/reference/python/agents/livewire/agent-session/update-agent)

Swap in a new Agent mid-session.