***

title: toggle_functions
slug: /reference/python/agents/function-result/toggle-functions
description: Enable or disable specific SWAIG functions at runtime.
max-toc-depth: 3
---------------------

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

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

Enable or disable specific SWAIG functions at runtime. This lets you control
which tools are available to the AI at different points in the conversation
(e.g., enabling payment functions only after identity verification).

## **Parameters**

<ParamField path="function_toggles" type="list[dict[str, Any]]" required={true} toc={true}>
  List of toggle objects. Each object must contain:

  * `"function"` — name of the SWAIG function to toggle
  * `"active"` — `True` to enable, `False` to disable
</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="enable_payment_functions", description="Enable payment tools")
def enable_payment_functions(args, raw_data):
    return (
        FunctionResult("Payment functions are now available.")
        .toggle_functions([
            {"function": "collect_payment", "active": True},
            {"function": "refund_payment", "active": True},
            {"function": "check_balance", "active": False}
        ])
    )

agent.serve()
```