Skip to main content
POST
Create an agent
Creates a new agent. The kind field picks where it runs: byo (the default) runs on your machine and routes through the gateway, while hosted runs in OneCLI. See Coding agents to connect a byo agent. Creates an agent in the current workspace. The identifier must be lowercase alphanumeric with hyphens, starting with a letter or digit (max 50 characters), and unique in the workspace. kind picks the agent’s home: byo (default) runs on your own machine and routes through the gateway; hosted runs in a OneCLI sandbox and needs a runner to be online. harness and instructions apply to hosted agents only. A new agent is attached to every workspace connection, custom secret, and LLM key automatically, so it can work right away; adjust with the Grants endpoints. The response’s llmKeys lists the LLM keys it received — empty means the workspace has none yet. The response omits the access token — read it from GET /agents or regenerate it with POST /agents/{agentId}/regenerate-token. Re-creating an existing identifier answers 409.
Availability: Cloud · Community (self-hosted) · Enterprise (self-hosted)

Authorizations

Authorization
string
header
required

A workspace API key (oc_…) or organization API key (oc_org_…). Workspace-scoped endpoints called with an organization key also need X-Workspace-Id.

Body

application/json
name
string
required
Required string length: 1 - 255
Example:

"Claude Assistant"

identifier
string
required
Pattern: ^[a-z0-9][a-z0-9-]{0,49}$
Example:

"claude-assistant"

kind
enum<string>
default:byo
Available options:
byo,
hosted
harness
string

Hosted agents only. The agent runtime; omit for the default.

instructions
string

Hosted agents only. The agent's standing brief.

Maximum string length: 20000
parentIdentifier
string
deprecated

Accepted for older CLIs that send it on sub-agent creation; ignored by the server.

Pattern: ^[a-z0-9][a-z0-9-]{0,49}$

Response

Agent created

POST /agents response. The access token is not included; read it from GET /agents or mint a new one with POST /agents/{agentId}/regenerate-token.

id
string
name
string
identifier
string
kind
enum<string>
Available options:
byo,
hosted
harness
string | null
model
string | null
instructions
string | null
createdAt
string<date-time>
llmKeys
string[]

Secret ids of the LLM keys attached to the new agent automatically. Empty means the workspace has no LLM key yet.