Skip to main content

Module agent_definition

Module agent_definition 

Source
Expand description

Agents update, bundles, hide and unhide (POST /api/v1/agent/{update,bundles,hide,unhide}): an agent edits an agent’s definition, sets its Bundles list and hides or shows a picker template without the operator’s window, by the code the window’s updateagent, setagentbundles and agentdefhide/agentdefunhide run.

  • update: only the fields given change, and only ones that say how the agent is listed or when it runs: description, icon, auto_start, restart_on_crash, idle_timeout_minutes, the model route’s model and the agent’s daily spend cap (spend_cap_usd, and reset_spend_today for a spend that was wrong; see below). What decides what an agent runs, or where its traffic goes or which project files it reads (shell, provider_flags, working_directory, model_vendor_base_url) is not taken, as env_set refuses the same: the operator sets those in My Agents. The name has its own action (rename), the provider is fixed when an agent is made, and environment variables, accounts, container settings and the seat have their own actions.
  • spend cap: the agent’s leader may set or reset another agent’s cap; an agent may only lower its own. Each change is recorded with the cap before and after (docs/specs/SPEC_ROUTE_AGENT_BRAKES_2026_11_10.md section 3.2).
  • bundles: with bundle_ids, replaces the agent’s picked bundles, in order; without, reads them.
  • hide, unhide: a seeded picker template; an agent you made is removed with delete.

Each acts as the agent its token names; a request without one is refused, so a change is never attributed to the operator, and each one, and each refusal, is recorded in the audit log under the calling agent.

Structs§

BundlesRequest 🔒
HideRequest 🔒
SpendPlan 🔒
What spend_cap_usd and reset_spend_today of Agents update ask for, once allowed.
UpdateRequest 🔒
A field outside the list above is refused by name (deny_unknown_fields), never ignored.
Updated 🔒
What update did: the agent, the definition fields changed, what the spend change did, and what a model or effort pick did.

Constants§

MAX_IDLE_MINUTES 🔒
A week: the longest idle timeout.
MAX_TEXT_CHARS 🔒
The longest description or text field: what the definition form accepts in practice.
RESUMED_WARNING 🔒
Said when a model change resumes the conversation: the one case where the new model reads what another wrote.

Functions§

bad 🔒
bundles 🔒
fresh_message 🔒
The first message of the fresh session fresh: true asks for, once it is known to be possible: None when the request does not ask for one. Checked before the agent moves, so a refusal leaves it where it was.
handle_agent_bundles 🔒
handle_agent_hide 🔒
handle_agent_unhide 🔒
handle_agent_update 🔒
hide 🔒
hide_or_show 🔒
named_or_absent 🔒
value trimmed, None when the caller left it out; an empty or blank one is refused, naming field.
publish_changed 🔒
restart_on_new_model 🔒
The choice is read at every launch, so the agent’s panes are restarted, with their conversation, at the end of the turn they are in. A pane that cannot be restarted starts on it the next time it opens. With fresh_message they start a new session instead, its first message that one.
route_change 🔒
route and model of Agents update: leave a model route (route: ""), or change the model on the route the agent is already on. Putting an agent onto a route spends the person’s key, so that is asked of them when the agent is made or in the composer’s model panel, not done by a call that names no one to ask.
run 🔒
Run op as the calling agent, and record the outcome under it.
run_remote 🔒
update for an agent on another machine (remote_ops::agent_ops): the same checks and change a local call has, recorded under who (slug@machine). A caller from another machine is nobody’s leader, so it cannot raise a spend cap.
spend_apply 🔒
Does what spend_plan allowed. Returns what was done, for the audit row.
spend_plan 🔒
Checks spend_cap_usd and reset_spend_today before anything else in the request changes. The leader of an agent sets and resets its cap; an agent may only lower its own, and not reset it, since a cap it could lift or clear would stop nothing.
text_field 🔒
update 🔒
Apply the fields req gives to the agent’s stored definition. Returns the names of the fields changed, and what the audit row says beyond them.
update_response 🔒
Agents update: the change, and what the answer and the audit row say about it.