***

title: AgentSession
slug: /reference/python/agents/livewire/agent-session
description: Session orchestrator that binds an Agent to the SignalWire platform.
max-toc-depth: 3
---------------------

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

[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**

<ParamField path="tools" type="Optional[list[Any]]" toc={true}>
  Additional tools to register alongside the agent's tools.
</ParamField>

<ParamField path="userdata" type="Any" default="{}" toc={true}>
  Arbitrary data attached to the session.
</ParamField>

<ParamField path="allow_interruptions" type="bool" default="True" toc={true}>
  Whether the user can interrupt the agent while it is speaking. Maps to
  SignalWire's `barge_confidence` parameter.
</ParamField>

<ParamField path="min_interruption_duration" type="float" default="0.5" toc={true}>
  Minimum duration in seconds before an interruption is recognized.
</ParamField>

<ParamField path="min_endpointing_delay" type="float" default="0.5" toc={true}>
  Minimum silence duration in seconds to finalize speech. Maps to
  SignalWire's `end_of_speech_timeout` parameter (converted to milliseconds).
</ParamField>

<ParamField path="max_endpointing_delay" type="float" default="3.0" toc={true}>
  Maximum silence duration in seconds before forcing endpointing. Maps to
  SignalWire's `attention_timeout` parameter (converted to milliseconds).
</ParamField>

<ParamField path="max_tool_steps" type="int" default="3" toc={true}>
  Maximum number of tool execution steps per turn.
</ParamField>

<ParamField path="preemptive_generation" type="bool" default="False" toc={true}>
  Whether to start generating a response before the user finishes speaking.
</ParamField>

<Note>
  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.
</Note>

## **Properties**

<ParamField path="userdata" type="Any" toc={true}>
  Arbitrary data attached to the session. Accessible from tool handlers via
  [`RunContext.userdata`][runcontext-userdata].
  Defaults to an empty dict.
</ParamField>

<ParamField path="history" type="list[dict[str, str]]" toc={true}>
  Conversation history as a list of `{"role": ..., "content": ...}` dicts.
</ParamField>

## **Methods**

<CardGroup cols={2}>
  <Card title="start" href="/docs/server-sdks/reference/python/agents/livewire/agent-session/start">
    Bind an Agent and prepare the underlying SignalWire AgentBase.
  </Card>

  <Card title="say" href="/docs/server-sdks/reference/python/agents/livewire/agent-session/say">
    Queue text to be spoken by the agent.
  </Card>

  <Card title="generate_reply" href="/docs/server-sdks/reference/python/agents/livewire/agent-session/generate-reply">
    Trigger the agent to generate a reply.
  </Card>

  <Card title="interrupt" href="/docs/server-sdks/reference/python/agents/livewire/agent-session/interrupt">
    No-op. SignalWire handles barge-in automatically.
  </Card>

  <Card title="update_agent" href="/docs/server-sdks/reference/python/agents/livewire/agent-session/update-agent">
    Swap in a new Agent mid-session.
  </Card>
</CardGroup>