> ## 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.

# Inspect background task status



## OpenAPI

````yaml /docs/reference/openapi.json get /background/tasks/{task_id}/status
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/tasks/{task_id}/status:
    get:
      tags:
        - Background
      summary: Inspect background task status
      operationId: get_background_task_status_background_tasks__task_id__status_get
      parameters:
        - in: path
          name: task_id
          required: true
          schema:
            title: Task Id
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackgroundTaskStatusResponse'
          description: Successful Response
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
          description: Not Found
        '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:
    BackgroundTaskStatusResponse:
      description: Inspectable status for one background task.
      properties:
        active_runs:
          title: Active Runs
          type: integer
        agent_id:
          title: Agent Id
          type: string
        enabled:
          title: Enabled
          type: boolean
        latest_run:
          anyOf:
            - $ref: '#/components/schemas/BackgroundRun'
            - type: 'null'
        runs:
          title: Runs
          type: integer
        schedule:
          $ref: '#/components/schemas/ScheduleSpec'
        schedule_state:
          anyOf:
            - $ref: '#/components/schemas/BackgroundScheduleState'
            - type: 'null'
        status_counts:
          additionalProperties:
            type: integer
          title: Status Counts
          type: object
        task_id:
          title: Task Id
          type: string
      required:
        - task_id
        - agent_id
        - enabled
        - schedule
        - schedule_state
        - runs
        - active_runs
        - status_counts
        - latest_run
      title: BackgroundTaskStatusResponse
      type: object
    HttpErrorResponse:
      description: Response shape produced by FastAPI HTTPException.
      properties:
        detail:
          description: Error detail
          title: Detail
      required:
        - detail
      title: HttpErrorResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      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
    ScheduleSpec:
      additionalProperties: false
      properties:
        end_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: End At
        expression:
          anyOf:
            - type: string
            - type: 'null'
          title: Expression
        jitter_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Jitter Seconds
        misfire_policy:
          $ref: '#/components/schemas/MisfirePolicy'
          default: skip_missed
        run_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Run At
        seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seconds
        start_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Start At
        timezone:
          default: UTC
          title: Timezone
          type: string
        type:
          $ref: '#/components/schemas/ScheduleType'
      required:
        - type
      title: ScheduleSpec
      type: object
    BackgroundScheduleState:
      additionalProperties: false
      properties:
        last_dispatched_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Dispatched At
        last_due_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Last Due At
        misfire_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Misfire Cursor
        next_due_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Next Due At
        paused:
          default: false
          title: Paused
          type: boolean
        paused_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Paused Reason
        schedule_revision:
          default: 1
          title: Schedule Revision
          type: integer
        task_id:
          title: Task Id
          type: string
        updated_at:
          format: date-time
          title: Updated At
          type: string
      required:
        - task_id
      title: BackgroundScheduleState
      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
    MisfirePolicy:
      enum:
        - skip_missed
        - run_once
        - queue_all
      title: MisfirePolicy
      type: string
    ScheduleType:
      enum:
        - manual
        - interval
        - cron
        - once
      title: ScheduleType
      type: string

````