start

View as MarkdownOpen in Claude

Bind an Agent to this session and prepare the underlying SignalWire infrastructure. This translates the agent’s instructions into a prompt, registers tools as SWAIG functions, and maps the LLM model (if provided) to the SignalWire AI model parameter.

Signature

async start(params: { agent: Agent<UserData>; room?: any; record?: boolean }): Promise<void>

Parameters

agent
AgentRequired

The Agent instance to bind to this session.

room
any

A room instance. Accepted for API compatibility with LiveKit.

record
boolean

Whether to record the session. Accepted for API compatibility with LiveKit.

Returns

Promise<void>

Example

import { Agent, AgentSession, tool } from '@signalwire/sdk/livewire';
const checkBalance = tool({
description: 'Check the balance for an account.',
parameters: { accountId: { type: 'string' } },
execute: (params) => {
return `Account ${params.accountId} has a balance of $150.00.`;
},
});
const agent = new Agent({
instructions: 'You are a helpful banking assistant.',
tools: { checkBalance },
});
const session = new AgentSession({ llm: 'gpt-4o' });
await session.start({ agent });