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

# Get a background task



## OpenAPI

````yaml /docs/reference/openapi.json get /background/tasks/{task_id}
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}:
    get:
      tags:
        - Background
      summary: Get a background task
      operationId: get_background_task_background_tasks__task_id__get
      parameters:
        - in: path
          name: task_id
          required: true
          schema:
            title: Task Id
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackgroundTaskSpec'
          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:
    BackgroundTaskSpec:
      additionalProperties: false
      properties:
        agent_id:
          title: Agent Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        enabled:
          default: true
          title: Enabled
          type: boolean
        metadata:
          additionalProperties: true
          title: Metadata
          type: object
        overlap_policy:
          $ref: '#/components/schemas/OverlapPolicy'
          default: skip_if_running
        query:
          title: Query
          type: string
        retry_policy:
          $ref: '#/components/schemas/RetryPolicy'
        schedule:
          $ref: '#/components/schemas/ScheduleSpec'
        session_policy:
          $ref: '#/components/schemas/SessionPolicy'
        task_id:
          title: Task Id
          type: string
        timeout_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Timeout Seconds
        updated_at:
          format: date-time
          title: Updated At
          type: string
        workspace_policy:
          $ref: '#/components/schemas/WorkspacePolicy'
      required:
        - task_id
        - agent_id
        - query
        - schedule
      title: BackgroundTaskSpec
      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
    OverlapPolicy:
      enum:
        - skip_if_running
        - queue_next
        - cancel_previous
        - allow_parallel
      title: OverlapPolicy
      type: string
    RetryPolicy:
      additionalProperties: false
      properties:
        backoff:
          $ref: '#/components/schemas/BackoffPolicy'
          default: fixed
        initial_delay_seconds:
          default: 30
          title: Initial Delay Seconds
          type: integer
        max_delay_seconds:
          default: 300
          title: Max Delay Seconds
          type: integer
        max_retries:
          default: 0
          title: Max Retries
          type: integer
        retry_on:
          items:
            type: string
          title: Retry On
          type: array
      title: RetryPolicy
      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
    SessionPolicy:
      additionalProperties: false
      properties:
        mode:
          $ref: '#/components/schemas/SessionMode'
          default: task
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
      title: SessionPolicy
      type: object
    WorkspacePolicy:
      additionalProperties: false
      properties:
        namespace_template:
          default: background/{agent_id}/{task_id}/{run_id}
          title: Namespace Template
          type: string
        write_events_jsonl:
          default: true
          title: Write Events Jsonl
          type: boolean
        write_run_json:
          default: true
          title: Write Run Json
          type: boolean
      title: WorkspacePolicy
      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
    BackoffPolicy:
      enum:
        - fixed
        - exponential
      title: BackoffPolicy
      type: string
    MisfirePolicy:
      enum:
        - skip_missed
        - run_once
        - queue_all
      title: MisfirePolicy
      type: string
    ScheduleType:
      enum:
        - manual
        - interval
        - cron
        - once
      title: ScheduleType
      type: string
    SessionMode:
      enum:
        - task
        - run
        - fixed
      title: SessionMode
      type: string

````