Skip to main content
A named, reusable configuration to start sessions from. Save the model, instructions and tools once, then create sessions that inherit them. Reach for one when every session in some part of your product should start the same way — a support bot, an extraction worker, a reviewer. A session created from an agent gets a copy, so changing or deleting the agent never reaches into work already running.

Creating one

The create call answers with the agent and the id it was given: {"object":"agent","id":"agt_2b7d5e91c0a34f68","name":"support-bot",…}. name is a slug you choose — lowercase letters, digits, dot, dash or underscore, up to 64 characters, lowercased for you. id is ours. A session can name either one. Posting the same name again replaces that agent in place and keeps its id, so a name is a stable handle to re-save against — and a replacement really replaces: a field you leave out is removed, not carried over from the version before. An agent needs at least one of model, model_credential_id, instructions, tools or text. A name with nothing behind it would apply as a no-op.

Overrides

Anything you send inline wins over the agent. How it wins depends on the field, and the difference is deliberate:

Deleting one

Sessions already started from it keep working, unchanged — which is the next section, and the reason deleting is safe.

Copied, not referenced

A session keeps working the way it was created after the agent changes or is deleted. That is what makes an agent a starting point rather than remote control over work already running. The session does remember which agent made it — agent.id on the session, and it stays there after that agent is deleted, because it is a record of where the session came from rather than a link to something that must still exist.

Migrating from environment-templates

/v1/environment-templates was the earlier name, from before environment profiles arrived and left two unrelated things both called “environment”. Those paths still work, against the same rows, and environment.template_id still names an agent. They are marked deprecated in the OpenAPI document and will be removed after one release — move to /v1/agents and agent.id. An agent with nothing behind it, a name that is not a valid slug, and an agent.id that is not yours are each a 400 or 404 naming the cause — the shape they arrive in is errors.md.

Next

  • sessions.md — every field an agent can hold, described in full
  • tools.md — the tools an agent carries
  • reference — the /v1/agents endpoints