***

title: swml_change_context
slug: /reference/python/agents/function-result/swml-change-context
description: Switch to a different conversation context.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

[contextbuilder]: /docs/server-sdks/reference/python/agents/context-builder

[functionresult]: /docs/server-sdks/reference/python/agents/function-result

Switch to a different conversation context. Contexts represent distinct
operational modes (e.g., "sales", "support", "billing"), each with their own
prompts, tools, and steps defined via
[`ContextBuilder`][contextbuilder].

## **Parameters**

<ParamField path="context_name" type="str" required={true} toc={true}>
  Name of the context to switch to.
</ParamField>

## **Returns**

[`FunctionResult`][functionresult] — self, for chaining.

## **Example**

```python {11}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="switch_to_billing", description="Switch to the billing context")
def switch_to_billing(args, raw_data):
    return (
        FunctionResult("Let me connect you with billing.")
        .swml_change_context("billing")
    )

agent.serve()
```