---
title: "Create an agent"
method: POST
path: "/api/v1/agent-definitions"
tags: ["authed"]
---

# Create an agent

`POST /api/v1/agent-definitions`

## Request

- Base URL: `https://api.teaflask.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.teaflask.com/api/v1/agent-definitions`
- Auth: none declared

Create a new AI agent from a name and a whole configuration. It
starts as an unpublished draft, never live, until published with
publish_agent_definition. A name another agent already holds is
refused, and a refused configuration is described problem by problem;
either way nothing is stored.

## Request body

- CreateAgentDefinitionRequest
  - `name` string, required: The agent's display name; its unique short name is made from it.
  - `kind` 'web' | 'slack': Where an agent answers; chosen at creation and never switched.
  - `config` object, required: The agent's whole configuration, "version": "agent/v1", shaped like get_agent_definition's latest_revision.config.

## Response `201`

Successful Response

- AgentDefinitionDetailResponse: An agent plus its newest revision.
  - `id` string, uuid, required: The agent's id.
  - `organization_id` string, uuid, required: The organization it belongs to.
  - `slug` string, required: The agent's unique short name.
  - `name` string, required: The agent's display name.
  - `kind` 'web' | 'slack', required: Where an agent answers; chosen at creation and never switched.
  - `published_revision_id` string, uuid, nullable, required: The revision live conversations run; null until the agent is first published.
  - `created_at` string, date-time, required: When the agent was created.
  - `updated_at` string, date-time, required: When the agent last changed.
  - `latest_revision` AgentDefinitionRevisionResponse, required
    - `id` string, uuid, required: The revision's id.
    - `agent_definition_id` string, uuid, required: The agent it belongs to.
    - `parent_revision_id` string, uuid, nullable, required: The revision this one was edited from; null for the first.
    - `config` object, required: The agent's whole configuration: model (which model answers and how hard it thinks), routing (fallback models) and user_model_choice (whether visitors may pick the model); prompt (its system prompt); tools (what it may use: searching and reading docs, navigating, reading, highlighting and filling in pages of the organization's own app, calling the organization's API actions by slug, handing work to subagents, a code workspace, the page register); docs_scope and skills (which docs and skills it may read); memory (whether it remembers each signed-in visitor); suggestions (first questions offered to visitors); end_users (whether visitors must sign in or connect an AI subscription, and what they may spend before one is required); and steering and interventions (the checks that steer or stop its actions).
    - `config_format` 'agent/v1', required: Versions of the agent config vocabulary; evolves additively, never in place.
    - `status` 'draft' | 'published' | 'superseded', required
    - `authored_by_user_id` string, uuid, required: The member who wrote it.
    - `content_version` integer, required: Changes each time this revision is edited in place; send it back as parent_content_version.
    - `created_at` string, date-time, required: When the revision was created.
    - `updated_at` string, date-time, required: When the revision last changed: an edited draft or a status change.

## Other responses

- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not found
- `405`: Method not allowed
- `422`: Validation error
- `500`: Internal server error

## Changes

- **2026-11-03** `c6ac9fd6657f`: 6 info
  - removed the `STEEP_LEARNING_DISABLED` enum value from the `error/code` response property for the response status `401`
  - removed the `STEEP_LEARNING_DISABLED` enum value from the `error/code` response property for the response status `403`
  - removed the `STEEP_LEARNING_DISABLED` enum value from the `error/code` response property for the response status `404`
  - removed the `STEEP_LEARNING_DISABLED` enum value from the `error/code` response property for the response status `405`
  - …2 more

[Operation history](https://skmtc.dev/teaflask/apis/teaflask-api/changes/api/v1/agent-definitions/post.md)

---

[API](https://skmtc.dev/teaflask/apis/teaflask-api.md) - [All operations](https://skmtc.dev/teaflask/apis/teaflask-api/llms.txt) - [OpenAPI document](https://skmtc.dev/teaflask/apis/teaflask-api/revisions/c6ac9fd6657f?raw)
