Diskless durable execution for agents, workflows and stateful services

Agents that outlive your servers.

Every model call, tool call and approval is journaled to object storage. Kill the node, redeploy, scale out — each chat picks up at the step it stopped, without paying for the model twice.

Read the quickstartWatch film (48s)
More prompts →
agent.tsVercel AI SDK v7
import { streamText, wrapLanguageModel } from "ai"
import { chatObject, cairnMiddleware, cairnTools } from "@cairnflow/sdk"

export const chat = chatObject("Chat", async (ctx, turn) =>
  streamText({
    model: wrapLanguageModel({
      model: anthropic("claude-sonnet-5-5"),
      middleware: cairnMiddleware(ctx),   // every model call → a step
    }),
    tools: cairnTools(ctx, { lookupOrder, refund }, {
      approve: ["refund"],              // waits for a human
    }),
    messages: turn.messages,
  }),
)

serve({ services: [chat] })
Chat/c_8f2a · turn 3runningnode-a · range 40–7f
  1. llm.generatejournaled1.4s
  2. tool lookupOrderran once · result in journal0.2s
  3. llm.generatecalling the model on node-a…
  4. tool refundnot started
  5. stream replynot started
Go on — send it a kill -9.
0 lostof 701,034 acknowledged results checked after a 24-hour soak — 3 nodes, 5,231 kill -9s, one every 10 s
4 protocolsmodel-checked across every interleaving — leases, split and merge, the shared WAL, and the invocation lifecycle
160named failpoints, plus every conditional write made ambiguous once in the test suite
48-second tour

Watch a run survive kill -9.

Every completed step lands in S3. Kill the node, replay finished steps in 0 ms, suspend human approvals to bytes, and run on stateless compute with no disks.

Why object storage

Agents spend most of their lives waiting. Waiting should cost bytes, not servers.

Most of an agent's life is spent waiting on a model, a tool or a person. On Cairnflow that waiting lives in the bucket as journals and state, not in a process, a database connection or a disk you keep paying for.

WritesOne log per node, not per runSteps from every run on a node are batched into one shared write-ahead log, so a busy node makes one write per batch, not one per step. A step is confirmed the moment its batch is in the bucket.
WaitingA paused run is just bytesA run waiting on an approval, a timer or a webhook holds no process, no memory and no connection. It is its journal and state in the bucket until something wakes it, a minute or a month later.
HistoryLong chats, flat writes per turnLarge state is stored as immutable segments: a turn writes the new tail and reuses the rest. A turn journals about 218 KB whether the history is 1, 3 or 6 MiB, and an 8 MiB history ran 200 turns under a 1 MiB payload limit.
OwnershipOne bucket holds everythingJournals, state, timers, queues and segments live in one S3-compatible bucket — no database to size or replicate. Back it up and inspect it with the tools you already use; self-hosted, it is your bucket.

History figures are from the engine's test suite and a 200-turn chat test against a local S3-compatible store.

Use cases

Agents first. Not agents only.

The same runtime — durable steps, state per key, timers and promises, all on object storage — runs any code that must finish what it started.

01

AI agents

Chat agents, tool loops and research runs. Model and tool calls become steps, approvals wait on durable promises, streams reconnect after a reload.

cairnTools(ctx, tools, {
  approve: ["refund"],
})
Build an agent →
02

Durable workflows

Signups, onboarding, document pipelines: many steps, one run per ID, waits of minutes or weeks — on a server or a serverless function.

const clicked = await ctx
  .promise("email-link-clicked").get()
Write a workflow →
03

Stateful objects

State per user, account or device behind a key. One writer per key at a time, so no locks, no lost updates, no separate state store.

ctx.set("balance", balance + amount)
Model state →
04

Sagas and payments

Charge, reserve, ship — and undo the earlier steps when a later one fails for good. Each side effect is recorded, so a retry never charges twice.

catch (e) {
  if (e instanceof TerminalError)
    await ctx.run("undo", undoCharge)
  throw e
}
Handle failures →
05

Schedules and background jobs

Server-side cron with time zones, delayed sends, and fan-out to thousands of child jobs — with retries and no external scheduler or queue.

cron: "0 2 * * *",
timeZone: "Europe/Berlin",
Schedule work →
06

Webhooks and events

Accept a webhook, acknowledge it once it is durable, process it after. Idempotency keys drop duplicates; per-scope concurrency and rate limits keep noisy tenants in check.

POST /invoke/Orders/handle/send
Idempotency-Key: evt_8a1f
Ingest events →
Runs where your code runsserve() in TypeScript (Node.js 22.6+), Python 3.11+ or Go 1.25+ on a container, VM or KubernetesfetchHandler on Vercel, Cloudflare Workers, AWS Lambda, Deno or Bun — plus AWS Lambda in Python and Go
Bring your agent

Keep your AI SDK code. Stop losing its work.

A few lines change. streamText, your tools and useChat stay as they are — cairnflow records each model and tool call as a step, so a retry replays it from the journal instead of calling the provider again.

  • Tool approvals wait on a durable promise — approve from the chat, an admin page or a Slack webhook.
  • Reload the page mid-answer and useChat reconnects to the same run.
  • stop() cancels the run; with the streaming transport it also aborts the model call in flight and keeps the partial answer in history.
agent.ts+5 −3
+ export const chat = chatObject("Chat", async (ctx, turn) =>
streamText({
− model: anthropic("claude-sonnet-5-5"),
+ model: wrapLanguageModel({ model: anthropic("claude-sonnet-5-5"),
+ middleware: cairnMiddleware(ctx) }),
− tools,
+ tools: cairnTools(ctx, tools, { approve: ["refund"] }),
− messages,
+ messages: turn.messages,
})
+ )
Primitives

Building blocks for code that has to finish. Nothing you have to babysit.

Durable steps

Once a step's result is journaled, every retry reads it back instead of running it again — the card is charged once, not on every replay.

await ctx.run("charge", () => charge(order))

Humans in the loop

A durable promise suspends the run in storage. The approval can come a minute or a month later, from anywhere.

transport.approve(chatId, id, { approved: true })

Streams that reconnect

The answer reaches the browser over SSE: token by token with the streaming transport, a step at a time in request-response mode. A reload picks the stream back up; stop() cancels cooperatively.

useChat({ id: chatId, transport, resume: true })

One turn per chat

A virtual object per chat ID keeps the history in state and never runs two turns of the same conversation at once.

chatObject("Chat", run) // keyed by chatId

Timers and schedules

Sleep for three days without a process. Run agents on a server-side cron with a time zone — no external scheduler.

cron: "0 2 * * *", timeZone: "Europe/Berlin"

Artifacts

Screenshots, PDFs and long transcripts go to storage beside the run. The journal keeps a reference, not the bytes.

ctx.artifact.put(png, { contentType: "image/png" })
Architecture

No database. No disks. State lives on object storage.

Nodes keep nothing they cannot lose. Each one owns a range of keys through a lease in the bucket; when it dies, another node reads the range back from storage and carries on.

serve()Node.js 22.6+ · Python 3.11+ · Go 1.25+fetchHandlerVercel · Workers · Lambda · Deno · Bun
HTTP · your services
node-akilledrange 00–3f
node-bleaderrange 00–3f ← took overrange 40–7f
node-cleaderrange 80–bfrange c0–ff
lease + compare-and-swap · ack after durable
shared WAL — one log per node, batched across runs
journals · state · timers · queues — per key range
S3-compatible bucketthe only stateful thing
  1. 01Stateless nodesReplace, restart or add a node without moving data. There is no volume to attach and no replica to rebuild.
  2. 02Ownership by leaseA node writes to a key range only while it holds the lease, checked with compare-and-swap. A paused or partitioned node cannot overwrite its successor.
  3. 03Acknowledged means durableA step is confirmed to your code only after its write is in the bucket. What you were told happened survives any crash.
  4. 04Ranges split as load movesA hot key range splits in two and its halves move to other nodes — no resharding project.
Console

See every step. Query every run.

Open any invocation to read its journal, timeline and trace, and why it is waiting. Retry from a step, cancel, or resume. Invocations are SQL tables, so the stuck run is a query away.

JournalTimelineTraceStreamssuspended
Waiting on promise approve-call_7Qx since 2 h 14 min
  1. 0Input{ text: "where is order 4512?" }12 B
  2. 1Runllm claude-sonnet-5-5ok
  3. 2Runtool lookupOrderok
  4. 3Runllm claude-sonnet-5-5ok
  5. 4Promiseapprove-call_7Qxwaiting
Query⌘ ↵ to run
SELECT service, status, count(*) AS n
FROM sys_invocation
WHERE class = 'active'
GROUP BY service, status
ORDER BY n DESC
servicestatusn
Chatsuspended[n]
OrderSyncsuspended[n]
Chatrunning[n]
How we test

A runtime you trust with side effects has to be proven, not hoped.

Model checkingEvery interleaving, exploredLeases, split and merge, the shared WAL and the invocation lifecycle are model-checked. Each model must find the bug again when a past fix is removed.
Deterministic simulationSame seed, same runA whole cluster runs under one seeded clock and network: store faults, dropped messages, killed nodes. Any failure replays exactly.
Fault injectionCrash at every step160 failpoints. Tests that crash at every step of a split and of the shared WAL. Every conditional write returns an ambiguous result once.
Chaos soakkill -9 every 10 seconds, for a day24 hours, three nodes, 5,231 kills, injected store faults, backups and restores every 15 minutes. 701,034 acknowledged results checked: none lost, none wrong, with a full consistency check every five minutes.

Soak figures are from our test rig on a single-process S3-compatible store with injected request faults and latency.

Run it your way.

Self-hostedv0.1.0-beta.0
Freesource-available · BSL 1.1
  • One runtime binary — no coordinator, no etcd, no database
  • Your S3-compatible bucket holds everything
  • Console with journal, timeline and SQL
  • SSO, roles and an audit log built in
  • Prebuilt binaries (Linux, macOS), Docker image (ghcr.io/cairnflowdev/cairnflow), or build from source
  • TypeScript (@cairnflow/sdk), Python (cairnflow) and Go SDKs — zero runtime dependencies
Cairnflow CloudWaitlist open
Early accessthe runtime, hosted for you
  • Managed Cairnflow clusters on object storage — no nodes to run
  • No public launch date yet; self-host for free in the meantime
  • Leave your email to hear when early access opens

Only Cairnflow Cloud invites and major releases. No spam.

Read the Cloud docs →

Questions

The docs go deeper on every answer.

Do I have to rewrite my agent?

No. With the Vercel AI SDK you wrap the model with cairnMiddleware and the tools with cairnTools; streamText and useChat stay. Other code uses ctx.run around each side effect.

How fast is a step?

A step is confirmed when the batch of the node's shared log that holds it is durable in the bucket, so step latency follows the store you run on — object stores built for low latency answer a write in single-digit milliseconds. Batching keeps a busy node at one write per batch, not one per step, so throughput does not hinge on request count.

How long can a conversation get?

Longer than the payload limit. State, step results and outputs above a threshold are stored as immutable segments in the bucket, and a turn moves only the open tail and the new message, so a chatObject history keeps growing without trimming. We test histories of 8 MiB; a single value read back in one response is capped at 64 MiB. The payload limit still applies to each request body.

How is this different from Temporal, Restate or Inngest?

Mostly where the state lives. Cairnflow keeps journals, state, timers and queues on S3-compatible object storage, and its nodes keep nothing on local disk — there is no database to size, replicate or back up. On top of that: an AI SDK adapter with approvals and reconnecting streams, and SQL over every invocation.

What happens to the stream if the server dies?

The run continues on another node from its last completed step. The step that was in flight runs again, and useChat with resume reconnects the browser to it. Completed model and tool calls are not repeated.

Which languages and platforms are supported?

TypeScript, Python and Go. Install them from their registries: npm install @cairnflow/sdk, pip install cairnflow, and go get github.com/cairnflowdev/cairnflow/sdk/go. In TypeScript, serve() runs on Node.js 22.6 or newer, and the Fetch adapter, fetchHandler, targets Vercel, Cloudflare Workers, AWS Lambda, Deno and Bun (tested on Node.js, not yet on those platforms themselves). The Python SDK needs Python 3.11 or newer and runs as its own server, as an ASGI app or on AWS Lambda. The Go SDK needs Go 1.25 or newer and runs as its own server or on AWS Lambda. The Vercel AI SDK integration is TypeScript only. None of the SDKs has required dependencies. The wire protocol is language-neutral, and all three SDKs pass the same conformance traces.

Can I self-host?

Yes. The runtime is source-available under the Business Source License 1.1 (each version converts to Apache-2.0 after four years; the SDKs are Apache-2.0): you may read, modify and self-host it, including inside commercial products, but not offer it to others as a competing hosted service. Grab a prebuilt binary from GitHub Releases (Linux x86_64/arm64, macOS arm64), run the Docker image (ghcr.io/cairnflowdev/cairnflow), or build from source. It is one process per node and an S3-compatible bucket, with no coordinator and no database. A hosted service, Cairnflow Cloud, is planned — join the waitlist.

Ship the agent. Keep the progress.

Download a release binary or run the Docker image, start a node on your machine, and run a first durable invocation in two minutes.