cleandataengineering.aiAgent Harness, drawn simply
You are here: End to end › DBOS

Agent Harness Tutorial · End to end · Zoom level 1

DBOS: work that waits

Some work can't finish inside one turn. A payout over ₹25,000 must wait for a claims handler, which might take an hour. The server might restart in that hour. DBOS is a small Python library that lets a function wait for days and pick up exactly where it left off.

Goes inA payout request, or a hand-off
What happensA DBOS workflow saves each step's result in PostgreSQL and waits for a person's decision
Comes outThe payout made exactly once, or the conversation handed back, even across restarts
The turn never sits and waits. The waiting is done by the workflow, which holds no thread while it waits.

Why not just wait in the turn? A web request that waits an hour holds a connection, a thread and a server that can't scale to zero; and if the server restarts, the work is lost. A workflow stores its progress in the database instead, so nothing is held while it waits.

Why DBOS? It runs inside our process and keeps its state in the PostgreSQL we already have. Temporal does the same job well but needs its own servers. DBOS adds no new infrastructure.

Only two functions in the whole harness are workflows: approval.wait and escalation.wait.

Want every detail? The long version is in the Series: DBOS and the human desk, in full.

Compared: What keeps a run alive while it waits days for a person?

DBOSopen sourcechosenTemporalopen sourcefor long sagasDurable Task…Azureonly if Azure-onlyAzure Durabl…Azureif already on FunctionsLogic Apps S…Azureback-office onlyRestateopen sourcewatchPrefectopen sourcedata and eval jobsDIY on Postg…ourssimplest waits only
Dark: what we chose. Crossed and dashed: rejected or not for us. From the Series.
OptionFromVerdictWhere state livesNew infrastructureRules on our codeApprovals and long waitsOps burden for usExit cost
DBOSopen sourcechosenour Azure PostgreSQLnone: reuses our PostgreSQLlightdurable sleep, messages, eventslowestlow: open source, plain Postgres
Temporalopen sourcefor long sagasTemporal's store + visibility indexTemporal Cloud, or AKS clusterstrict: no clock, random, I/Osignals, updates, timers: richestlow on Cloud; high self-hostedlow in code; in-flight stays
Durable Task SchedulerAzureonly if Azure-onlymanaged by Azurea DTS resourcestrict, like Temporalexternal events, durable timerslowhigh: own model, Azure-only
Azure Durable FunctionsAzureif already on FunctionsAzure Storage, SQL or DTSrun the agent on Functionsstrict replay rulesexternal events, durable timerslow: serverlessmedium: tied to Functions
Logic Apps StandardAzureback-office onlymanaged by Azurea Logic Apps resourcenot code-first: designerbuilt-in approval emailslowhigh: designer workflows
Restateopen sourcewatchthe Restate server's storageRestate server or Clouddurable steps via its contextdurable calls, timersanother service to run, securemedium: younger ecosystem
Prefectopen sourcedata and eval jobsPrefect server databasePrefect server or Cloudlight: Python flows, tasksbuilt for batch, not peopleserver plus workersmedium
DIY on PostgreSQLourssimplest waits onlyour PostgreSQLnonenone: it is all oursstatus rows + scheduled jobwe own every bugnone
DecisionWe chose DBOS because its state lives in the PostgreSQL we already run, so it adds no infrastructure. We would move to Temporal for long undo flows (sagas) or mature versioning, and to Durable Task Scheduler only if the system must be Azure-native PaaS.

How it is done: the real code

Cut from the live repositories each time the site is built, so it always matches what runs.

config/azure.yaml:82The approval port on Azure: DBOS
  approval:
    adapter: dbos-workflows
    url: {key_vault: agent-database-url}
    name: claims-fnol

app:

Tech choices (what we chose, Azure and open-source options): L14 · Human-in-the-loop

Look inside