Skip to Content
Agents

Create an agent

Permissionagents:createRetriesIdempotency-Key requiredAuthentication
POST
/agents

Creates the aggregate at revision 1 and seeds exactly one mutable draft. Use the returned Location for the canonical agent representation and its ETag for conditional follow-up writes.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Header Parameters

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255

Request Body

application/json
  1. body
slug*string

Stable routing identifier. It cannot be renamed after creation.

Match^[a-z0-9_]+$
Length2 <= length <= 48
name*string
Length1 <= length <= 200
mode*"prompt"
Value in"prompt"
prompt?AgentPromptTemplate

Optional initial prompt template. Omit, send an empty string, or send only whitespace to seed the platform default. See AgentPromptTemplate for the complete variable contract.

Lengthlength <= 500000

Response Body

Success

application/json
  1. response
id*string
Formatuuid
slug*string
name*string
mode*"prompt"
Value in"prompt"
draft_version_id*string
Formatuuid
revision*integer

Initial aggregate revision. Supply the response ETag rather than constructing one from this number.

Formatint64
Range1 <= value
updated_at*string
Formatdate-time
Example Request
curl -X POST 'https://api.kejue.co/v1/agents' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "slug": "billing_assistant",  "name": "Billing Assistant",  "mode": "prompt",  "prompt": "Help {{lead_name}} resolve their billing question. Never request a secret; use call {{system.call_id}} for support correlation."}'
Example Response
{  "id": "11111111-1111-4111-8111-111111111111",  "slug": "billing_assistant",  "name": "Billing Assistant",  "mode": "prompt",  "draft_version_id": "22222222-2222-4222-8222-222222222222",  "revision": 1,  "updated_at": "2026-07-20T09:00:00Z"}