For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
ReferenceGuides
ReferenceGuides
  • Core
    • Introduction to SWML
    • Expressions
    • Template functions
    • Variables
    • Errors
  • Calling
    • Overview
    • ai
    • ai_sidecar
      • params
      • prompt
      • SWAIG
    • amazon_bedrock
    • answer
    • cond
    • connect
    • denoise
    • detect_machine
    • enter_queue
    • execute
    • goto
    • hangup
    • join_conference
    • join_room
    • label
    • live_transcribe
    • live_translate
    • pay
    • play
    • prompt
    • receive_fax
    • record
    • record_call
    • request
    • return
    • send_digits
    • send_fax
    • send_sms
    • set
    • sip_refer
    • sleep
    • stop_denoise
    • stop_record_call
    • stop_tap
    • switch
    • tap
    • transcribe
    • transcribe_stop
    • transfer
    • unset
    • user_event
  • Messaging
    • Overview
    • execute
    • goto
    • label
    • receive
    • reply
    • request
    • return
    • switch
    • transfer
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Properties
  • Examples
Callingai_sidecar

SWAIG

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

amazon_bedrock

Next
Built with

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
object

An object that defines the functions and MCP servers available to the sidecar.

SWAIG.defaults
object

Default settings applied to every function that does not override them.

defaults.web_hook_url
string

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
string

Default basic-auth username for the function webhook.

defaults.web_hook_auth_password
string

Default basic-auth password for the function webhook.

SWAIG.functions
object[]

An array of functions the model can call during the conversation.

functions[].function
stringRequired

The name of the function. This is the only required field — the model calls the function by this name.

functions[].description
string

A description of what the function does, sent to the model so it knows when to call it.

functions[].purpose
string

A fallback for description, used only when description is not set.

functions[].parameters
object

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
string

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
string

Basic-auth username for this function’s webhook. Falls back to defaults.web_hook_auth_user.

functions[].web_hook_auth_password
string

Basic-auth password for this function’s webhook. Falls back to defaults.web_hook_auth_password.

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
stringRequired

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
booleanDefaults to 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.

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.

Examples

1ai_sidecar:
2 prompt: "Coach the agent."
3 lang: "en-US"
4 SWAIG:
5 defaults:
6 web_hook_url: "https://your-app.example.com/sidecar/swaig"
7 functions:
8 - function: lookup_competitor
9 description: "Look up a competitor by name."
10 parameters:
11 type: object
12 properties:
13 competitor:
14 type: string
15 description: "Competitor name."
16 required:
17 - competitor
18 mcp_servers:
19 - url: "https://crm.example.com/mcp"
20 headers:
21 Authorization: "Bearer ${global_data.crm_token}"
22 resources: true
23 resource_vars:
24 customer_id: "${global_data.customer_id}"