Webinar: Better Agents, Easier than Ever — Thursday, June 18th at 9am PT / 12pm ET. Register Now
Version 2.5
Agents

Agents

Manage agents over the API — create and edit them, move a draft through its version lifecycle, attach data and tools, and export or import an agent as a package. To talk to an agent, see Conversations.

All paths are relative to the base URL and require an Authorization: Bearer YOUR_API_KEY header.

The agent object

PublicAgent is returned by most endpoints here.

FieldTypeDescription
idstringAgent ID.
namestringAgent name.
descriptionstringWhat the agent does.
runbook_textstringRaw text of the agent's runbook.
statestringLifecycle state — draft or live (lowercase).
versionstringCurrent version label.
live_version_idstringID of the published live version, if any.
architecture_namestringThe agent's architecture.
architecture_versionstringArchitecture version.
created_bystringUser who created the agent.
created_at / updated_atstringTimestamps.

List agents

GET /agents

ParameterInTypeRequiredDescription
namequerystringNoFilter by name (starts-with, case-insensitive).
limitqueryintegerNoPage size.
nextquerystringNoPagination token.

Returns a PaginatedResponse whose data is a list of agents.

Get agent

GET /agents/{agent_id}

Returns a single PublicAgent.

Create agent

POST /agents

Creates a new agent owned by the authenticated key.

Body

FieldTypeRequiredDescription
namestringYesAgent name.
descriptionstringNoWhat the agent does.
runbook_textstringNoThe agent's runbook, as Markdown text.
architecture_namestringNoArchitecture to use (defaults applied).
architecture_versionstringNoArchitecture version.
curl -X POST 'https://{your-deployment-host}/tenants/{tenant-id}/api/v2/agents' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Invoice Roast",
    "description": "Forensic expense analyst.",
    "runbook_text": "## Objective\nExtract and check receipts."
  }'

Returns the created PublicAgent.

Update agent

PATCH /agents/{agent_id}

Partially updates an agent; absent fields are left untouched.

Body

FieldTypeRequiredDescription
namestringNoNew name.
descriptionstringNoNew description.
runbook_textstringNoNew runbook text.

You can't patch a live agent directly. Enter edit mode first (POST /agents/{agent_id}/edit), make your changes against the draft, then publish.

Delete agent

DELETE /agents/{agent_id}

Deletes an agent (requires ownership). Returns 204 No Content.

Version lifecycle

An agent has a published live version that users see, and a draft you edit — see the Versioning & lifecycle concept. These endpoints drive that flow.

The lifecycle endpoints require the agent lifecycle capability to be enabled on the deployment.

Enter edit mode

POST /agents/{agent_id}/edit

Flips the agent to draft so you can iterate. Idempotent — a draft stays a draft. Returns the PublicAgent.

Publish

POST /agents/{agent_id}/publish

Snapshots the current draft as a new version, flips the agent to live, and points live_version_id at it. Requires draft state.

Body

FieldTypeRequiredDescription
descriptionstringNoChange description for this publish.
connection_mappingsobject<string>NoMap test data-connection IDs → prod data-connection IDs.
mcp_server_mappingsobject<string>NoMap test MCP server IDs → prod MCP server IDs.

The mappings let you swap the draft's test resources for production equivalents at publish time. Returns the PublicAgent.

Discard draft

POST /agents/{agent_id}/discard-draft

Reverts the agent's content to the live version. Requires a prior publish (a live_version_id must exist). Takes the same connection_mappings / mcp_server_mappings body as publish. Returns the PublicAgent.

Get lifecycle state

GET /agents/{agent_id}/state

{ "state": "draft", "live_version_id": "string", "has_draft": true }
FieldTypeDescription
statestringdraft or live (lowercase).
live_version_idstringID of the published live version, if any.
has_draftbooleanWhether an editable draft exists.

Attached data & tools

Attaching or detaching requires ownership of the agent — attaching to an agent you don't own returns 403.

MCP servers

  • GET /agents/{agent_id}/mcp-servers — list the MCP servers attached to the agent (paginated).
  • POST /agents/{agent_id}/mcp-servers — attach one. Body: { "mcp_server_id": "..." }. Returns 204.
  • DELETE /agents/{agent_id}/mcp-servers/{mcp_server_id} — detach one.

Semantic data models

  • GET /agents/{agent_id}/semantic-data-models — list the SDMs attached to the agent (paginated).
  • POST /agents/{agent_id}/semantic-data-models — attach one. Body: { "semantic_data_model_id": "..." }. Returns 204.
  • DELETE /agents/{agent_id}/semantic-data-models/{semantic_data_model_id} — detach one.

Export & import

Export

GET /agents/{agent_id}/export

Streams the agent — with its SDMs, MCP servers, action packages, and shared files — as a zip package.

Import

POST /agents/import

Creates a new agent from a previously exported zip. Send as multipart/form-data with a file field carrying the zip.

curl -X POST 'https://{your-deployment-host}/tenants/{tenant-id}/api/v2/agents/import' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -F 'file=@agent-package.zip'

Returns the created PublicAgent.