cleandataengineering.aiAgent Harness, drawn simply
You are here: Tech stack › L14 · Human-in-the-loop

Agent Harness Tutorial · Tech stack

L14 · Human-in-the-loop

Approvals and hand-offs the agent cannot grant itself. Family: Control · one turn, in order.

AZURE OPTIONSDurable Task Scheduler✗ dropped: only if Azure for goodDurable Functions✗ dropped: only if already on FunctionsLogic Apps + Teams cards✗ dropped: not code-firstOUR CHOICEDBOS 3.2.0durable waits in our PostgreSQLDesk API /opsbuiltTeams cardsplannedOPEN-SOURCE OPTIONSDBOS✓ used: no new infrastructureTemporal· considered: long sagas, high volumeRestate· considered: watchInngest✗ dropped: not for regulated waitsPrefect· considered: batch and eval jobs onlyWHO DOES THE WORKAzure gives 20% · we code once 55% · each agent team still does 25%
Dark boxes are what we run. Solid boxes are used or planned; dashed boxes were considered or dropped (crossed). The bar: grey is what Azure gives, dark is what we code once, hatched is what each agent team writes.
Why our choiceDBOS adds no infrastructure, is Python-native and the cheapest to leave. Moving to Temporal means changing two adapters.
OptionWhere fromVerdictWhy
DBOS 3.2.0ours✓ chosendurable waits in our PostgreSQL
Desk API /opsours✓ chosenbuilt
Teams cardsours✓ chosenplanned
Durable Task SchedulerAzure✗ droppedonly if Azure for good
Durable FunctionsAzure✗ droppedonly if already on Functions
Logic Apps + Teams cardsAzure✗ droppednot code-first
DBOSopen source✓ usedno new infrastructure
Temporalopen source· consideredlong sagas, high volume
Restateopen source· consideredwatch
Inngestopen source✗ droppednot for regulated waits
Prefectopen source· consideredbatch and eval jobs only

How it works inside the harness: DBOS.

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.

  approval:
    adapter: dbos-workflows
    url: {key_vault: agent-database-url}
    name: claims-fnol

app:
@DBOS.workflow(name=WORKFLOW)
async def _wait(ask: Ask) -> Approval:
    return await _Run(ask).run()


class _Run:
    """One approval's moves. Deterministic apart from its steps, as a DBOS
    workflow must be: everything it reads from outside is a step or a message."""

    def __init__(self, ask: Ask) -> None:
        self.ask = ask
        self.approval: Approval | None = None