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

# Create a run

> Triggers an agent run asynchronously. Poll the returned `status_url` or subscribe to `kapso_agent.run.*` project webhooks.



## OpenAPI

````yaml /api/platform/v1/openapi-kapso-agent.yaml post /kapso-agent/runs
openapi: 3.1.0
info:
  title: Kapso Agent API
  version: 0.1.0
  description: >
    Trigger runs in built-in modes with the API trigger enabled or custom modes
    with the `api` surface enabled.

    Inspect sessions, control run lifecycles, and handle approvals
    programmatically.
servers:
  - url: https://api.kapso.ai/platform/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Agent Modes
    description: Discover the agent modes and which ones accept API runs
  - name: Agent Sessions
    description: List API sessions and inspect their runs
  - name: Agent Runs
    description: Create, poll, and control Kapso Agent runs
paths:
  /kapso-agent/runs:
    post:
      tags:
        - Agent Runs
      summary: Create a run
      description: >-
        Triggers an agent run asynchronously. Poll the returned `status_url` or
        subscribe to `kapso_agent.run.*` project webhooks.
      operationId: createAgentRun
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRunRequest'
      responses:
        '202':
          description: Run accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunResponse'
        '404':
          $ref: '#/components/responses/NotFound'
        '422':
          description: Invalid input for the mode's trigger
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateRunRequest:
      type: object
      required:
        - mode
        - input
      properties:
        mode:
          type: string
          description: Slug of a mode whose `available_invocations` includes `api`
          examples:
            - api
        conversation_id:
          type: string
          format: uuid
          description: Continue an existing session created with the same API key and mode
        input:
          type: object
          description: >-
            Mode input. The generic trigger requires `prompt`;
            `findings-investigator` requires `finding_id`.
          properties:
            prompt:
              type: string
            finding_id:
              type: string
              format: uuid
        metadata:
          type: object
          description: Arbitrary data stored on the run and echoed in webhooks
    RunResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/Run'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message
    Run:
      type: object
      properties:
        run_id:
          type: string
          format: uuid
        conversation_id:
          type: string
          format: uuid
          description: The agent session this run belongs to
        status:
          $ref: '#/components/schemas/RunStatus'
        mode:
          type: string
          examples:
            - api
        title:
          type:
            - string
            - 'null'
        kind:
          type: string
          enum:
            - ask
            - continue
        prompt:
          type:
            - string
            - 'null'
        provider_model:
          type:
            - string
            - 'null'
          examples:
            - gpt-5.5
        reasoning_effort:
          type:
            - string
            - 'null'
          examples:
            - medium
        error_message:
          type:
            - string
            - 'null'
        ai_cost_microdollars:
          type: integer
          description: AI cost of the run in microdollars
        result:
          $ref: '#/components/schemas/RunResult'
        pending_approval:
          $ref: '#/components/schemas/PendingApproval'
        created_at:
          type: string
          format: date-time
        started_at:
          type:
            - string
            - 'null'
          format: date-time
        paused_at:
          type:
            - string
            - 'null'
          format: date-time
        finished_at:
          type:
            - string
            - 'null'
          format: date-time
        status_url:
          type: string
          description: Path to poll this run
        finding:
          type: object
          description: Present for a finding investigation run
          properties:
            id:
              type: string
              format: uuid
            investigation_id:
              type: string
              format: uuid
    RunStatus:
      type: string
      enum:
        - queued
        - running
        - paused
        - waiting_for_approval
        - completed
        - failed
        - cancelled
    RunResult:
      type:
        - object
        - 'null'
      description: Present when the run completed
      properties:
        type:
          type: string
          enum:
            - message
            - finding_investigation
        message_id:
          type: string
          format: uuid
          description: Present when type is message
        content:
          type: string
          description: Present when type is message
        data:
          type: object
          description: Present when type is finding_investigation
    PendingApproval:
      type:
        - object
        - 'null'
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          examples:
            - pending
        tool_name:
          type: string
        parameters:
          type: object
          description: Sanitized tool parameters
        created_at:
          type: string
          format: date-time
  responses:
    NotFound:
      description: Resource not found or not accessible with this API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````