***

title: add_function_include
slug: /reference/python/agents/agent-base/add-function-include
description: Add a remote function include to the SWAIG configuration.
max-toc-depth: 3
---------------------

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

[ai-swaig-includes]: /docs/swml/reference/ai/swaig/includes

[swml-swaig-includes-reference]: /docs/swml/reference/ai/swaig/includes

[ref-agentbase]: /docs/server-sdks/reference/python/agents/agent-base

Add a remote SWAIG function include so the agent can call tools hosted on an external
server. The remote endpoint is contacted at session start and the listed functions
become available to the AI just like locally defined tools.

<Info>
  This maps to the SWML [`ai.swaig.includes`][ai-swaig-includes] array.
  See the [SWML SWAIG includes reference][swml-swaig-includes-reference] for details.
</Info>

## **Parameters**

<ParamField path="url" type="str" required={true} toc={true}>
  URL of the remote SWAIG server that hosts the functions.
</ParamField>

<ParamField path="functions" type="list[str]" required={true} toc={true}>
  List of function names to include from the remote server.
</ParamField>

<ParamField path="meta_data" type="Optional[dict[str, Any]]" toc={true}>
  Optional metadata dictionary passed along with the function include. Can be used
  to provide authentication tokens or context to the remote server.
</ParamField>

## **Returns**

[`AgentBase`][ref-agentbase] -- Returns self for method chaining.

## **Example**

```python {5}
from signalwire import AgentBase

agent = AgentBase(name="assistant", route="/assistant")
agent.set_prompt_text("You are a helpful assistant.")
agent.add_function_include(
    url="https://tools.example.com/swaig",
    functions=["lookup_order", "cancel_order"],
    meta_data={"auth_token": "secret-token"}
)
agent.serve()
```