Update agent

Changes an agent in place.

PATCH /v1/agent/{ref}

Addresshttps://api.hanzo.ai/v1/agent/{ref}
MethodPATCH
Operationpatch_agent_by_ref
AuthAuthorization: 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

15 fields, body application/json (required).

FieldInTypeRequiredDescription
refpathstringyesRef is the agent to update — its public id or org-unique name, from the path.
avatarbodystring—Avatar and Emoji re-draw the agent.
cap_micro_usdbodyinteger (int64)—The budget, any part of it.
computeRefbodystring—ComputeRef re-binds (or, with "", unbinds) the visor machine.
descriptionbodystring—Description replaces the line other agents read in the tool catalogue.
emojibodystring—Emoji re-draws the agent as a glyph.
executionModebodystring—ExecutionMode switches between one-shot and long-running.
instructionsbodystring—Instructions replaces the system prompt whole, up to 32 KiB.
max_task_micro_usdbodyinteger (int64)—MaxTaskMicroUSD is the ceiling for a single run, in micro-USD.
modelbodystring—Model re-points the agent at another model, checked against the gateway's served catalogue exactly as create checks it.
periodbodystring—Period is the window the cap resets on: day, week or month.
refbodystring—Ref is the agent to update — its public id or org-unique name, from the path.
schedulebodystring—Schedule replaces the cron.
serviceAccountIdbodystring—ServiceAccountID re-points (or, with "", clears) the IAM service account a scheduled run is billed as.
toolsbodystring[]—Tools replaces the whole allow-list, it does not add to it.

Response

StatusBodyMeaning
200agent.agentViewok
defaultproblem-detailsrefused

200 body — 21 fields.

FieldInTypeAlwaysDescription
avatarbodystring—Avatar is an image the agent is drawn as — a link to one, or the bytes inline as a data URL, up to 96 KiB.
cap_micro_usdbodyinteger (int64)—CapMicroUSD is the total this agent may spend within one Period, as an integer number of micro-USD (1,000,000 = $1).
computeRefbodystring—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.
consumed_micro_usdbodyinteger (int64)—ConsumedMicroUSD is what has been spent in the current period, in micro-USD.
createdAtbodystring—CreatedAt is when the agent was defined, RFC 3339 in UTC to the second.
descriptionbodystring—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_&lt;name&gt;, falling back to "agent <name>" when it is empty.
emojibodystring—Emoji is the single glyph a caller picked when they had no image.
executionModebodystring—ExecutionMode is one-shot or long-running, and it decides who may start this agent.
idbodystring—ID is the agent's stable handle, minted here as "agent_" + 32 hex characters of crypto/rand.
lineagebodystring[]—Lineage is every agent above this one, nearest first — the parent, its parent, and so on to the agent a person defined.
max_task_micro_usdbodyinteger (int64)—MaxTaskMicroUSD is the ceiling for a single run, in micro-USD.
modelbodystring—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 upstream family name never leaves here even from a row written before that rule existed.
namebodystring—Name is the agent's org-unique handle, matching ^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$.
parentbodystring—Parent is the agent that spawned this one; absent for an agent a person defined.
periodbodystring—Period is the window the cap resets on: day, week or month.
runsbodyinteger (int64)—Runs is how many executions the org has recorded against this agent, counted at read time.
schedulebodystring—Schedule is the 5-field cron the scheduler fires a long-running agent on, evaluated once a minute.
serviceAccountIdbodystring—ServiceAccountID is the IAM agent service account (<org>-<agent>) a scheduled run is billed AS.
statusbodystring—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.
toolsbodystring[]—Tools are the tool names this agent may call, and the list IS the authority: an agent that declares none gets none.
updatedAtbodystring—UpdatedAt is the last time any field above was written, same format.

Failure carries the platform error shape — see Errors.

Examples

hanzo agent update <ref>
import { Configuration, AgentApi } from 'hanzoai';

const api = new AgentApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.patchAgentByRef({ ref: 'ref', avatar: "<avatar>", cap_micro_usd: 0 });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AgentApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AgentApi(client).patch_agent_by_ref(ref='ref', avatar="<avatar>", cap_micro_usd=0)
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.AgentAPI.PatchAgentByRef(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, agent_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = agent_api::patch_agent_by_ref(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AgentApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new AgentApi(client).patchAgentByRef();
curl -X PATCH https://api.hanzo.ai/v1/agent/<ref> \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "avatar": "<avatar>",
       "cap_micro_usd": 0
     }'

MCP reaches agent through the agent tool, which names its 38 operations with its own verbs — this one among them, under a name only MCP 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_agents"
         }
       }
     }'

Agent API · All Hanzo APIs · Interactive reference

Was this page useful?