Update an agent

Updated

Changes the configuration of a saved agent.

Preview documentation

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

The request body is a JSON merge patch. Send only the fields you want to change. Nested objects merge field by field, arrays replace the saved value, and null removes a field. Variable definitions merge field by field too: to drop a saved options, extract, or description, set it to null.

The update applies to sessions that start afterward. Running sessions keep the configuration they started with. To change a running session, use Update a session.

Path Parameters

appidstring
Required

The App ID of your project.

agent_idstring
Required

The ID of the agent, returned in agent_id when you create the agent.

Header Parameters

If-Matchstring
Required

The ETag value from the most recent response for this resource. If the resource has changed since then, the request fails with 412 and reason PreconditionFailed. Retrieve the resource, apply your change again, and retry with the new ETag.

Request Body

The fields to change, as a JSON merge patch. Fields you omit keep their saved values.

agent_namestring

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

Changes to the variables, keyed by variable name. Each definition you pass merges into the saved definition field by field, so set a field such as options to null to remove it. Set a variable to null to remove the variable.

greetingobject

Changes to the greeting. Pass any of the greeting fields of Create an agent. Set it to null to remove the greeting.

pipelineobject

Changes to the pipeline. Pass any of the pipeline fields of Create an agent. Nested objects merge field by field.

filler_wordsobject

Changes to the filler words. Pass any of the filler_words fields of Create an agent.

Response Body

The agent was updated. The response body contains the full 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 PATCH 'https://preview.ai.agora.io/conversational-ai/v1/projects/string/agents/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'If-Match: string' \  -H 'Content-Type: application/json' \  -d '{  "instructions": "You are a support agent for Acme. Address the caller as {{customer_name}}. Be concise and polite.",  "variables": {    "follow_up_date": null  }}'

Response example

Example Response
{  "agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",  "agent_name": "string",  "instructions": "string",  "messages": [    {      "role": "system",      "content": "string"    }  ],  "variables": {    "property1": {      "type": "str",      "required": false,      "options": [        "string"      ],      "extract": false,      "description": "string"    },    "property2": {      "type": "str",      "required": false,      "options": [        "string"      ],      "extract": false,      "description": "string"    }  },  "greeting": {    "mode": "text",    "on": "each_join",    "delay_ms": 0,    "text": "string"  },  "pipeline": {    "mode": "cascaded",    "asr": {      "credential": {        "mode": "managed"      },      "vendor": "string",      "model": "string",      "language": "string",      "url": "string",      "params": {}    },    "llm": {      "credential": {        "mode": "managed"      },      "vendor": "string",      "style": "string",      "model": "string",      "url": "string",      "headers": {        "property1": "string",        "property2": "string"      },      "params": {},      "input_modalities": [        "string"      ],      "output_modalities": [        "string"      ],      "max_history": 32,      "failure_message": "string",      "tools": [        {          "type": "function",          "name": "string",          "description": "string",          "parameters": {},          "execution": {            "mode": "sync"          },          "server": {            "method": "GET",            "url": "string",            "headers": {              "property1": "string",              "property2": "string"            },            "body": {},            "timeout_ms": 10000          }        }      ],      "mcp_servers": [        {          "name": "string",          "endpoint": "string",          "transport": "streamable_http",          "headers": {            "property1": "string",            "property2": "string"          },          "allowed_tools": [            "string"          ],          "timeout_ms": 1000        }      ]    },    "tts": {      "credential": {        "mode": "managed"      },      "vendor": "string",      "model": "string",      "url": "string",      "headers": {        "property1": "string",        "property2": "string"      },      "params": {},      "skip_patterns": [        "fullwidth_parentheses"      ]    },    "turn_detection": {      "speech_threshold": 0.5,      "start_of_speech": {        "type": "semantic",        "speaking_interrupt_duration_ms": 160      },      "end_of_speech": {        "type": "semantic",        "silence_duration_ms": 320,        "max_wait_ms": 3000,        "pause_state_enabled": true      },      "interruption": {        "mode": "start_of_speech"      }    },    "silence_config": {      "enabled": true,      "timeout_ms": 0,      "action": "speak",      "content": "string"    },    "avatar": {      "enabled": false,      "credential": {        "mode": "managed"      },      "vendor": "akool",      "params": {}    }  },  "filler_words": {    "enable": false,    "trigger": {      "mode": "fixed_time",      "response_wait_ms": 100    },    "content": {      "mode": "static",      "phrases": [        "string"      ],      "selection_rule": "shuffle"    }  },  "create_ts": 0,  "update_ts": 0}