Skip to content

Update an agent

POST /v1/agents/{agent_id}

Updates an agent. Fields you leave out keep their values.

The API applies the same checks as an edit in the Context app. You must be allowed to edit the agent, and the key’s Agent scope, if it has one, must include the agent. tools and skills replace the whole list when you send them. Every agent has one version, 1: an update changes the agent in place and does not check for edits made since you read it, so the last update wins.

If part of an update is saved and a later part is refused, the error message names the saved fields. Get the agent before you retry.

The key must be a personal key with the agents:write capability. For what each capability allows, see Keys.

Path parameters

NameTypeRequiredDefaultDescription
agent_idstringYesThe ID of the agent to update.

Body

NameTypeRequiredDefaultDescription
namestringNoThe agent’s name. Must be between 1 and 100 characters after leading and trailing spaces are trimmed.
descriptionstring | nullNoThe agent’s purpose. null clears it.
systemstring | nullNoThe agent’s instructions. null clears them.
modelstring | objectNoA model ID your deployment runs, or the object form {id}. default removes the agent’s own model, so it uses your deployment’s default.
toolsarray<object> | nullNoThe agent’s built-in tool settings, in the same shape as on Create an agent. Replaces the whole list. null or [] turns every built-in tool off.
skillsarray<object> | nullNoThe agent’s skills, in the same shape as on Create an agent. Replaces the whole list. null or [] removes them.
versionintegerNoThe agent’s version. Must be 1. Any other value returns 400.

Response

Returns 200 with the agent object. For every field, see Agents.

{
"id": "6f1c2a9e-0d4b-4c57-9a3e-2b7d8e1f4c60",
"archived_at": null,
"created_at": "2026-10-21T01:35:05.337Z",
"description": "Answers questions about the sales pipeline",
"execution_identity": {
"type": "service_account"
},
"mcp_servers": [],
"metadata": {},
"model": {
"id": "default"
},
"multiagent": null,
"name": "Research Assistant",
"skills": [
{
"type": "anthropic",
"skill_id": "xlsx",
"version": "latest"
}
],
"system": "Answer in one paragraph.",
"tools": [
{
"type": "agent_toolset_20260401",
"default_config": {
"enabled": true,
"permission_policy": {
"type": "always_ask"
}
},
"configs": [
{
"type": "bash",
"name": "bash",
"enabled": true,
"permission_policy": {
"type": "always_ask"
}
},
{
"type": "edit",
"name": "edit",
"enabled": true,
"permission_policy": {
"type": "always_ask"
}
},
{
"type": "read",
"name": "read",
"enabled": true,
"permission_policy": {
"type": "always_allow"
}
},
{
"type": "write",
"name": "write",
"enabled": true,
"permission_policy": {
"type": "always_ask"
}
},
{
"type": "glob",
"name": "glob",
"enabled": true,
"permission_policy": {
"type": "always_allow"
}
},
{
"type": "grep",
"name": "grep",
"enabled": true,
"permission_policy": {
"type": "always_allow"
}
},
{
"type": "web_fetch",
"name": "web_fetch",
"enabled": true,
"permission_policy": {
"type": "always_ask"
},
"url_sources": null
},
{
"type": "web_search",
"name": "web_search",
"enabled": false,
"permission_policy": {
"type": "always_ask"
}
}
]
}
],
"type": "agent",
"updated_at": "2026-10-21T02:10:44.918Z",
"version": 1
}

Errors

This endpoint can return these errors as well as the common errors.

Statuserror.typeCause and fix
400invalid_request_errorversion is not 1. Omit it or send 1.
400invalid_request_errormetadata is not empty. Omit it or send {}. To change an agent’s workspace, use the Context app.
400invalid_request_errorA field breaks a rule of Create an agent, such as an unknown model or a custom tool. Fix the field as the matching row there describes.
400invalid_request_errorThe agent’s permission mode is read-only, or its permissions are a hand-written permission block, so its tools can’t be changed here. Choose another permission mode for the agent in the app first.
400invalid_request_errorThe tool settings you sent conflict with the agent’s permission mode or with permission rules set in the app. Change those settings in the app, or send tool settings that match them.
403permission_errorThis key lacks agents:write, is not a personal key, or its Agent scope doesn’t include this agent. Use a personal key with agents:write whose Agent scope, if any, includes this agent.
403permission_errorYou are not allowed to edit this agent. Ask its owner for access.
403permission_errorA custom skill isn’t shared with the agent, and the API can’t share it for you. Name skills you own, or move the agent to the skill’s workspace in the app.
404not_found_errorNo agent in this key’s organization has this ID, or a custom skill you sent doesn’t exist or isn’t visible to the key’s owner. Check the IDs.

Example

cURL
curl -sS "$CONTEXT_BASE_URL/v1/agents/6f1c2a9e-0d4b-4c57-9a3e-2b7d8e1f4c60" -H "x-api-key: $CONTEXT_API_KEY" \
-H "content-type: application/json" -d '{"system": "Answer in one paragraph."}'
Python
agent = client.beta.agents.update("6f1c2a9e-0d4b-4c57-9a3e-2b7d8e1f4c60", system="Answer in one paragraph.")
TypeScript
const agent = await client.beta.agents.update("6f1c2a9e-0d4b-4c57-9a3e-2b7d8e1f4c60", { system: "Answer in one paragraph." })