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

# Cancel Runs

> Cancel several runs at once, by status or by thread_id plus run_ids.

Runs the caller does not own or that already finished are skipped. The
thread must exist for the run_ids form; unknown run ids are ignored.



## OpenAPI

````yaml /openapi.json post /runs/cancel
openapi: 3.1.0
info:
  title: Aegra
  description: Production-ready Agent Protocol server
  version: 0.10.5
servers: []
security: []
tags:
  - name: Assistants
    description: A configured instance of a graph.
  - name: Threads
    description: Accumulated state and outputs from a group of runs.
  - name: Thread Runs
    description: Invoke a graph on a thread, updating its persistent state.
  - name: Stateless Runs
    description: Invoke a graph without state or memory persistence.
  - name: Crons
    description: Scheduled recurring runs on a cron schedule.
  - name: Store
    description: Persistent key-value and semantic storage available from any thread.
  - name: Event Streaming
    description: Agent Protocol v2 thread event streaming and commands.
  - name: Health
    description: Server health checks and service information.
paths:
  /runs/cancel:
    post:
      tags:
        - Thread Runs
      summary: Cancel Runs
      description: |-
        Cancel several runs at once, by status or by thread_id plus run_ids.

        Runs the caller does not own or that already finished are skipped. The
        thread must exist for the run_ids form; unknown run ids are ignored.
      operationId: cancel_runs_runs_cancel_post
      parameters:
        - name: action
          in: query
          required: false
          schema:
            enum:
              - cancel
              - interrupt
            type: string
            description: >-
              Cancellation strategy: 'cancel' for hard cancel, 'interrupt' for
              cooperative interrupt.
            default: interrupt
            title: Action
          description: >-
            Cancellation strategy: 'cancel' for hard cancel, 'interrupt' for
            cooperative interrupt.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RunsCancel'
      responses:
        '204':
          description: Successful Response
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentProtocolError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RunsCancel:
      properties:
        status:
          anyOf:
            - type: string
              enum:
                - pending
                - running
                - all
            - type: 'null'
          title: Status
          description: >-
            Cancel every active run of the caller in this status. 'all' means
            pending and running.
        thread_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Thread Id
          description: Thread that owns the runs listed in run_ids.
        run_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Run Ids
          description: Runs to cancel; requires thread_id.
      type: object
      title: RunsCancel
      description: >-
        Selector for ``POST /runs/cancel``: a status filter, or thread_id plus
        run_ids.
    AgentProtocolError:
      properties:
        error:
          type: string
          title: Error
          description: Error type
        message:
          type: string
          title: Message
          description: Human-readable error message
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: Additional error details
      type: object
      required:
        - error
        - message
      title: AgentProtocolError
      description: Standard Agent Protocol error response
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````