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

# Report service liveness and per-component readiness

> Report whether the service is ready to serve requests.

The check is deliberately I/O-free — it only inspects what is
attached to ``app.state``, so probing it never touches Redis, the
database or a workspace backend.

Under a plain ``uvicorn.run(app)`` the ``not_ready`` status is
effectively unreachable: uvicorn completes the lifespan startup
before it accepts connections, so anything that reaches this handler
already has the lifespan components in place.  What it does catch is
the mount-as-sub-app deployment documented in
:func:`~agentscope.app.create_app` — Starlette does not run a mounted
sub-app's lifespan, so every lifespan component stays missing and
all business endpoints are broken.  Reporting 503 here turns that
silent misconfiguration into one clear signal.

Args:
    request (`Request`): The incoming FastAPI request.
    response (`Response`): The outgoing response, whose status code
        is downgraded to ``503`` when the service is not ready.

Returns:
    `HealthResponse`: The overall status, API version and the
    per-component readiness map.



## OpenAPI

````yaml /versions/2.0.6dev/en/deploy/openapi.json get /health
openapi: 3.1.0
info:
  title: AgentScope
  version: 2.0.6dev
servers: []
security: []
paths:
  /health:
    get:
      tags:
        - health
      summary: Report service liveness and per-component readiness
      description: |-
        Report whether the service is ready to serve requests.

        The check is deliberately I/O-free — it only inspects what is
        attached to ``app.state``, so probing it never touches Redis, the
        database or a workspace backend.

        Under a plain ``uvicorn.run(app)`` the ``not_ready`` status is
        effectively unreachable: uvicorn completes the lifespan startup
        before it accepts connections, so anything that reaches this handler
        already has the lifespan components in place.  What it does catch is
        the mount-as-sub-app deployment documented in
        :func:`~agentscope.app.create_app` — Starlette does not run a mounted
        sub-app's lifespan, so every lifespan component stays missing and
        all business endpoints are broken.  Reporting 503 here turns that
        silent misconfiguration into one clear signal.

        Args:
            request (`Request`): The incoming FastAPI request.
            response (`Response`): The outgoing response, whose status code
                is downgraded to ``503`` when the service is not ready.

        Returns:
            `HealthResponse`: The overall status, API version and the
            per-component readiness map.
      operationId: get_health_health_get
      parameters:
        - name: x-user-id
          in: header
          required: true
          schema:
            type: string
            description: >-
              Caller's user ID. Temporary header-based identity; will be
              replaced by JWT auth.
            title: X-User-Id
          description: >-
            Caller's user ID. Temporary header-based identity; will be replaced
            by JWT auth.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HealthResponse:
      properties:
        status:
          type: string
          enum:
            - ok
            - not_ready
          title: Status
          description: >-
            Overall service status. ``not_ready`` when any required component is
            missing; disabled optional features do not affect it.
        version:
          type: string
          title: Version
          description: The API version this app was created with.
        components:
          additionalProperties:
            type: string
            enum:
              - ok
              - not_ready
              - disabled
          type: object
          title: Components
          description: >-
            Per-subsystem readiness. ``disabled`` marks an optional feature the
            deployment did not enable.
      type: object
      required:
        - status
        - version
        - components
      title: HealthResponse
      description: The service health 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

````