Skip to Content
Docs

Create a new agent

POST
/api/create_agent

Create a new agent. JSON or multipart (multipart for an image). 201 {id, key, image, workflow_id (workflow agents)}. A workflow agent may send workflow_graph to create its workflow in the same request; a graph that fails validation is 400 {success: false, message, error, errors}.

Personal access token scope: agents:write.

Authorization

bearer
headerAuthorizationBearer <token>

A session token or a personal access token. Leave it empty when the instance runs without authentication (AUTH_TYPE unset).

Request Body

application/json
  1. body
agent_type?string

Type of the agent (classic, react, workflow). Defaults to 'classic' for backwards compatibility.

allow_system_prompt_override?boolean

Allow API callers to override the system prompt via the v1 endpoint

chunks?integer

Chunks count

default_model_id?string

Default model ID for this agent

description*string

Description of the agent

folder_id?string

Folder ID to organize the agent

image?

Image file upload

json_schema?

JSON schema for enforcing structured output format

limited_request_mode?boolean

Whether the agent is in limited request mode

limited_token_mode?boolean

Whether the agent is in limited token mode

models?array<string>

List of available model IDs for this agent

name*string

Name of the agent

prompt_id?string

Prompt id, or a preset: default, creative or strict

request_limit?integer

Request limit for the agent in limited mode

retriever?string

Retriever ID

source?string

Source ID (legacy single source)

sources?array<string>

List of source identifiers for multiple sources

starters?array<string>

Up to 4 questions a new chat with the agent offers, each at most 200 characters; trimmed, blanks and case-insensitive duplicates dropped. Multipart sends a JSON string

status*string

Status of the agent (draft or published)

token_limit?integer

Token limit for the agent in limited mode

tools?array<string>

List of tool identifiers

workflow?string

Workflow ID for workflow-type agents

workflow_graph?

Workflow agents only, instead of workflow: the graph saved with the agent in the same transaction, {nodes, edges, retry_defaults?} (a JSON string in a multipart form). A draft only its builder runs is checked for shape only; a published agent, one a key, webhook, schedule or public link runs, or one sharing its workflow with such an agent gets the full validation. Needs workflows:write for a token.

Response Body

Success

Example Request
curl -X POST 'http://localhost:7091/api/create_agent' \  -H 'Content-Type: application/json' \  -d '{  "description": "string",  "name": "string",  "status": "string"}'
Example Response200
Empty