updateAgent

View as MarkdownOpen in Claude

Swap in a new Agent mid-session. The new agent’s instructions replace the previous agent’s prompt on the underlying SignalWire AgentBase.

Signature

1updateAgent(agent: Agent<UserData>): void

Parameters

agent
AgentRequired

The new Agent to bind to this session.

Returns

void

Example

1import { Agent } from '@signalwire/sdk/livewire';
2
3const billingAgent = new Agent({
4 instructions: 'You are now a billing specialist. Help the user with invoices and payments.',
5});
6
7session.updateAgent(billingAgent);