Skip to content
Durable Execution Guide
Menu

Durable Execution Guide

Durable execution for AI agents in open-source Kortix: the output survives

Durable execution keeps a run's place when a process dies; for an agent, the place worth keeping is the change it made. Kortix is the open-source CompanyOS: your agents, their skills, your company memory, and every connector in one git repo you own, with the agents working on real cloud computers.

One trigger's setup, one passage from the agent prompt.

What a trigger fills in before it starts a session, and the line in the prompt about the branch that session works on.

Triggertriggers
Kortix fills in your instruction with the details of the event, such as fields from the webhook's request.It starts a new session, with your chosen agent and model, on its own cloud computer.The agent does the work, using the connectors it may use.A schedule skips a run while its previous run is still going.
Session promptworker.md
The session you're in is an isolated sandbox — an ephemeral branch of this repo … Only what you commit + push survives.

What breaks an agent run

Durable execution is usually sold as insurance against a crash. For an agent, a crash is the rarer half of the problem. The four failures that end a run look different from each other, and only one of them is the computer stopping.

A tool call that takes minutes. The agent runs a test suite, a build or a crawl, and the call takes longer than anything upstream will wait. A process that gives up here loses the context already gathered, the tokens already paid for, and every edit it made but has not written down. Restarting pays for all of it twice.

A rate limit or a provider error. The model call fails at the ninth step of twelve. With no record of the first eight, the run begins again from the prompt, and step nine is paid for twice.

An approval that arrives the next morning. Nothing failed. The run is waiting for a person to say yes, and a process that exits while it waits throws away the work underneath. An approval that costs a night of wall-clock time is ordinary in agent work and close to unknown in a payment pipeline.

A computer that stops with the work half done. About 15 to 20 minutes after the last turn, Kortix stops the computer. The files in /workspace, the branch and the conversation are all still there when a new message wakes it, but the step it was in the middle of is never replayed.

Three of those four are waits. A retry does not shorten a wait, and a crash-proof journal does not tell anyone what happened to the twelve files an agent had half-edited. That is the gap worth designing around. For agent work the thing that has to survive is the change, and a change has an owner who accepts or rejects it.

Why a retry fixes one failure and deepens another

Retrying a read is free. Retrying a write is not. Most agent tool calls are writes: create the ticket, send the message, push the commit, update the row. Few of them come with a natural idempotency key, and the duplicate side effect usually surfaces days later, long after the retry has been forgotten.

Retries also hide the wait. Wrap an approval in a retry and you get a loop that wakes every minute for ten hours, or a timeout that fires at the wrong moment. The retry count was never the problem. The run had nowhere to sit while a person was away from their desk.

Two schools, and what each asks of your code

The market answers the crash half in one of two ways.

A replay engine keeps a history and re-executes from it. Temporal calls durable execution "crash-proof execution". It organizes an application into workflows and activities, dispatched to polling workers, and its durable steps are activities, timers, signals, queries, updates and schedules (Temporal's definition). Replay is why workflow code must stay deterministic: the same inputs have to take the same path on the second execution. Restate carries the idea into ordinary code, and its own page calls durable execution "a programming paradigm that makes ordinary code resilient to crashes, restarts, and infrastructure failures" (Restate's definition). Restate claims "a few milliseconds" of overhead per durable step, and up to 10× better cost efficiency than Temporal Cloud. It runs inside your own cloud account (its comparison).

What that school asks of a team: a cluster to run or a bill to pay, step boundaries drawn in the right places, and workflow code treated as something that will execute twice.

The second school checkpoints into a database you already operate. DBOS builds durable workflows on Postgres, and its repository says the durability is "entirely contained in this open-source library, there's no additional infrastructure for you to configure or manage" (DBOS). What it asks: the work runs as DBOS workflow functions, and the Postgres is yours to back up, restore and query.

Both schools record the steps of a process. Neither has an opinion about the artifact at the end. A run can replay perfectly and still leave twelve edited files that somebody has to read, understand and accept, and that decision sits outside both designs.

The session as the durable unit

Kortix starts from the artifact. A session runs one agent in its own sandbox: the sandbox clones the project repo and works on its own branch, whose name is the session id. The branch is a git object in a repo you own, so the unit of resumption is a commit rather than a stack frame. Kortix's own agent prompt puts it plainly: the session is an ephemeral branch of the repo, and only what you commit and push survives.

Work leaves a session as a change. The agent commits, pushes its session branch and opens a change request against the project's default branch. A person with the merge permission merges it, and merge is default-deny for agents. That step is where an agent run stops being a process and becomes something a business can accept, reject or send back.

Two more pieces make it repeatable. A trigger starts a session with nobody present. The guide lists five sources: a schedule, a webhook, an App event, a connector event (experimental and off by default) and a merged change request. Read the docs for how to create one. A loop wakes one existing session later, once or on repeat, which covers the approval that arrives tomorrow without holding a process open all night. Every action is recorded. Reading, exporting and streaming the audit log depend on the plan.

Kortix does not replay a process, and that limit is worth stating plainly. What survives a run is what was committed and pushed, plus the change request it produced. A team that needs deterministic replay of arbitrary code, month-long timers inside a function, or orchestration across a dozen services still needs an engine. The two can meet in the middle: a scheduler you already run can call a trigger, and the change request becomes the handoff back into your pipeline. For the approval side of that handoff, read the guide on reliable agent workflows.

Five questions to ask your own agent

Where does the resume point live? If the answer is "in the engine's memory" and you cannot point at a commit, a row or a file, the work is recoverable at best. Recoverable is a smaller promise than durable, and it is the one most agent teams have actually bought.

What happens to uncommitted work? Ask what an idle stop costs, and what the end of the session costs. An idle stop keeps /workspace; the end of the session does not. Four hours of edits need a commit boundary more than a longer timeout.

Who accepts the output? A durable run that nobody reviews is a queue with extra steps. Name the person or the role, and name what they look at: a branch, a pull request, a change request, a report.

How do you audit it afterwards? A run you cannot reconstruct is a run you cannot defend in an incident review. Check what the tool records, who can read it, and how long it is kept before you need it.

Who starts it at 3am? A schedule or a signed webhook that starts the run, not a person who remembers to. If the honest answer is "someone on call", the durable part is missing.

If the answers point at a branch and a reviewer, the comparison table is the next thing to read. If they point at deterministic replay of code that has nothing to do with files, an engine is the right tool, and what durable execution means covers that vocabulary.

What each tool makes durable

What each tool hands back when the run ends, and where its record lives afterwards. On that question I would take Kortix, and I'm part of the Kortix team, so weigh that accordingly.

Recommended

Kortix

Durable unit
The session: one sandbox, one branch
What it hands back
A change request a person merges
Open source
Yes
Self-host
Cloud, VPC or on-prem; self-host free

Temporal

Durable unit
A workflow and its activities
What it hands back
The workflow's result, from its activities
Open source
MIT license
Self-host
brew install temporal, or Docker

Restate

Durable unit
A function with durable steps
What it hands back
The function's return value, step by step
Open source
BSL 1.1, public platform service excluded
Self-host
One binary: Docker, Homebrew or npx

Inngest

Durable unit
A function with triggers and steps
What it hands back
The function run's result after each step
Open source
SSPL, delayed Apache 2.0 publication
Self-host
Your infrastructure or a self-hosted server

Trigger.dev

Durable unit
A long-running TypeScript task
What it hands back
The task's output, after any approval pause
Open source
Apache-2.0
Self-host
Docker self-hosting guides

DBOS

Durable unit
A workflow on Postgres
What it hands back
The workflow's result, checkpointed in Postgres
Open source
MIT
Self-host
Runs on your own Postgres

Hatchet

Durable unit
A workflow of background tasks
What it hands back
The workflow run's result
Open source
MIT
Self-host
Hatchet Cloud or self-hosted

Kortix is not a replay engine; its durable record is the branch and the change request. Restate's cost comparison is Restate's own claim.

Durable execution, answered plainly

What does durable execution mean?

It means a run keeps its place when a process dies. The engine records each step, so work resumes instead of restarting; Temporal calls it "crash-proof execution" and Restate describes a function whose steps are recorded as it runs.

What is a durable execution pattern?

A journal plus replay. Durable code records each completed step, and after a failure it replays from the last recorded one. A second pattern checkpoints into a database you already run, which is how DBOS works on Postgres.

What are some examples of durable execution frameworks?

Temporal, Restate, Inngest, Trigger.dev, DBOS and Hatchet. They differ in durable unit, license and where the record lives, and the comparison table gives each one's own description.

What is a durable task?

One unit of work an engine can resume: a Temporal activity, a Trigger.dev task, a DBOS workflow step. It survives a crash because its result is written down before the next step starts.

Where does an agent's resume point live?

In the branch. An agent that edits files resumes from what it committed and pushed, not from a stack in memory, so the commit is the checkpoint that a person can also read.

What happens to uncommitted work when an agent run stops?

It waits in /workspace while the session lives, and it is lost when the session ends. Kortix's own agent prompt states it: only what you commit and push survives, so a run that has edited for hours and pushed nothing has nothing to show for them.

Start with one agent job that has to survive a night.

One session, one branch, one change request to review.

Self-host is free · Read it, fork it, audit it · Every action is recorded. Reading, exporting and streaming the audit log depend on the plan