Changes an agent in place.
Changes an agent in place. Every field is optional; a field the request omits keeps its stored value.
PATCH /v1/agents/{ref}
| Address | https://api.hanzo.ai/v1/agents/{ref} |
| Method | PATCH |
| Operation | patch_agents_by_ref |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Changes an agent in place. Every field is optional; a field the request omits keeps its stored value. The resulting mode+schedule are re-validated together, so a partial update can never leave a long-running agent without the cron the scheduler needs to fire it, and a transition INTO long-running counts against the per-org cap on scheduled agents.
Request
10 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
ref | path | string | yes | Ref is the agent to update — its public id or org-unique name, from the path. |
computeRef | body | string | — | ComputeRef re-binds (or, with "", unbinds) the visor machine. |
description | body | string | — | Description replaces the line other agents read in the tool catalogue. |
executionMode | body | string | — | ExecutionMode switches between one-shot and long-running. |
instructions | body | string | — | Instructions replaces the system prompt whole, up to 32 KiB. |
model | body | string | — | Model re-points the agent at another model, checked against the gateway's served catalogue exactly as create checks it. |
ref | body | string | — | Ref is the agent to update — its public id or org-unique name, from the path. |
schedule | body | string | — | Schedule replaces the cron. |
serviceAccountId | body | string | — | ServiceAccountID re-points (or, with "", clears) the IAM service account a scheduled run is billed as. |
tools | body | string[] | — | Tools replaces the whole allow-list, it does not add to it. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | agentView | ok |
200 body — 13 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
computeRef | body | string | — | ComputeRef is the visor machine this bot is bound to, opaque here: this package stores and echoes it, and the binding's lifecycle belongs elsewhere. |
createdAt | body | string | — | CreatedAt is when the agent was defined, RFC 3339 in UTC to the second. |
description | body | string | — | Description is the one line another agent reads when deciding whether to call this one: the tool catalogue publishes it as the description of agent_<name>,… |
executionMode | body | string | — | ExecutionMode is one-shot or long-running, and it decides who may start this agent. |
id | body | string | — | ID is the agent's stable handle, minted here as "agent_" + 32 hex characters of crypto/rand. |
model | body | string | — | Model is the Zen model this agent runs on, and it is always OUR name for it: writes normalize through cloud.ZenModel and the read normalizes again, so an… |
name | body | string | — | Name is the agent's org-unique handle, matching ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$. |
runs | body | integer | — | Runs is how many executions the org has recorded against this agent, counted at read time. |
schedule | body | string | — | Schedule is the 5-field cron the scheduler fires a long-running agent on, evaluated once a minute. |
serviceAccountId | body | string | — | ServiceAccountID is the IAM agent service account (<org>-<agent>) a scheduled run is billed AS. |
status | body | string | — | Status is the agent's readiness, and today it is "ready" on every row: an agent is a definition rather than a provisioned thing, so nothing transitions it. |
tools | body | string[] | — | Tools are the tool names this agent may call, and the list IS the authority: an agent that declares none gets none. |
updatedAt | body | string | — | UpdatedAt is the last time any field above was written, same format. |
Failure carries the platform error shape — see Errors.
Examples
hanzo agents update <ref>import { Configuration, AgentsApi } from 'hanzoai';
const api = new AgentsApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.patchAgentsByRef({ ref: 'ref', computeRef: "<computeRef>", description: "<description>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AgentsApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AgentsApi(client).patch_agents_by_ref(ref='ref', compute_ref="<computeRef>", description="<description>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.AgentsAPI.PatchAgentsByRef(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, agents_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = agents_api::patch_agents_by_ref(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AgentsApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new AgentsApi(client).patchAgentsByRef();curl -X PATCH https://api.hanzo.ai/v1/agents/<ref> \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"computeRef": "<computeRef>",
"description": "<description>"
}'The door reaches agents through the agents tool, which names its 36 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_agent_conversations"
}
}
}'How is this guide?