> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # SWAIG > The SignalWire AI Gateway Interface. Allows you to create user-defined functions that can be executed during the dialogue. The SignalWire AI Gateway Interface. Allows you to create user-defined functions that can be executed during the dialogue. ## **Properties** **`ai.SWAIG`** `object` An object that accepts the following properties. --- **`SWAIG.defaults`** `object` 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`** `string` 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](/docs/swml/reference/calling/ai/swaig/functions) object. Authentication can also be set in the url in the format of `username:password@url`. Credentials embedded in the URL take precedence over `web_hook_auth_user` and `web_hook_auth_password`. For what this URL receives and what it should return, see the [tool webhook](/docs/swml/reference/calling/ai/swaig/functions#tool-webhook). --- **`defaults.web_hook_auth_user`** `string` The default username for basic auth on the function webhook, for functions that don't set their own `web_hook_auth_user`. --- **`defaults.web_hook_auth_password`** `string` The default password for basic auth on the function webhook, for functions that don't set their own `web_hook_auth_password`. --- **`defaults.meta_data`** `object` Metadata shared by every SWAIG function. A function's own [`meta_data`](/docs/swml/reference/calling/ai/swaig/functions) is merged over this, so a key set in both places takes the function's value. --- **`defaults.meta_data_token`** `string` The default scoping token for `meta_data`, for functions that don't set their own `meta_data_token`. --- **`SWAIG.functions`** `object[]` 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`](/docs/swml/reference/calling/ai/swaig/functions) for additional details. --- **`SWAIG.includes`** `object[]` An array of objects to include remote function signatures. This allows you to include functions that are defined in a remote location. See [`includes`](/docs/swml/reference/calling/ai/swaig/includes) for additional details. --- **`SWAIG.internal_fillers`** `object` 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](/docs/swml/reference/calling/ai/swaig#filler-language-codes) to arrays of filler phrases. --- **`internal_fillers.check_time`** `object` Filler phrases played when the AI Agent is checking the time. --- **`internal_fillers.wait_for_user`** `object` Filler phrases played when the AI Agent is waiting for user input. --- **`internal_fillers.wait_seconds`** `object` Filler phrases played during deliberate pauses or wait periods. --- **`internal_fillers.adjust_response_latency`** `object` Filler phrases played when the AI Agent is adjusting response timing. --- **`internal_fillers.next_step`** `object` Filler phrases played when transitioning between conversation steps when utilizing [`prompt.contexts`](/docs/swml/reference/calling/ai/prompt). --- **`internal_fillers.change_context`** `object` Filler phrases played when switching between conversation contexts when utilizing [`prompt.contexts`](/docs/swml/reference/calling/ai/prompt). --- **`internal_fillers.get_visual_input`** `object` Filler phrases played when the AI Agent is processing visual input. Enabled when `enable_vision` is set to `true` in [`ai.params`](/docs/swml/reference/calling/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`** `object` Filler phrases played when the AI Agent is thinking or considering options. Enabled when `enable_thinking` is set to `true` in [`ai.params`](/docs/swml/reference/calling/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`** `object` 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`](/docs/swml/reference/calling/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`** `string[]` 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 in `ai.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`** `object[]` 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`** `string` — required The MCP server URL. --- **`mcp_servers[].headers`** `object` 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`** `boolean` — default: false Whether to fetch the server's resources into `global_data`, when the server advertises resource support. --- **`mcp_servers[].resource_vars`** `object` 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`](#internal_fillers) and per-function [`fillers`](/docs/swml/reference/calling/ai/swaig/functions#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`](/docs/swml/reference/calling/ai/multilingual) the key is whichever code the engine reports for the turn, so any code it returns works. Under [`ai.languages`](/docs/swml/reference/calling/ai/languages) the key has to match the `code` set on the entry. | Code | Description | | :-------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------- | | `auto` | Not a language: the phrases are translated into whichever language is being spoken. Takes precedence over `default` | | `default` | Not a language: the phrases play when no other entry matches the language being spoken | | `bg` | Bulgarian | | `ca` | Catalan | | `cs` | Czech | | `da` | Danish | | `da-DK` | Danish (Denmark) | | `de` | German | | `de-CH` | German (Switzerland) | | `el` | Greek | | `en` | English | | `en-AU` | English (Australia) | | `en-GB` | English (United Kingdom) | | `en-IN` | English (India) | | `en-NZ` | English (New Zealand) | | `en-US` | English (United States) | | `es` | Spanish | | `es-419` | Spanish (Latin America) | | `et` | Estonian | | `fi` | Finnish | | `fr` | French | | `fr-CA` | French (Canada) | | `hi` | Hindi | | `hu` | Hungarian | | `id` | Indonesian | | `it` | Italian | | `ja` | Japanese | | `ko` | Korean | | `ko-KR` | Korean (South Korea) | | `lt` | Lithuanian | | `lv` | Latvian | | `ms` | Malay | | `multi` | Code-switching: the speech recognition engine detects and transcribes whichever of its supported languages the caller speaks, rather than one fixed language | | `nl` | Dutch | | `nl-BE` | Flemish (Belgian Dutch) | | `no` | Norwegian | | `pl` | Polish | | `pt` | Portuguese | | `pt-BR` | Portuguese (Brazil) | | `pt-PT` | Portuguese (Portugal) | | `ro` | Romanian | | `ru` | Russian | | `sk` | Slovak | | `sv` | Swedish | | `sv-SE` | Swedish (Sweden) | | `th` | Thai | | `th-TH` | Thai (Thailand) | | `tr` | Turkish | | `uk` | Ukrainian | | `vi` | Vietnamese | | `zh` | Chinese (Simplified) | | `zh-CN` | Chinese (Simplified, China) | | `zh-Hans` | Chinese (Simplified Han) | | `zh-Hant` | Chinese (Traditional Han) | | `zh-HK` | Chinese (Traditional, Hong Kong) | | `zh-TW` | Chinese (Traditional, Taiwan) | ## **Examples** ### internal\_fillers #### YAML ```yaml SWAIG: internal_fillers: change_context: en-US: - 'Let me switch gears.' - 'One moment.' es: - 'Voy a cambiar de tema.' - 'Un momento.' check_time: default: - 'Let me check the time.' - 'One moment while I get the time.' - 'Just checking the current time.' ``` #### JSON ```json { "SWAIG": { "internal_fillers": { "change_context": { "en-US": [ "Let me switch gears.", "One moment." ], "es": [ "Voy a cambiar de tema.", "Un momento." ] }, "check_time": { "default": [ "Let me check the time.", "One moment while I get the time.", "Just checking the current time." ] } } } } ``` ### mcp\_servers #### YAML ```yaml SWAIG: mcp_servers: - url: "https://crm.example.com/mcp" headers: Authorization: "Bearer ${global_data.crm_token}" resources: true resource_vars: customer_id: "${global_data.customer_id}" ``` #### JSON ```json { "SWAIG": { "mcp_servers": [ { "url": "https://crm.example.com/mcp", "headers": { "Authorization": "Bearer ${global_data.crm_token}" }, "resources": true, "resource_vars": { "customer_id": "${global_data.customer_id}" } } ] } } ``` > The SignalWire AI Gateway Interface. Allows you to create user-defined functions that can be executed during the dialogue. ## Docs - [functions](https://signalwire.com/docs/swml/reference/calling/ai/swaig/functions.md): Functions that can be executed during the interaction with the AI. - [data_map](https://signalwire.com/docs/swml/reference/calling/ai/swaig/functions/data-map.md): Defines how a SWAIG function should process and respond to the user's input data. - [parameters](https://signalwire.com/docs/swml/reference/calling/ai/swaig/functions/parameters.md): The parameters object for the SWAIG function. - [includes](https://signalwire.com/docs/swml/reference/calling/ai/swaig/includes.md): Remote function signatures to include in SWAIG functions.