Nothing happens until it is written down
Every decision your code makes (call this model, start this timer, finish) is appended to the run’s event log and committed before anything acts on it.
Tenacity runs long AI-agent workflows so that a crash costs nothing. Every step is written to an append-only log before it counts. When a worker, the server or the database dies, the run picks up exactly where it stopped: no finished model call is paid for twice, and no card is charged twice.
| Same crashes | Tenacity | Plain script |
|---|---|---|
| Finished model calls run again | 0 | 0 |
| Finished steps redone | 0 | 0 |
| Times the card was charged | 0 | 0 |
A plain script restarts from the top after a worker crash. Tenacity replays its log instead and retries only the step that was in flight.
You write the agent as ordinary Go. The engine keeps four promises about it, and the crash tests check each one.
Every decision your code makes (call this model, start this timer, finish) is appended to the run’s event log and committed before anything acts on it.
A new worker runs your code again against the log. Steps already in the log return their recorded results instantly, so the run is back where it was in under a millisecond. Code that no longer matches its history is stopped with a diff, never silently corrupted.
Each activity gets a key derived from history that stays the same on every retry. Pass it to the payment API or the email service, and a retry after a crash returns the first receipt instead of charging again.
Work is handed out on leases with tokens that only go up, even across database crashes. A worker that wakes up late with an old token is turned away, so two workers never both finish the same step.
No YAML, no state machine to draw. Loops, branches and concurrency in plain functions, made crash-proof by the engine. Go and TypeScript workers replay each other’s histories, so both can serve the same queue.
Workers hold no state that matters. The server holds the log in shards. The store is SQLite files or Postgres. Any of them can die mid-step.
Cluster mode runs several servers over shared storage. Shard ownership is decided by a Raft implementation written for this project, and every write is fenced by an ownership epoch.
Every number below is recorded with its date, commit, hardware, command and raw output. The tag names the evidence entry.
Measured on one Windows laptop (8 logical CPUs), medians of interleaved runs where noted. These are a single machine’s numbers, not a capacity plan.
Go 1.27 and nothing else. SQLite is built in and pure Go. Or docker compose up, Postgres included.
A local server and a worker with the demo workflows, in one process.
It fails twice and is retried. Then read its history, event by event, or open the console at 127.0.0.1:7233.
Node 23.6 or newer; serves the same demo workflows.
500 agent workflows, a worker killed every second, the server killed every five, then every side effect checked against an external ledger.