durable.lifecycle
DBOS lifecycle management for agent-runtimes.
Handles DBOS database initialization, launch, health checking, recovery of pending workflows, and graceful shutdown.
DurableLifecycle Objects
class DurableLifecycle()
Manages the DBOS lifecycle within the agent-runtimes process.
Typical usage inside the FastAPI lifespan::
lifecycle = DurableLifecycle(config)
await lifecycle.launch() # On startup
...
await lifecycle.shutdown() # On shutdown
Parameters
config : DurableConfig Configuration for the DBOS backend.
launch
async def launch() -> None
Initialize and launch DBOS.
Creates the database directory (for SQLite), calls DBOS.launch(),
and optionally triggers recovery of pending workflows.
shutdown
async def shutdown() -> None
Gracefully shut down DBOS.
Flushes any pending state and closes database connections.
is_healthy
def is_healthy() -> bool
Check if DBOS is running and healthy.
Returns
bool True if DBOS was launched and is available.
prepare_checkpoint
async def prepare_checkpoint() -> dict
Prepare for a CRIU checkpoint by flushing DBOS state.
Called by the companion's /v1/prepare-checkpoint endpoint
before the container is frozen.
Returns
dict Metadata about the DBOS state at checkpoint time.
post_restore
async def post_restore() -> None
Re-initialize after a CRIU restore.
Called by the companion's /v1/post-restore endpoint after the
container is unfrozen. Re-establishes database connections.