***

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

Swap in a new [`Agent`][agent] mid-session.
The new agent's instructions and tools replace the previous agent's configuration
on the underlying SignalWire platform.

## **Parameters**

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

## **Returns**

`None`

## **Example**

```python {22}
from signalwire.livewire import Agent, AgentSession, AgentServer, JobContext, function_tool, run_app

@function_tool
def check_balance(account_id: str) -> str:
    """Check an account balance."""
    return f"Account {account_id} has $142.50."

@function_tool
def transfer_funds(from_acct: str, to_acct: str, amount: float) -> str:
    """Transfer funds between accounts."""
    return f"Transferred ${amount} from {from_acct} to {to_acct}."

server = AgentServer()

@server.rtc_session()
async def entrypoint(ctx: JobContext):
    await ctx.connect()
    basic_agent = Agent(instructions="You help check balances.", tools=[check_balance])
    session = AgentSession()
    await session.start(basic_agent, room=ctx.room)
    advanced_agent = Agent(instructions="You handle transfers.", tools=[transfer_funds])
    session.update_agent(advanced_agent)

run_app(server)
```