Update agent¶
Partially updates agent metadata and configuration. Submit only the fields that need to be modified; return the updated complete agent object.
PATCH https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agents/{agent_id}
Preparation before calling¶
First query the agent list to obtain the agent ID. Prepare the personal access token, target workspace ID, and agent ID that have access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$AGENT_ID: Agent ID to update.
Request example¶
curl -X PATCH "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/agents/$AGENT_ID" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "区域销售助手"
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The current workspace ID. |
|
string |
Yes |
The agent ID to update. |
Query parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
ID of the workspace to which the agent belongs. If not provided, the current workspace is used; only the current workspace or the system workspace can be specified. Agents in the system workspace cannot be updated. |
Request body¶
The request body must be a JSON object. All fields are optional; fields not provided remain unchanged.
Field |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
Agent name and description. |
|
string |
No |
Agent name and description. |
|
string |
No |
Display metadata. |
|
string |
No |
Display metadata. |
|
string[] |
No |
Display metadata. |
|
string |
No |
Display metadata. |
|
integer |
No |
Display metadata. |
|
object |
No |
Command configuration, which can include |
|
object |
No |
Run target containing |
|
object |
No |
Model configuration, can contain |
|
object |
No |
Resource binding, which can include tools, skills, knowledge base references, and channel bindings. |
|
object |
No |
Policy and workflow reference. |
|
object |
No |
Policy and workflow reference. |
|
string |
No |
Agent state. |
|
object |
No |
Extended tags, comments, and metadata. |
|
object |
No |
Extended tags, comments, and metadata. |
|
object |
No |
Extended tags, comments, and metadata. |
|
string |
No |
Source type and source reference. |
|
string |
No |
Source type and source reference. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Successful response¶
Returns 200 on success. data is the updated complete metadata of the agent.
{
"code": 0,
"data": {
"id": "agent_01",
"workspace_id": "ws_01",
"name": "区域销售助手",
"status": "active",
"version": 2,
"updated_at": "2026-01-02T15:04:05Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Agent ID and workspace ID. |
|
string |
Agent ID and workspace ID. |
|
string |
The updated name and status. |
|
string |
The updated name and status. |
|
integer |
Updated agent resource version. |
|
string |
Last updated time, using RFC 3339 format. |
Other fields of |
object |
Are consistent with the complete metadata fields returned by Query agent details. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Error response¶
{
"code": 2,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body is not valid JSON, the field value is invalid, or the specified model, resource, or policy reference cannot be used. |
Check request fields and referenced resources. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current caller does not have permission to update the agent. |
Check the agent authorization in the workspace. |
|
|
Specified a read-only agent in the system workspace via |
Only updates agents in the current workspace. |
|
|
The agent does not exist within the specified workspace. |
Check the agent ID and the workspace it belongs to. |
|
|
The agent resource service or its authorized dependencies are temporarily unavailable. |
Try again later. |
Follow-up operations¶
Use the same resource identifier Query agent details to confirm the update result.