AgentsAgentBase

add_function_include

View as MarkdownOpen in Claude

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.

This maps to the SWML ai.swaig.includes array. See the SWML SWAIG includes reference for details.

Parameters

url
strRequired

URL of the remote SWAIG server that hosts the functions.

functions
list[str]Required

List of function names to include from the remote server.

meta_data
Optional[dict[str, Any]]

Optional metadata dictionary passed along with the function include. Can be used to provide authentication tokens or context to the remote server.

Returns

AgentBase — Returns self for method chaining.

Example

1from signalwire import AgentBase
2
3agent = AgentBase(name="assistant", route="/assistant")
4agent.set_prompt_text("You are a helpful assistant.")
5agent.add_function_include(
6 url="https://tools.example.com/swaig",
7 functions=["lookup_order", "cancel_order"],
8 meta_data={"auth_token": "secret-token"}
9)
10agent.serve()