Create an agent

Updated

Saves a reusable agent configuration in your project.

Preview documentation

You're reading the Conversational AI Platform (Preview) docs. Switch to Main.
POST
https://preview.ai.agora.io/conversational-ai/v1/projects/{appid}/agents

Use this endpoint to save an agent that you can then use to start sessions and campaigns. Only agent_name is required. If you omit greeting, the agent doesn't greet participants automatically.

Saving or updating an agent doesn't change sessions that are already running.

Keep provider keys in secrets

Set credential on each pipeline stage. With byok, pass your provider keys in credential.fields as $secrets.<set>.<key> references to a secret set. Most providers take one field, api_key. Agora checks that each reference exists when you create the agent. Keep credentials out of params.

Path Parameters

appidstring
Required

The App ID of your project.

Request Body

agent_namestring
Required

A name for the agent, 1 to 255 characters. It doesn't need to be unique.

instructionsstring

The system instructions that define how the agent behaves. The model receives them as the first system message, before messages.

messagesarray<object>

Messages that start the conversation history. They follow instructions.

variablesobject

Every variable the agent uses, keyed by variable name. A name starts with a lowercase letter and contains up to 64 lowercase letters, digits, and underscores. Reference a variable as {{variable_name}} in instructions, messages, greeting.text, pipeline.llm.failure_message, pipeline.silence_config.content, and generated filler instructions. The agent doesn't store values: pass them in values when you start a session, or in each campaign contact. Expansion is single-pass, so a value that contains a placeholder isn't expanded again.

greetingobject

The message the agent speaks when a participant joins. If you omit it, the agent doesn't greet participants automatically.

pipelineobject

The models that power the agent: separate ASR, LLM, and TTS stages. When you pass a pipeline, llm and tts are required.

filler_wordsobject

Short phrases the agent says while it waits for the LLM to respond, such as when it waits for a tool call.

Response Body

The agent was created. The response body contains the saved agent.

Response Headers

Agora-Request-Idstring

A unique ID for the request. Include it when you contact Agora support.

ETagstring

The current version of the resource. Pass this value in the If-Match header of your next update or delete request for this resource.

agent_idstring
Required

The ID of the agent, a UUID.

agent_namestring
Required

A name for the agent, 1 to 255 characters. It doesn't need to be unique.

instructionsstring

The system instructions that define how the agent behaves. The model receives them as the first system message, before messages.

messagesarray<object>

Messages that start the conversation history. They follow instructions.

variablesobject

Every variable the agent uses, keyed by variable name. A name starts with a lowercase letter and contains up to 64 lowercase letters, digits, and underscores. Reference a variable as {{variable_name}} in instructions, messages, greeting.text, pipeline.llm.failure_message, pipeline.silence_config.content, and generated filler instructions. The agent doesn't store values: pass them in values when you start a session, or in each campaign contact. Expansion is single-pass, so a value that contains a placeholder isn't expanded again.

greetingobject

The message the agent speaks when a participant joins. If you omit it, the agent doesn't greet participants automatically.

pipelineobject

The models that power the agent: separate ASR, LLM, and TTS stages. When you pass a pipeline, llm and tts are required.

filler_wordsobject

Short phrases the agent says while it waits for the LLM to respond, such as when it waits for a tool call.

create_tsinteger
Required

The time the agent was created, as a Unix timestamp in seconds.

update_tsinteger
Required

The time the agent was last updated, as a Unix timestamp in seconds.

Authorization

This endpoint requires authentication.

Request examples

Example Request
curl -X POST 'https://preview.ai.agora.io/conversational-ai/v1/projects/string/agents' \  -H 'Content-Type: application/json' \  -d '{  "agent_name": "Customer Support Agent",  "instructions": "You are a support agent for Acme. Address the caller as {{customer_name}}. Be concise.",  "variables": {    "customer_name": {      "type": "str",      "required": true    },    "resolution_status": {      "type": "str",      "options": [        "resolved",        "follow_up",        "unresolved"      ],      "extract": true,      "description": "Outcome of the conversation."    }  },  "pipeline": {    "mode": "cascaded",    "asr": {      "credential": {        "mode": "managed"      },      "vendor": "deepgram",      "model": "nova-3",      "language": "en-US"    },    "llm": {      "credential": {        "mode": "byok",        "fields": {          "api_key": "$secrets.support_prod.llm"        }      },      "vendor": "openai",      "style": "openai",      "model": "<model_name>",      "max_history": 12,      "failure_message": "I'\''m sorry, I couldn'\''t generate a response. Please try again."    },    "tts": {      "credential": {        "mode": "managed"      },      "vendor": "minimax",      "params": {        "model": "speech-2.6-turbo",        "voice_setting": {          "voice_id": "English_captivating_female1",          "speed": 1        }      }    },    "silence_config": {      "enabled": true,      "timeout_ms": 3000,      "action": "speak",      "content": "Hello, how can I help you?"    }  },  "greeting": {    "mode": "text",    "on": "each_join",    "delay_ms": 0,    "text": "Hi, thanks for calling Acme."  }}'

Response example

Example Response
{  "agent_id": "3f6c2a9e-8d1b-4e7a-9c55-0b2f7d1e4a10",  "agent_name": "Customer Support Agent",  "instructions": "You are a support agent for Acme. Address the caller as {{customer_name}}. Be concise.",  "variables": {    "customer_name": {      "type": "str",      "required": true    },    "resolution_status": {      "type": "str",      "options": [        "resolved",        "follow_up",        "unresolved"      ],      "extract": true,      "description": "Outcome of the conversation."    }  },  "pipeline": {    "mode": "cascaded",    "asr": {      "credential": {        "mode": "managed"      },      "vendor": "deepgram",      "model": "nova-3",      "language": "en-US"    },    "llm": {      "credential": {        "mode": "byok"      },      "vendor": "openai",      "style": "openai",      "model": "<model_name>",      "max_history": 12,      "failure_message": "I'm sorry, I couldn't generate a response. Please try again."    },    "tts": {      "credential": {        "mode": "managed"      },      "vendor": "minimax",      "params": {        "model": "speech-2.6-turbo",        "voice_setting": {          "voice_id": "English_captivating_female1",          "speed": 1        }      }    },    "silence_config": {      "enabled": true,      "timeout_ms": 3000,      "action": "speak",      "content": "Hello, how can I help you?"    }  },  "greeting": {    "mode": "text",    "on": "each_join",    "delay_ms": 0,    "text": "Hi, thanks for calling Acme."  },  "create_ts": 1786543331,  "update_ts": 1786543331}