Skip to content
Skilled Agents

Field note 13 · Architecture

Durable steps on Postgres: routines that survive a restart

An agent routine that takes a week, waits for a reply and then continues cannot live in memory. We wrote a small library that keeps it in the database, and we publish it.

Written by Alper Tekin, Solustiq. Published 2 December 2026.

01

The problem

Invite a person to a meeting, wait for the answer, book the room, remind them the day before, run the meeting, send the minutes. That is one routine with days between its steps, and a deployment restarts several times in a week. Cron plus memory loses the place; a workflow engine is a second system to run.

02

What the library does

A routine is a function that calls named steps. Each step's result is written to a Postgres table under the run's key before the next step starts. On a restart the function runs again from the top, every recorded step returns its stored result without executing, and the first unrecorded step runs. Signals from outside, such as a reply, are rows that a waiting step checks. Timeouts and retries are rows too.

A changed step list is a replay hazard: if a deploy renames or inserts a step while a run is parked, replay would execute the wrong thing. The library refuses, fails the run with a named error, and the runbook says to wait for or cancel in-flight runs before such a change.

03

Why Postgres

Every deployment already has one. A ledger in the same database as the business records means one backup, one transaction boundary where it matters, and no second infrastructure to secure. The library adds four tables and a tick that runs every minute.

04

Open source

The library is published under our name with its tests and a security model, because a durable runtime is only trustworthy when its behaviour can be read. It is one of the two named components on this site, with the authority gate; everything else is described by what it does.

Three questions people ask about this.

Can a step run twice?
A step runs until it records a result. If the process dies between running and recording, the step runs again on replay, so steps that have side effects are written to be idempotent.
How do you cancel a parked run?
A row update, from a script or the operations page. The next replay sees the cancellation and stops.
What does a changed step list do to a completed run?
Nothing. Completed runs are history; only runs still parked are checked against the current step list.

Ask us how this rule would apply in your company.

We read every message and reply within two working days. Starting price on request.