***

title: addFunctionInclude
slug: /reference/typescript/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/typescript/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="string" required={true} toc={true}>
  URL of the remote SWAIG server that hosts the functions.
</ParamField>

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

<ParamField path="metaData" type={"Record<string, unknown>"} toc={true}>
  Optional metadata object 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 `this` for method chaining.

## **Example**

```typescript {5}
import { AgentBase } from '@signalwire/sdk';

const agent = new AgentBase({ name: 'assistant', route: '/assistant' });
agent.setPromptText('You are a helpful assistant.');
agent.addFunctionInclude(
  'https://tools.example.com/swaig',
  ['lookup_order', 'cancel_order'],
  { auth_token: 'secret-token' },
);
await agent.serve();
```