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.
Headers
Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.
Response
Successful Response
The service health response.
Overall service status. not_ready when any required component is missing; disabled optional features do not affect it.
ok, not_ready The API version this app was created with.
Per-subsystem readiness. disabled marks an optional feature the deployment did not enable.