SWAIG
The SignalWire AI Gateway Interface. Allows you to create user-defined functions that can be executed during the dialogue.
Properties
ai.SWAIG
An object that accepts the following properties.
SWAIG.defaults
Default settings for all SWAIG functions. If defaults is not set, settings may be set in each function object. Default is not set.
defaults.web_hook_url
The default URL to send status callbacks and reports to for all SWAIG functions. If defaults is not set, web_hook_url may be set in each SWAIG function object. Authentication can also be set in the url in the format of username:password@url.
For what this URL receives and what it should return, see the tool webhook.
SWAIG.functions
An array of JSON objects to define functions that can be executed during the interaction with the AI. Default is not set. The fields of this object are the six following.
See functions for additional details.
SWAIG.includes
An array of objects to include remote function signatures. This allows you to include functions that are defined in a remote location.
See includes for additional details.
SWAIG.internal_fillers
An object that defines language-specific filler phrases for internal SWAIG functions. These fillers help break silence between responses and are played asynchronously during function execution. Each key is a function name, and each value is an object mapping language codes to arrays of filler phrases.
internal_fillers.check_time
Filler phrases played when the AI Agent is checking the time.
internal_fillers.wait_for_user
Filler phrases played when the AI Agent is waiting for user input.
internal_fillers.wait_seconds
Filler phrases played during deliberate pauses or wait periods.
internal_fillers.adjust_response_latency
Filler phrases played when the AI Agent is adjusting response timing.
internal_fillers.next_step
Filler phrases played when transitioning between conversation steps when utilizing prompt.contexts.
internal_fillers.change_context
Filler phrases played when switching between conversation contexts when utilizing prompt.contexts.
internal_fillers.get_visual_input
Filler phrases played when the AI Agent is processing visual input. Enabled when enable_vision is set to true in ai.params.
Leaving this out does not silence the agent: a built-in English set is used under en-US instead, so set this key to change the wording or to cover another language.
internal_fillers.get_ideal_strategy
Filler phrases played when the AI Agent is thinking or considering options. Enabled when enable_thinking is set to true in ai.params.
Leaving this out does not silence the agent: a built-in English set is used under en-US instead, so set this key to change the wording or to cover another language.
internal_fillers.pause_conversation
Filler phrases played when the AI Agent pauses the conversation at the caller’s request. Enabled when enable_pause is set to true in ai.params, which start_paused also turns on. Setting speak_when_spoken_to turns enable_pause back off, which leaves this key with nothing to play.
SWAIG.native_functions
Prebuilt functions the AI agent is able to call.
The agent is already aware of these functions and can use them creatively based on prompting.
For example, a prompt like “tell the user what time it is” will automatically use check_time.
Accepted values:
adjust_response_latency- Adjust how long the agent will wait for the user to stop talking.check_time- Returns the current time for the time zone set inai.local_tz.wait_for_user- Causes the AI to wait until the user speaks again. Use when the user asks to wait or hold on.wait_seconds- Waits for the given amount of time.
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.
Filler language codes
Several SWAIG properties accept filler phrases keyed by language code, including internal_fillers and per-function fillers. Every one of them resolves the same way: the agent looks for an entry matching the language being spoken, then auto, then default, and plays nothing when none of the three is set.
The codes below are the ones in common use, not a closed list. Under ai.multilingual the key is whichever code the engine reports for the turn, so any code it returns works. Under ai.languages the key has to match the code set on the entry.