create

View as MarkdownOpen in Claude

Create a new AI agent resource.

Request

promptobjectRequired
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. See [`ai.prompt` in the SWML reference](/docs/swml/reference/calling/ai#aiprompt).
namestringRequired
Name of the AI Agent.
hintslist of stringsOptional
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 [`ai.hints` in the SWML reference](/docs/swml/reference/calling/ai#aihints).
languageslist of objectsOptional
An array of JSON objects defining supported languages in the conversation. Mutually exclusive with `multilingual`: if both are set, `multilingual` is used and this array is ignored. See [`ai.languages` in the SWML reference](/docs/swml/reference/calling/ai#ailanguages).
paramsobjectOptional
A JSON object containing parameters as key-value pairs. See [`ai.params` in the SWML reference](/docs/swml/reference/calling/ai#aiparams).
post_promptobjectOptional
The final set of instructions and configuration settings to send to the agent. See [`ai.post_prompt` in the SWML reference](/docs/swml/reference/calling/ai#aipost_prompt).
pronouncelist of objectsOptional
An array of JSON objects to clarify the AI's pronunciation of words or expressions. See [`ai.pronounce` in the SWML reference](/docs/swml/reference/calling/ai#aipronounce).
SWAIGobjectOptional
An array of JSON objects to create user-defined functions/endpoints that can be executed during the dialogue. See [`ai.SWAIG` in the SWML reference](/docs/swml/reference/calling/ai#aiswaig).

Response

idstringRequiredformat: "uuid"
Unique ID of the AIAgent.
project_idstringRequiredformat: "uuid"
Unique ID of the Project.
display_namestringRequired
Display name of the AIAgent Fabric Resource
typeenumRequired
Type of the Fabric Resource
created_atdatetimeRequired
Date and time when the resource was created.
updated_atdatetimeRequired
Date and time when the resource was updated.
ai_agentobjectRequired
AIAgent data.

Response Example

Response
1{
2 "id": "993ed018-9e79-4e50-b97b-984bd5534095",
3 "project_id": "1313fe58-5e14-4c11-bbe7-6fdfa11fe780",
4 "display_name": "Support Assistant",
5 "type": "ai_agent",
6 "created_at": "2024-05-06T12:20:00Z",
7 "updated_at": "2024-05-06T12:25:00Z",
8 "ai_agent": {
9 "prompt": {
10 "text": "You are a helpful customer support assistant."
11 },
12 "agent_id": "a87db7ed-8ebe-42e4-829f-8ba5a4152f54",
13 "name": "Support Assistant"
14 }
15}

Example

1import { RestClient } from "@signalwire/sdk";
2
3const client = new RestClient({
4 project: "your-project-id",
5 token: "your-api-token",
6 host: "your-space.signalwire.com",
7});
8
9const result = await client.fabric.aiAgents.create({
10 name: "support-bot",
11 agent_id: "support-bot-001",
12 prompt: { text: "You are a helpful support agent." },
13});
14console.log(`Created: ${result.id}`);