Skip to content

[Epic] Durable Execution v0.1 #752

Description

@kriszyp

Summary

Tracking issue for a Harper-native durable execution engine: a workflow runtime where step results are checkpointed, workflows survive crashes via replay, signals/sleeps survive node restarts, and — Harper's structural differentiator — workflow checkpoints commit atomically with multi-model application data inside a single Harper transaction.

Source proposal: design doc (Durable Execution on Harper) — happy to attach on request, but the salient details are below and broken out into child issues.

Why

Every major agent framework (LangGraph 1.0, LlamaIndex Workflows, Pydantic AI, OpenAI Agents SDK + Temporal) has converged on durable execution as a baseline for production AI agent workloads. Harper's pitch is unique here: because the database engine and application/Resource layer run in the same Node.js process, the workflow checkpoint can ride inside the same LMDB/RocksDB transaction as the user's table writes. Temporal cannot do this. DBOS can do it only when every write is SQL against the same Postgres-compatible database. For multi-model agent data, Harper would be the only credible option.

Architectural position

Two compounding benefits:

  1. Atomic commits between workflow state and multi-model application data when data lives in Harper.
  2. Lower engine overhead per step regardless of where data lives — every step transition is in-process function calls + a local commit, not several network round trips.

These support both "system of record stays in Harper" and "system of record stays elsewhere; agent working data + workflow state in Harper" deployments.

Scope of v0.1

New-core primitives that cannot be approximated on top of existing Harper primitives:

Reusable as-is (not separate issues)

The proposal identified primitives already present:

  • `transaction(fn)` in resources/transaction.ts for multi-statement atomic writes within a database — direct foundation for `ctx.atomic`.
  • `Context` propagation via `AsyncLocalStorage` — the natural carrier for workflow context.
  • SES Compartment support in security/jsLoader.ts — substrate for the determinism sandbox.

POC-tier (do inline during prototyping)

Per scope decision, no separate tickets for POC-tier items now — they will be assembled on existing primitives during v0.1 prototyping and replaced with optimized core primitives as benchmarks expose ceilings:

  • Commit-log subscription via `RocksTransactionLogStore` `'aftercommit'` hook → needs a workflow-aware fast-path filter at scale
  • Point-in-time replay via the existing audit-log + `getRecordAtTime` → needs a dedicated workflow event store with workflow-ID-keyed indexes and its own retention
  • Signal delivery via the Resource subscription mechanism → may need a workflow-specific signal primitive for one-shot wake-and-resume routing
  • Scheduler as a polling Resource on `(fireAt, workflowId, stepId, payload)` rows → replaced by the durable timer service (Native durable timer service (sharded hierarchical timing wheel) #754)

v0.2 follow-ups

  • Cross-database atomicity for workflows that span databases. Multi-database writes inside `transaction(fn)` are chained sequentially with no 2PC (`DatabaseTransaction.this.next`) — partial-write hazard if the workflow checkpoint and user data live in different DBs. v0.1 answer: workflows scoped to a single database. v0.2 needs 2PC or a saga primitive at the workflow layer.

Alignment with related work

What this is not solving

  • Universal cross-system atomicity. External calls (LLM providers, Stripe, third-party APIs) remain at-least-once with idempotency keys.
  • A turnkey Temporal replacement at scale. Different sweet spot: workloads where the atomic-commit-with-data guarantee is decisive.
  • Multi-tenant managed workflows. Workflows for untrusted multi-tenant scenarios require hardening SES Compartment isolation or process-level isolation — out of scope for initial release.

Open product questions

  • Design partner first vs. spec first (proposal recommends design partner before v0.1 lands).
  • Declarative graph DSL in addition to imperative TS workflows?
  • User control over sharding granularity?
  • Pricing/packaging — Harper feature, separate tier, or Fabric-only?
  • Determinism strictness — mechanical SES enforcement vs. convention + warnings?

🤖 Filed by Claude on behalf of @kriszyp

Activity

  1. kylebernhardy commented on Jun 10, 2026

    @kylebernhardy
    Member

    Agent-builder perspective on the "declarative graph DSL" open question

    We're scoping a visual agent/workflow builder in Studio — users compose agents (triggers → steps → tools → actions) on a canvas, with definitions running on this engine. That work effectively answers the open product question here: yes, we need the declarative graph DSL — and it should be designed as one artifact with this epic, not bolted on later. The DSL is the builder's file format; the builder is the DSL's editor.

    What the builder needs from the DSL

    1. Definitions-as-data. Workflow/agent definitions stored as records in Harper tables — so they replicate, version, and audit like everything else — and compile to Workflow developer API surface (Workflow base class, ctx.step, ctx.atomic, ctx.signal, ctx.sleep) #757's Workflow API. Imperative TS stays the escape hatch and the compile target; the DSL never needs to express everything.
    2. Node bodies that reference TS steps rather than replace them. We decomposed harper-support as the canonical target workload (notably, Workflow developer API surface (Workflow base class, ctx.step, ctx.atomic, ctx.signal, ctx.sleep) #757's API example is literally TriageSupportTicket — same use case). It splits ~90% into builder-shaped blocks (webhook triggers, scheduled syncs, vector RAG tables, gated tool registry, agentic loop, structured-output constraints, Zendesk actions), but the remaining 10% (Levenshtein customer matching, conversation truncation) resists visual representation. The market validates this: the consolidating pattern in 2026 is visual canvas + real code escape hatch (Copilot Studio's visual↔code round-tripping, Langflow nodes exposing editable source, Windmill's code-primary DAGs) — while OpenAI is sunsetting its pure-visual Agent Builder. A DSL node should be expandable into a ctx.step body, not a walled garden.
    3. Trigger bindings carried in the DSL. The one runtime piece not yet covered by this epic or its neighbors: declaratively binding table-commit subscriptions, MQTT topics, generated webhook endpoints, and cron (Cron schedule interface for component execution #951/Native durable timer service (sharded hierarchical timing wheel) #754) to workflow invocations. If the DSL owns trigger wiring, the builder gets it for free and the "agents triggered by data changes inside the database" story — which no visual builder on the market has (they're all webhook/schedule-only) — becomes the headline.

    Stack mapping as we see it

    Builder layer Engine/backlog
    Compile target #757 Workflow (ctx.step/ctx.atomic/ctx.signal/ctx.sleep)
    Tool registry MCP Application + Operations profiles (#465, shipped) + #852 registry-backed resolution
    Model/agent loop #510 scope.models + #612 toolMode: 'auto'
    Memory #511 ConversationResource
    HITL/approvals ctx.signal + an approval-record convention the builder UI renders
    Secrets for connectors #715 hdb_env / #816 Key Vault
    Run observability UI Studio view over the #755 step-journal store

    Also worth stating for positioning: the atomic checkpoint-with-multi-model-data commit is exactly the differentiator the builder markets — Convex is the only structurally comparable platform (agents native to the database) and it has no visual builder and no distributed story; DBOS only gets atomicity when everything is SQL in one Postgres.

    Full competitive-landscape research (Dify/n8n/Copilot Studio/Convex/DBOS/Temporal/Cloudflare et al.) available on request.

    🤖 Drafted with Claude Code on behalf of @kylebernhardy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    Priority

    P2

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions