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

# List background runs



## OpenAPI

````yaml /docs/reference/openapi.json get /background/runs
openapi: 3.1.0
info:
  description: >-
    The HTTP API of an agent served with `omniserve run --agent agent.py`: runs,
    approvals, budgets, background tasks, sessions and the evidence of every
    run.
  title: OmniServe
  version: latest
servers:
  - description: omniserve run, locally
    url: http://localhost:8000
security: []
paths:
  /background/runs:
    get:
      tags:
        - Background
      summary: List background runs
      operationId: list_background_runs_background_runs_get
      parameters:
        - in: query
          name: task_id
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Task Id
        - in: query
          name: status
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Status
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackgroundRunsResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
          description: Service Unavailable
components:
  schemas:
    BackgroundRunsResponse:
      description: Response model for background run listing.
      properties:
        runs:
          items:
            $ref: '#/components/schemas/BackgroundRun'
          title: Runs
          type: array
        total:
          title: Total
          type: integer
      required:
        - runs
        - total
      title: BackgroundRunsResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    HttpErrorResponse:
      description: Response shape produced by FastAPI HTTPException.
      properties:
        detail:
          description: Error detail
          title: Detail
      required:
        - detail
      title: HttpErrorResponse
      type: object
    BackgroundRun:
      additionalProperties: false
      properties:
        agent_id:
          title: Agent Id
          type: string
        attempt:
          default: 0
          title: Attempt
          type: integer
        cancel_requested_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Cancel Requested At
        claimed_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Claimed At
        due_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Due At
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        finished_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Finished At
        heartbeat_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Heartbeat At
        lease_expires_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Lease Expires At
        lease_generation:
          default: 0
          title: Lease Generation
          type: integer
        lease_owner:
          anyOf:
            - type: string
            - type: 'null'
          title: Lease Owner
        lease_token:
          anyOf:
            - type: string
            - type: 'null'
          title: Lease Token
        max_attempts:
          default: 1
          title: Max Attempts
          type: integer
        metadata:
          additionalProperties: true
          title: Metadata
          type: object
        occurrence_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Occurrence Id
        query_snapshot:
          title: Query Snapshot
          type: string
        queued_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Queued At
        result_preview:
          anyOf:
            - type: string
            - type: 'null'
          title: Result Preview
        run_id:
          title: Run Id
          type: string
        session_id:
          title: Session Id
          type: string
        started_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Started At
        status:
          $ref: '#/components/schemas/RunStatus'
          default: queued
        task_id:
          title: Task Id
          type: string
        trigger_metadata:
          additionalProperties: true
          title: Trigger Metadata
          type: object
        trigger_type:
          $ref: '#/components/schemas/TriggerType'
        triggered_at:
          format: date-time
          title: Triggered At
          type: string
        workspace_path:
          title: Workspace Path
          type: string
      required:
        - task_id
        - agent_id
        - query_snapshot
        - trigger_type
        - session_id
        - workspace_path
      title: BackgroundRun
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
    RunStatus:
      enum:
        - queued
        - claimed
        - running
        - retrying
        - completed
        - failed
        - cancelled
        - timeout
        - skipped
        - awaiting_approval
        - awaiting_budget
      title: RunStatus
      type: string
    TriggerType:
      enum:
        - manual
        - interval
        - cron
        - once
      title: TriggerType
      type: string

````