INNER CODE UNIT · Python
readiness_check
bytedance/deer-flow · backend/app/gateway/app.py:887
async def readiness_check(request: Request, response: Response) -> dict[str, str]:
"""Readiness endpoint: 200 when the persistence backends are reachable.
Probes the ORM engine behind ``database:`` and the effective LangGraph
checkpointer/Store backend (legacy ``checkpointer:`` section, otherwise
derived from ``database:``) concurrently beneath one bounded deadline.
The checkpointer config comes from the startup snapshot recorded by
``langgraph_runtime`` (never hot-reloaded config), so orchestrators can
gate on the gateway actually being ready rather than merely alive.
Returns 503 with ``status: degraded`` when either probe fails or the
startup backend cannot be resolved.
"""
checkpointer_config = getattr(request.app.state, READINESS_CHECKPOINTER_CONFIG_ATTR, None)
status_code, payload = await readiness_payload(checkpointer_config)
response.status_code = status_code
return payload
# Extension routes are deliberately last: FastAPI/Starlette dispatches in