Agent Harness Tutorial · End to end · Zoom level 2
Crash and restart
Our server scales to zero when quiet, so "restart" is not an emergency here; it is normal. DBOS treats it as normal too.
When the app starts, DBOS.launch() looks for workflows still PENDING and continues each one from its last finished step.
Two catches, written downTimers only fire while a server is running. Because ours scales to zero, a 30-minute expiry really fires at the next start. And DBOS has no workflow versioning: before changing a workflow's steps, let the waiting ones finish first.
How it is done: the real code
Cut from the live repositories each time the site is built, so it always matches what runs.
agent_harness/state/dbos.py:72launch(): on start-up, waiting workflows carry ondef launch(database_url: str, *, name: str = "agent-harness", **config: Any) -> None:
"""Start DBOS on `database_url` (a `postgresql://` URL; its system tables are
created there on first launch) and recover whatever was waiting."""
DBOS(config=cast(DBOSConfig, {"name": name, "system_database_url": database_url, **config}))
DBOS.launch()