SWAIG
SWAIG (SignalWire AI Gateway) is SignalWire’s function-calling system for AI. It lets the sidecar’s model call functions that you define and run on your own server, so it can do more than just talk.
While the sidecar watches the call, the model can call a function whenever it needs to look something up or take an action — look up an account, flag a sales signal, update the agent’s screen, and so on. When it does, the sidecar sends a request to that function’s webhook (web_hook_url), your server runs the function and returns a result, and the model uses that result in its next response.
You define these functions under functions. You can also connect external MCP (Model Context Protocol) servers under mcp_servers, and their tools become available to the model the same way.
Properties
ai_sidecar.SWAIG
An object that defines the functions and MCP servers available to the sidecar.
SWAIG.defaults
Default settings applied to every function that does not override them.
defaults.web_hook_url
Default webhook URL for functions without their own web_hook_url. Basic auth can be embedded as username:password@url.
defaults.web_hook_auth_user
Default basic-auth username for the function webhook.
defaults.web_hook_auth_password
Default basic-auth password for the function webhook.
SWAIG.functions
An array of functions the model can call during the conversation.
functions[].function
The name of the function. This is the only required field — the model calls the function by this name.
functions[].description
A description of what the function does, sent to the model so it knows when to call it.
functions[].purpose
A fallback for description, used only when description is not set.
functions[].parameters
The JSON-Schema object describing the function’s arguments: type: object with a properties map and an optional required array. Each property allows only type, description, enum, and default — additional validation keywords such as pattern, minimum, and maximum are not accepted; express those constraints in the property description and validate them server-side. When omitted, the function takes no arguments.
functions[].web_hook_url
Webhook URL for this function. Falls back to defaults.web_hook_url. Basic auth can be embedded as username:password@url.
functions[].web_hook_auth_user
Basic-auth username for this function’s webhook. Falls back to defaults.web_hook_auth_user.
functions[].web_hook_auth_password
Basic-auth password for this function’s webhook. Falls back to defaults.web_hook_auth_password.
SWAIG.mcp_servers
An array of MCP (Model Context Protocol) servers whose tools and resources are made available to the AI. Each server’s tools are discovered at startup and registered as callable functions, so they can be invoked like any other SWAIG function.
mcp_servers[].url
The MCP server URL.
mcp_servers[].headers
HTTP headers sent to the MCP server. Authorization tokens go here — there is no separate auth field. Header values support variable expansion (e.g. Bearer ${global_data.token}).
mcp_servers[].resources
Whether to fetch the server’s resources into global_data, when the server advertises resource support.
mcp_servers[].resource_vars
Template variables passed to the MCP server when fetching resources. Used only when resources is enabled.
The function name sidecar_skip is reserved. It is auto-registered as a built-in tool — do not declare a function with that name. See Built-in sidecar_skip tool.