***

title: AgentSession
slug: /reference/typescript/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/typescript/agents/livewire/agent

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

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

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

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

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

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

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

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

`AgentSession<UserData>` 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 LLM model settings to
SignalWire AI parameters.

```typescript {4-5}
import { Agent, AgentSession } from '@signalwire/sdk/livewire';

const agent = new Agent({ instructions: 'You are a helpful assistant.' });
const session = new AgentSession();
await session.start({ agent });
```

## **Constructor**

```typescript {1}
new AgentSession<UserData>(options?: {
  stt?: any;
  tts?: any;
  llm?: any;
  vad?: any;
  turnDetection?: any;
  userData?: UserData;
  voiceOptions?: Partial<VoiceOptions>;
})
```

<ParamField path="stt" type="any" default="undefined" toc={true}>
  STT provider instance. Accepted for API compatibility; SignalWire handles speech
  recognition automatically. Logs an informational message on first use.
</ParamField>

<ParamField path="tts" type="any" default="undefined" toc={true}>
  TTS provider instance. Accepted for API compatibility; SignalWire handles
  text-to-speech automatically. Logs an informational message on first use.
</ParamField>

<ParamField path="llm" type="any" default="undefined" toc={true}>
  LLM provider or model string. If provided, the model name is extracted (stripping
  any provider prefix like `"openai/"`) and set on the underlying SignalWire agent.
</ParamField>

<ParamField path="vad" type="any" default="undefined" toc={true}>
  VAD provider instance. Accepted for API compatibility; SignalWire handles voice
  activity detection automatically.
</ParamField>

<ParamField path="turnDetection" type="any" default="undefined" toc={true}>
  Turn detection configuration. Accepted for API compatibility; SignalWire handles
  turn detection automatically.
</ParamField>

<ParamField path="userData" type="UserData" default="{}" toc={true}>
  Arbitrary data attached to the session. Accessible from tool handlers via
  [`RunContext.userData`][runcontext].
</ParamField>

<ParamField path="voiceOptions" type="Partial<VoiceOptions>" default="undefined" toc={true}>
  Voice configuration (`voice`, `engine`, `language`) passed through to the
  SignalWire AI config.
</ParamField>

## **Properties**

<ParamField path="userData" type="UserData" toc={true}>
  Getter/setter for the session's user data. Defaults to an empty object.
</ParamField>

## **Methods**

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

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

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

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

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

### getSwAgent

```typescript {1}
getSwAgent(): AgentBase | undefined
```

Returns the underlying SignalWire [`AgentBase`][agentbase] instance, or `undefined`
if `start()` has not been called yet. Useful for testing or advanced configuration.