> ## Documentation Index
> Fetch the complete documentation index at: https://docs.connie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an agent

> Creates an agent in Draft. `mission` (the agent's instructions) is required unless you start from `templateId`. Send an `idempotencyKey` (or an `Idempotency-Key` header) so a retry returns the same agent instead of a second one. Guests can't create agents.




## OpenAPI

````yaml /openapi/automations.yaml post /agents
openapi: 3.1.0
info:
  title: Connie Automations API
  version: 1.0.0
  description: >
    Endpoints the Connie web app uses for automations. They authenticate with
    your signed-in browser session — see
    https://docs.connie.ai/api-reference/authentication. These are the app's own
    endpoints and can change when the app changes.
servers:
  - url: https://connie.ai/api
security:
  - sessionCookie: []
tags:
  - name: Workflows
    description: List, create, read, update and delete workflows.
  - name: Runs
    description: >-
      Start, retry and stop workflow runs, switch a workflow Live, and read run
      counts.
  - name: Triggers
    description: A workflow's triggers and its schedule settings.
  - name: Templates
    description: The template gallery and copying a template into a workspace.
  - name: Agents
    description: Agents on the Agents page.
paths:
  /agents:
    post:
      tags:
        - Agents
      summary: Create an agent
      description: >
        Creates an agent in Draft. `mission` (the agent's instructions) is
        required unless you start from `templateId`. Send an `idempotencyKey`
        (or an `Idempotency-Key` header) so a retry returns the same agent
        instead of a second one. Guests can't create agents.
      operationId: createAgent
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            maxLength: 200
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspaceId
                - name
              properties:
                workspaceId:
                  type: string
                  format: uuid
                name:
                  type: string
                  minLength: 1
                description:
                  type:
                    - string
                    - 'null'
                  maxLength: 2000
                avatarUrl:
                  type:
                    - string
                    - 'null'
                  format: uri
                mission:
                  type: string
                  description: The agent's instructions.
                templateId:
                  type:
                    - string
                    - 'null'
                  format: uuid
                folderId:
                  type:
                    - string
                    - 'null'
                  format: uuid
                configuration:
                  type: object
                  additionalProperties: true
                  description: >-
                    Rules, owners and credit cap. Defaults are used when
                    omitted.
                idempotencyKey:
                  type: string
                  maxLength: 200
      responses:
        '200':
          description: >-
            A retry with the same idempotency key; the existing agent is
            returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCreateResult'
        '201':
          description: The new agent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCreateResult'
        '400':
          description: >-
            Invalid input, or the template is unavailable
            (`AGENT_TEMPLATE_UNAVAILABLE`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: An agent with this name already exists (`AGENT_NAME_TAKEN`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    AgentCreateResult:
      type: object
      properties:
        agent:
          $ref: '#/components/schemas/Agent'
        idempotentReplay:
          type: boolean
          description: >-
            True when this request repeated an earlier one with the same
            idempotency key.
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable message.
        code:
          type: string
          description: Machine-readable code, when there is one.
        details:
          description: Extra detail, for example the invalid fields.
      required:
        - error
    Agent:
      type: object
      properties:
        id:
          type: string
          format: uuid
        workspace_id:
          type: string
          format: uuid
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        avatar_url:
          type:
            - string
            - 'null'
        mission:
          type: string
          description: The agent's instructions.
        status:
          type: string
          enum:
            - draft
            - active
            - paused
            - error
            - archived
        folder_id:
          type:
            - string
            - 'null'
          format: uuid
        template_id:
          type:
            - string
            - 'null'
          format: uuid
        settings:
          type: object
          additionalProperties: true
          description: Rules, owners and credit cap.
        created_by:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  responses:
    Unauthorized:
      description: >-
        Not signed in (`UNAUTHORIZED`), or the session cookie has expired
        (`SESSION_EXPIRED`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        You aren't a member of the workspace, or don't have the access this
        needs.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    sessionCookie:
      type: apiKey
      in: header
      name: Cookie
      description: >-
        The full Cookie header copied from a signed-in connie.ai browser
        request. See the Authentication page.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.