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

# Register a background agent



## OpenAPI

````yaml /docs/reference/openapi.json post /background/agents
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/agents:
    post:
      tags:
        - Background
      summary: Register a background agent
      operationId: register_background_agent_background_agents_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BackgroundAgentRegistrationRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BackgroundAgentSpec'
          description: Successful Response
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpErrorResponse'
          description: Conflict
        '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:
    BackgroundAgentRegistrationRequest:
      description: Register the served agent or an agent spec for background work.
      properties:
        agent_id:
          anyOf:
            - type: string
            - type: 'null'
          description: Agent id. Defaults to OmniServe background_agent_id.
          title: Agent Id
        replace:
          default: false
          description: Replace an existing agent spec
          title: Replace
          type: boolean
        spec:
          anyOf:
            - $ref: '#/components/schemas/BackgroundAgentSpec'
            - type: 'null'
          description: Optional agent spec. Omit to register the served agent.
      title: BackgroundAgentRegistrationRequest
      type: object
    BackgroundAgentSpec:
      additionalProperties: false
      properties:
        agent_config:
          additionalProperties: true
          title: Agent Config
          type: object
        agent_id:
          title: Agent Id
          type: string
        created_at:
          format: date-time
          title: Created At
          type: string
        local_tools_ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Local Tools Ref
        mcp_tools:
          items:
            additionalProperties: true
            type: object
          title: Mcp Tools
          type: array
        metadata:
          additionalProperties: true
          title: Metadata
          type: object
        model_config:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Model Config
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        system_instruction:
          anyOf:
            - type: string
            - type: 'null'
          title: System Instruction
        updated_at:
          format: date-time
          title: Updated At
          type: string
        workspace_config:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Workspace Config
      required:
        - agent_id
      title: BackgroundAgentSpec
      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
    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

````