ai
Creates an AI agent that conducts voice conversations using automatic speech recognition (ASR), large language models (LLMs), and text-to-speech (TTS) synthesis. The agent processes caller speech in real-time, generates contextually appropriate responses, and can execute custom functions to interact with external systems and databases through SignalWire AI Gateway (SWAIG).
Since the prompt configuration is central to AI agent behavior, it is recommended to read the Prompting Best Practices guide.
An object that defines an AI agent for conducting voice conversations. Accepts the ai parameters listed below to configure the agent's prompt, behavior, functions, language support, and other settings.
ai Parameters
Defines the AI agent's personality, goals, behaviors, and instructions for handling conversations. The prompt establishes how the agent should interact with callers, what information it should gather, and how it should respond to various scenarios.
It is recommended to write prompts using markdown formatting as LLMs better understand structured content. Additionally it is recommended to read the Prompting Best Practices guide.
A key-value object for storing data that persists throughout the AI session.
Can be set initially in the SWML script or modified during the conversation using the set_global_data action.
The global_data object is accessible everywhere in the AI session: prompts, AI parameters,
and SWML returned from SWAIG functions.
Access properties using template strings (e.g ${global_data.property_name})
Hints help the AI agent understand certain words or phrases better. Words that can commonly be misinterpreted can be added to the hints to help the AI speak more accurately.
See hints for more details.
An array of JSON objects defining supported languages in the conversation.
See languages for more details.
A JSON object containing parameters as key-value pairs.
See params for more details.
The final set of instructions and configuration settings to send to the agent.
See post_prompt for more details.
The URL to which to send status callbacks and reports. Authentication can also be set in the url in the format of username:password@url.
See post_prompt_url for more details.
An array of JSON objects to clarify the AI's pronunciation of words or expressions.
See pronounce for more details.
An array of JSON objects to create user-defined functions/endpoints that can be executed during the dialogue.
See SWAIG for more details.
Example
Minimal AI agent configuration:
- YAML
- JSON
version: 1.0.0
sections:
main:
- answer: {}
- ai:
prompt:
text: "You are a customer service agent. Answer questions about account status and billing."
{
"version": "1.0.0",
"sections": {
"main": [
{
"answer": {}
},
{
"ai": {
"prompt": {
"text": "You are a customer service agent. Answer questions about account status and billing."
}
}
}
]
}
}