API reference

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

Path and query parameters
FieldTypeWhat it is
id (path)requiredstringThe agent's id; self on an agent's own key.

Request body

application/json, required

Request body fields
FieldTypeWhat it is
modelrequiredstringA model id or an autopilot id on the agent's own list.
instructionsstring or nullAt most 32000 characters.
toolsarray of object
tools[].typerequiredstringOne of "function", "code_interpreter", "mcp", "image_generation", "memory", "antimatter_tools", "x402_fetch", "file_search", "studio".
tools[].languagestringcode_interpreter only. Read back on every code_interpreter entry. One of "javascript", "python".
tools[].vector_store_idsarray of stringfile_search only: vs_ ids the agent's key can reach.
temperaturenumber or nullFrom 0 to 2.
max_output_tokensinteger or null
limitsobject
limits.max_stepsinteger or nullModel calls and tool batches, together.
limits.max_wall_secondsinteger or nullWall clock from the run's creation.
limits.max_cost_microsinteger or nullWhat the run's model and image calls may be billed, in micro USD.

Example

{
  "model": "antimatter/auto"
}

Answer 200

Replaced.

Fields of the 200 answer
FieldTypeWhat it is
objectstringOne of "agent.definition".
agent_idinteger
modelstring
instructionsstring or null
toolsarray of object
temperaturenumber or null
max_output_tokensinteger or null
limitsobjectWhat a run gets when it asks for none, the deployment's caps applied.
limits.max_stepsinteger
limits.max_wall_secondsinteger
limits.max_cost_microsinteger
updatedintegerUnix seconds.

Answer 201

Stored for the first time.

Fields of the 201 answer
FieldTypeWhat it is
objectstringOne of "agent.definition".
agent_idinteger
modelstring
instructionsstring or null
toolsarray of object
temperaturenumber or null
max_output_tokensinteger or null
limitsobjectWhat a run gets when it asks for none, the deployment's caps applied.
limits.max_stepsinteger
limits.max_wall_secondsinteger
limits.max_cost_microsinteger
updatedintegerUnix 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.

Antimatter