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

# Cancel a task

> Stop a running Task so the agent stops working on it.

`force=false` (default) requests a graceful stop; `force=true` cancels immediately.


## OpenAPI

````yaml api-reference/openapi.json POST /tasks/{task_id}/cancel
openapi: 3.1.0
info:
  title: Biomni Public API — V0
  description: >-
    The public API for **Biomni** — the AI agent platform for clinical genomics
    (variant annotation, ClinVar lookups, PMID-cited literature, and project
    file drives). Create projects and Tasks, send messages to the agent, stream
    its replies, manage files, and check your usage — all from your own code.


    **Authentication**: send `Authorization: Bearer <your-api-key>`. The adapter
    forwards your key straight to Biomni; it never stores it.


    **Safe retries**: send `Idempotency-Key: <token>` on POST endpoints
    (`/projects`, `/tasks`, `/messages`, `/files/uploads`) so a retried request
    won't create a duplicate.
  version: 0.1.0
servers:
  - url: https://api.phylo.bio/api/v1
security: []
paths:
  /tasks/{task_id}/cancel:
    post:
      tags:
        - tasks
      summary: Cancel a task
      description: Stop a running Task so the agent stops working on it.
      operationId: cancel_task_tasks__task_id__cancel_post
      parameters:
        - name: task_id
          in: path
          required: true
          schema:
            type: string
            title: Task Id
        - name: force
          in: query
          required: false
          schema:
            type: boolean
            default: false
            title: Force
      responses:
        '200':
          description: Cancel accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusAck'
              example:
                id: sess_d9711ec9b477
                status: cancelled
      security:
        - bearerAuth: []
components:
  schemas:
    StatusAck:
      properties:
        id:
          type: string
          title: Id
        status:
          type: string
          title: Status
      type: object
      required:
        - id
        - status
      title: StatusAck
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Requires an API key. See the Authentication guide.

````