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

# Create Agent

> Create a new AI agent in a workspace.



## OpenAPI

````yaml POST /api/agents
openapi: 3.0.3
info:
  title: Sontairo API
  description: REST API for the Sontairo AI agent orchestration platform
  version: 1.0.0
servers:
  - url: https://www.sontairo.com
security:
  - bearerAuth: []
  - cookieAuth: []
paths:
  /api/agents:
    post:
      tags:
        - Agents
      summary: Create agent
      description: Create a new AI agent in a workspace.
      operationId: createAgent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspaceId
                - name
              properties:
                workspaceId:
                  type: string
                  description: The workspace ID
                projectId:
                  type: string
                  nullable: true
                  description: Project to create the agent in
                name:
                  type: string
                  minLength: 1
                  maxLength: 100
                  description: Agent name
                description:
                  type: string
                  maxLength: 500
                  description: Agent description
                systemPrompt:
                  type: string
                  maxLength: 10000
                  description: System prompt defining agent behavior
                providerKeyId:
                  type: string
                  description: Provider key ID for AI inference
      responses:
        '201':
          description: Agent created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Agent'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    Agent:
      type: object
      properties:
        id:
          type: string
        workspaceId:
          type: string
        projectId:
          type: string
          nullable: true
        name:
          type: string
        description:
          type: string
          nullable: true
        systemPrompt:
          type: string
          nullable: true
        isActive:
          type: boolean
        providerKeyId:
          type: string
          nullable: true
        providerKey:
          type: object
          nullable: true
          properties:
            id:
              type: string
            name:
              type: string
            provider:
              type: string
            model:
              type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        error:
          type: string
  responses:
    BadRequest:
      description: Invalid input
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Not authenticated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Not authorized to access this workspace
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Session token issued by the desktop/native auth exchange, sent as
        Authorization: Bearer <token>.
    cookieAuth:
      type: apiKey
      in: cookie
      name: session
      description: Browser session cookie set by the web sign-in flow.

````