API reference · Agents
Replace an agent's definition
PUT/v1/agents/{id}/definitionAPI key
Hosted agent runs (lib/agent-runs.ts): the agent's definition runs a loop on the server, model call and tool calls, each step a job of its own. Every model call is a request by the agent's own key, billed to its wallet under its policy. Needs the agents scope; an agent's own key is refused. A 404 while hosted runs are off on the deployment.
Parameters
| Field | Type | What it is |
|---|---|---|
| id (path)required | string | The agent's id; self on an agent's own key. |
Request body
application/json, required
| Field | Type | What it is |
|---|---|---|
| modelrequired | string | A model id or an autopilot id on the agent's own list. |
| instructions | string or null | At most 32000 characters. |
| tools | array of object | |
| tools[] | string | One of "function", "code_interpreter", "mcp", "image_generation", "memory", "antimatter_tools", "x402_fetch", "file_search", "studio". |
| tools[] | string | code_interpreter only. Read back on every code_interpreter entry. One of "javascript", "python". |
| tools[] | array of string | file_search only: vs_ ids the agent's key can reach. |
| temperature | number or null | From 0 to 2. |
| max_output_tokens | integer or null | |
| limits | object | |
| limits. | integer or null | Model calls and tool batches, together. |
| limits. | integer or null | Wall clock from the run's creation. |
| limits. | integer or null | What the run's model and image calls may be billed, in micro USD. |
Example
{
"model": "antimatter/auto"
}Answer 200
Replaced.
| Field | Type | What it is |
|---|---|---|
| object | string | One of "agent.definition". |
| agent_id | integer | |
| model | string | |
| instructions | string or null | |
| tools | array of object | |
| temperature | number or null | |
| max_output_tokens | integer or null | |
| limits | object | What a run gets when it asks for none, the deployment's caps applied. |
| limits. | integer | |
| limits. | integer | |
| limits. | integer | |
| updated | integer | Unix seconds. |
Answer 201
Stored for the first time.
| Field | Type | What it is |
|---|---|---|
| object | string | One of "agent.definition". |
| agent_id | integer | |
| model | string | |
| instructions | string or null | |
| tools | array of object | |
| temperature | number or null | |
| max_output_tokens | integer or null | |
| limits | object | What a run gets when it asks for none, the deployment's caps applied. |
| limits. | integer | |
| limits. | integer | |
| limits. | integer | |
| updated | integer | Unix seconds. |
Errors
- 400OpenAI shaped error.
- 401OpenAI shaped error.
- 403OpenAI shaped error.
- 404OpenAI shaped error.
Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.