Durable execution
Persist side-effectful steps and replay completed work after a restart.
Durable execution is a small step-log wrapper. It is not a separate workflow
engine: keep the business workflow in JavaScript and mark side effects with a
stable stepId.
#File-backed example
import { createDurableRunner, createFileStepLog } from '@agentskit/runtime'
const store = await createFileStepLog('.agentskit/steps.jsonl')
const durable = createDurableRunner({ store, runId: 'order-42' })
const draft = await durable.step('draft', () => createDraft())
const sent = await durable.step('send', () => sendEmail(draft))
console.log(sent)On restart, the same runId and stepId replay recorded successes without
executing the function again. Use createInMemoryStepLog() for tests and
single-process experiments.
#Contract
- Step functions may perform side effects; their returned value is persisted.
- Stable step IDs are required for deterministic replay.
- Failed steps are recorded and fail future calls for the same run until the run is reset or a new run ID is chosen.
- Calls for the same step ID on one runner are single-flight. Distributed stores still need an atomic claim/append primitive before sharing a run across processes.
durable.history()reads the current run anddurable.reset()removes it.
The file log is JSONL. A missing file is initialized; malformed records fail closed with a durability error instead of being treated as an empty history.
Explore nearby
- PeerAgents
Everything that runs the loop β runtime, tools, skills, delegation, durable execution, topologies, background agents, HITL, self-debug.
- PeerRuntime
Execution engine for autonomous agents β runs a ReAct loop (observe, think, act) until final answer or step limit.
- PeerMulti-Agent Delegation
Coordinate multiple specialist agents from a parent agent using directed delegation.