Update the configuration of an existing agent. Uses optimistic concurrency control (OCC); the current version must be supplied in the request body.
Request headers
|
Header |
Required |
Description |
|
|
Yes |
|
|
|
Yes |
|
Path parameters
|
Parameter |
Type |
Required |
Description |
|
|
string |
Yes |
Unique agent identifier. |
Request body
|
Field |
Type |
Required |
Description |
|
|
integer |
Yes |
Current version number for OCC. Must match the server-side value. |
|
|
string |
No |
Agent name, 1-256 characters. |
|
|
string|object |
No |
Model identifier. |
|
|
string |
No |
System prompt. |
|
|
string |
No |
Agent description. |
|
|
array |
No |
Tool configuration list. |
|
|
array |
No |
MCP server configuration list. |
|
|
array |
No |
Skill bindings, in the form |
|
|
object |
No |
Custom metadata key-value pairs. |
|
|
string |
No |
Default runtime environment. |
Example request
curl -X PUT "https://api.qoder.com.cn/api/v1/cloud/agents/agent_019eXXXX..." \
-H "Authorization: Bearer $QODER_PAT" \
-H "Content-Type: application/json" \
-d '{
"name": "doc-test-agent-updated",
"model": "ultimate",
"instructions": "You are the updated documentation test assistant.",
"description": "Used for API documentation testing.",
"version": 1
}'
Example response
HTTP 200 OK
{
"type": "agent",
"id": "agent_019eXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"name": "doc-test-agent-updated",
"description": "Used for API documentation testing.",
"model": "ultimate",
"system": "You are the updated documentation test assistant.",
"instructions": "You are the updated documentation test assistant.",
"tools": [],
"mcp_servers": [],
"default_environment": "",
"version": 2,
"archived": false,
"archived_at": null,
"created_at": "2026-05-18T15:26:39.61669Z",
"updated_at": "2026-05-18T15:27:07.967138Z"
}
Optimistic concurrency control (OCC)
Update requests use the version number for optimistic locking:
-
The client first calls GET to obtain the agent's current
version. -
The client sends the update with that
versionin the request body. -
The server verifies that
versionmatches the current server-side value. -
If they match, the update succeeds and
versionis incremented by 1. -
If they do not match, the server returns 409 Conflict.
This prevents concurrent clients from overwriting each other's changes to the same agent.
Errors
|
HTTP |
Type |
Trigger |
|
400 |
|
Request body or field value is invalid. |
|
400 |
|
|
|
401 |
|
PAT is invalid or has expired. |
|
403 |
|
Caller is not authorized to update this agent. |
|
404 |
|
No agent exists with the given ID. |
|
409 |
|
|
Version conflict (409) response example:
{
"type": "error",
"error": {
"type": "conflict_error",
"message": "Version conflict. Expected version 99, got 1."
}
}
For the full error envelope, see Errors.
Notes
-
versionis required; omitting it causes the update to fail. -
versionis incremented on every successful update. -
Updates use partial-update (merge) semantics: optional fields not present in the request body keep their previous values, and only explicitly provided fields are updated.
-
Use List Agent versions to view historical versions.