***

title: updateAgent
slug: /reference/typescript/agents/livewire/agent-session/update-agent
description: Swap in a new Agent mid-session.
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

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

## **Signature**

```typescript {1}
updateAgent(agent: Agent<UserData>): void
```

## **Parameters**

<ParamField path="agent" type="Agent" required={true} toc={true}>
  The new [`Agent`][agent] to bind to this session.
</ParamField>

## **Returns**

`void`

## **Example**

```typescript {7}
import { Agent } from '@signalwire/sdk/livewire';

const billingAgent = new Agent({
  instructions: 'You are now a billing specialist. Help the user with invoices and payments.',
});

session.updateAgent(billingAgent);
```