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

# Hand a task to a coding agent from a thread

> Hand work to a connected coding agent from any thread, with no issue. The attempt's brief carries the task and a link to the thread; the agent's questions and result land in the thread, and `agentDispatches.get`, `replies.create` and `cancel` follow it like an issue fix's attempt. The requester is the authenticated person. At most five attempts outside issues are active per project at once.



## OpenAPI

````yaml /openapi.json post /agent-dispatches
openapi: 3.1.1
info:
  title: Sazabi Public API
  version: 1.0.0
  description: >
    Public REST API for Sazabi. Authenticate using a secret API key in the
    Authorization header.


    ## Pagination


    This API uses two pagination strategies depending on the endpoint type:


    ### Cursor-Based Pagination (List Endpoints)


    List endpoints (threads, messages, keys) use cursor-based pagination for
    efficient, consistent results:


    - **Parameters**: `limit` (items per page, default 50, max 100), `cursor`
    (opaque pagination token)

    - **Response**: Includes `nextCursor` field - pass this as `cursor` in the
    next request

    - **End of results**: When `nextCursor` is `null`, there are no more results

    - **Example**: `GET
    /v1/threads?limit=20&cursor=01234567-89ab-cdef-0123-456789abcdef`


    ### Page-Based Pagination (Search Endpoints)


    Search endpoints use page-based pagination due to the underlying search
    engine:


    - **Parameters**: `limit` (items per page, default 20, max 100), `page`
    (1-indexed page number)

    - **Response**: Includes `pagination` object with `page`, `limit`,
    `totalResults`, `totalPages`

    - **Example**: `GET /v1/search/threads?q=error&limit=10&page=2`
servers:
  - url: https://api.sazabi.com/v1
    description: Production
security: []
paths:
  /agent-dispatches:
    post:
      tags:
        - AgentDispatches
      summary: Hand a task to a coding agent from a thread
      description: >-
        Hand work to a connected coding agent from any thread, with no issue.
        The attempt's brief carries the task and a link to the thread; the
        agent's questions and result land in the thread, and
        `agentDispatches.get`, `replies.create` and `cancel` follow it like an
        issue fix's attempt. The requester is the authenticated person. At most
        five attempts outside issues are active per project at once.
      operationId: agentDispatches.create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                organizationId:
                  type: string
                  minLength: 1
                projectId:
                  type: string
                  format: uuid
                threadId:
                  type: string
                  format: uuid
                  description: >-
                    The thread the handoff starts from and reports back into.
                    The caller must be able to read it; it need not be an
                    issue's.
                agent:
                  type: object
                  properties:
                    provider:
                      enum:
                        - cursor
                        - devin
                        - capy
                        - replicas
                        - hoplite
                        - warp
                        - claude
                        - codex
                        - tembo
                      type: string
                    connectionId:
                      type: string
                      format: uuid
                      description: >-
                        The provider connection to use. Defaults to the
                        organization's one active connection for the provider.
                    repositoryUrl:
                      type: string
                      format: uri
                      description: >-
                        `https://github.com/{owner}/{repo}`, one of the
                        project's connected repositories. Defaults to the
                        project's one connected repository; several need a
                        choice.
                    baseBranch:
                      type: string
                      minLength: 1
                      maxLength: 255
                      description: >-
                        The branch the agent starts from. Defaults to the
                        repository's base branch in the project, then its
                        default branch on the forge.
                    environmentId:
                      type: string
                      minLength: 1
                      maxLength: 200
                      description: >-
                        The vendor environment to run in (a Replicas
                        organization environment): one of
                        `integrations.codingAgentEnvironments.list` for the
                        connection that holds the repository. Refused for an
                        agent without environments.
                  required:
                    - provider
                task:
                  type: string
                  minLength: 1
                  maxLength: 20000
                  description: >-
                    What the coding agent should do, in the requester's words.
                    Sent to the agent inside the brief with a link to the
                    thread.
                clientRequestId:
                  type: string
                  minLength: 1
                  maxLength: 200
                  description: >-
                    Stable per request: a retry with the same id answers the
                    attempt it already queued instead of launching a second paid
                    run. A retry that names a different thread, agent,
                    repository, branch or environment is refused.
              required:
                - organizationId
                - projectId
                - threadId
                - agent
                - task
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  issueFixId:
                    anyOf:
                      - type: string
                        format: uuid
                      - type: 'null'
                    description: >-
                      The issue fix that started this session (`issues.get`'s
                      `fixes`); null for a session Sazabi's agent started.
                  organizationId:
                    type: string
                    minLength: 1
                  projectId:
                    type: string
                    format: uuid
                  issueId:
                    anyOf:
                      - type: string
                        format: uuid
                      - type: 'null'
                  threadId:
                    type: string
                    format: uuid
                  connectionId:
                    type: string
                    format: uuid
                  provider:
                    type: string
                  requesterUserId:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: >-
                      The person who requested the fix; null for a session an
                      automatic fix started.
                  connectionOwnerUserId:
                    type: string
                  clientRequestId:
                    type: string
                  status:
                    enum:
                      - queued
                      - running
                      - waiting
                      - paused
                      - completed
                      - failed
                      - cancel_requested
                      - cancelled
                      - unknown
                    type: string
                  externalSessionId:
                    anyOf:
                      - type: string
                      - type: 'null'
                  externalTurnId:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: >-
                      The vendor's id for its latest turn: a Cursor run, a Devin
                      message.
                  sessionUrl:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: >-
                      The vendor's own page for this run: the URL its API
                      reported (Cursor, Devin, Warp Oz) or its documented page
                      for the run id (Replicas); null for a vendor with no page
                      Sazabi can name (Capy, Hoplite, Claude Agent, Codex) or
                      before the launch answered.
                  repositoryUrl:
                    type: string
                  baseBranch:
                    type: string
                  environment:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: >-
                      The vendor environment the attempt ran in, by name (a
                      Replicas organization environment, for example); null for
                      a vendor without environments or before the launch.
                  result:
                    anyOf:
                      - type: string
                      - type: 'null'
                    description: 'The vendor''s latest word: the newest inbound turn''s text.'
                  turns:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                        direction:
                          enum:
                            - outbound
                            - inbound
                          type: string
                        text:
                          anyOf:
                            - type: string
                            - type: 'null'
                        status:
                          anyOf:
                            - enum:
                                - queued
                                - running
                                - waiting
                                - paused
                                - completed
                                - failed
                                - cancel_requested
                                - cancelled
                                - unknown
                              type: string
                            - type: 'null'
                          description: 'Inbound: the status the turn announced.'
                        requestId:
                          anyOf:
                            - type: string
                            - type: 'null'
                          description: >-
                            Outbound: the request that admitted it, durably,
                            which does not acknowledge vendor acceptance.
                        userId:
                          anyOf:
                            - type: string
                            - type: 'null'
                        externalId:
                          anyOf:
                            - type: string
                            - type: 'null'
                          description: The vendor's id for the turn.
                        messageId:
                          type: string
                          format: uuid
                        sentAt:
                          anyOf:
                            - type: string
                            - type: 'null'
                        settledAt:
                          anyOf:
                            - type: string
                            - type: 'null'
                        deliveredAt:
                          anyOf:
                            - type: string
                            - type: 'null'
                        createdAt:
                          type: string
                      required:
                        - id
                        - direction
                        - text
                        - status
                        - requestId
                        - userId
                        - externalId
                        - messageId
                        - sentAt
                        - settledAt
                        - deliveredAt
                        - createdAt
                    description: >-
                      Every message across the vendor boundary, oldest first:
                      the brief and each reply outbound, each result or question
                      inbound.
                  pullRequests:
                    type: array
                    items:
                      type: string
                  pullRequestDetails:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                        number:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                          exclusiveMinimum: 0
                        repositoryFullName:
                          type: string
                        title:
                          anyOf:
                            - type: string
                            - type: 'null'
                        status:
                          anyOf:
                            - enum:
                                - open
                                - merged
                                - closed
                              type: string
                            - type: 'null'
                      required:
                        - url
                        - number
                        - repositoryFullName
                        - title
                        - status
                  progress:
                    type: array
                    items:
                      type: object
                      properties:
                        at:
                          type: string
                        role:
                          enum:
                            - agent
                            - system
                          type: string
                          description: >-
                            `agent` for the agent's own words; `system` for what
                            it did (a tool call, a command) or what happened to
                            it.
                        text:
                          type: string
                        vendorMessageId:
                          type: string
                          description: The vendor's own id for the event.
                      required:
                        - at
                        - role
                        - text
                        - vendorMessageId
                    description: >-
                      The session's live progress, oldest first: what the agent
                      said and did while it worked, for the vendors that stream
                      it.
                  reopenable:
                    type: boolean
                    description: >-
                      Whether a timed-out or expired attempt takes a reply
                      again, which reopens it.
                  createdAt:
                    type: string
                  updatedAt:
                    type: string
                required:
                  - id
                  - issueFixId
                  - organizationId
                  - projectId
                  - issueId
                  - threadId
                  - connectionId
                  - provider
                  - requesterUserId
                  - connectionOwnerUserId
                  - clientRequestId
                  - status
                  - externalSessionId
                  - externalTurnId
                  - sessionUrl
                  - repositoryUrl
                  - baseBranch
                  - environment
                  - result
                  - turns
                  - pullRequests
                  - progress
                  - reopenable
                  - createdAt
                  - updatedAt

````

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