Skip to main content
POST
Create an AI agent

Authorizations

hookie_session
string
cookie
required

The console's sealed session cookie, set by WorkOS AuthKit. Mutating requests also require the X-Requested-With CSRF header.

Headers

Idempotency-Key
string

Makes a POST safe to retry for 24 hours: the same key, credential, path and body returns the stored response (Idempotent-Replayed: true) instead of running again. 422 if the key was used for a different request; 409 while the first is in flight.

Required string length: 1 - 255

Path Parameters

project_id
string
required

Body

application/json
name
string
required

Trimmed before validation.

Required string length: 1 - 120
active
boolean
default:true

Only the literal false deactivates. An inactive agent makes an agent_call workflow step fail.

model
enum<string>
default:@cf/meta/llama-3.3-70b-instruct-fp8-fast

A model from GET /admin/api/ai-models. Absent or empty means the default (@cf/meta/llama-3.3-70b-instruct-fp8-fast); anything off the list is refused with 400 … is not a supported model (#196, FLOW-16). It used to be replaced by the default without a word.

Available options:
@cf/meta/llama-3.3-70b-instruct-fp8-fast,
@cf/meta/llama-3.1-8b-instruct,
@cf/meta/llama-3.1-8b-instruct-fast,
@cf/meta/llama-3.2-3b-instruct,
@cf/meta/llama-4-scout-17b-16e-instruct,
@cf/mistralai/mistral-small-3.1-24b-instruct,
@cf/google/gemma-3-12b-it
system_prompt
string
default:""

prompt is accepted as an alias.

Maximum string length: 8000
prompt
string

Alias for system_prompt.

tools
any[]

Not supported: an agent makes one model call and cannot call tools. An empty list is accepted; a non-empty one is refused with 400 (#196). It used to be stored and ignored.

memory_dataset
string | null

When set, each output is written there as a record, and the agent's latest 5 outputs there (its own, this project's, oldest first, at most 2,000 characters) are sent with its next call (#196).

Pattern: ^[a-zA-Z][a-zA-Z0-9_]{0,62}$
max_tokens
integer
default:1024

Clamped to 1..1024; a non-integer becomes 1024.

Response

Created.

id
string
required
ok
enum<boolean>
required
Available options:
true
ai_agent
object

The created ai agent, as GET by id returns it (#201).