> ## 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 Task

> Send a task to an agent for execution. Creates an agent run.



## OpenAPI

````yaml POST /api/tasks
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/tasks:
    post:
      tags:
        - Tasks
      summary: Create task
      description: Send a task to an agent for execution. Creates an agent run.
      operationId: createTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspaceId
                - prompt
              properties:
                workspaceId:
                  type: string
                projectId:
                  type: string
                  nullable: true
                prompt:
                  type: string
                  minLength: 1
                  maxLength: 10000
                  description: Task instruction in natural language
                selectedProvider:
                  type: string
                  description: AI provider to use
                selectedModel:
                  type: string
                  description: AI model to use
                providerKeyId:
                  type: string
                connectorIds:
                  type: array
                  items:
                    type: string
                  description: Connector IDs the agent can use
                autonomyLevel:
                  type: string
                  enum:
                    - supervised
                    - semi-autonomous
                    - autonomous
      responses:
        '201':
          description: Task created and run started
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Run'
components:
  schemas:
    Run:
      type: object
      properties:
        id:
          type: string
        workspaceId:
          type: string
        projectId:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - PENDING
            - RUNNING
            - COMPLETED
            - FAILED
            - CANCELLED
        prompt:
          type: string
        output:
          type: string
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  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.

````