Skip to content
Looms

Durable execution. Thread by thread.

Durable execution for agents, workflows, and whatever you build next.

Weave agents, workflows, and your own thread types into one durable run. Nest them together, pause for the world, and pick up where you left off.

bash
npm install @swirls/looms
LoomAn isometric loom weaving three colored strands labeled agents, workflows, and your code into one fabric. A small frame holds durable threads in tension while a shuttle composes them into one fabric.agentsworkflowsyour code
Many threads. One durable history.

Define your own thread types.

An agent loop and a workflow DAG are two ways of running work. Looms lets you define another: an auction, a review policy, a device controller. Compose them in one run, with one shared history.

agentProcurement assistant

Finds suppliers and starts a purchase.

workflowPurchase process

Coordinates bidding, review, and fulfillment.

your custom kindAuction

Accepts bids until a deadline and returns a winner.

Build a custom thread →
Event log & replayA lifted state layer connects to a stack of recorded events through five fine threads. Immutable events form a durable history. Pure reducers reconstruct current state from that history; replay does not dispatch external effects.

Recover recorded progress

Load durable history after a restart. Historical replay rebuilds state without dispatching effects; external actions interrupted by a crash need safe retries.

Understand the guarantees →
Durable waitsA continuous thread pauses over recorded layers. A matching signal descends from above and the thread continues. A thread parks with its progress preserved in the log. A matching approval, webhook, or timer wakes it to continue.

Wait for the world

Pause for a human, webhook, timer, or child thread. Keep decisions in the log and resume when the matching event arrives.

Add a human decision →
ProjectionsOne event stack fans out into three surfaces: a conversation, a ledger, and an analytical chart. The same events fold into chat, ledgers, and analytics. Each view is derived from the log and can be rebuilt from it.

Show what happened

Use the same events to render conversations, approval queues, and debugging views. Build shared indexes for work across runs.

Connect your UI →

Add your own modules.

Define events, effects, thread kinds, and projections in a module. Built-in modules use the same extension model as yours.

Write a module →
ts
import { createLooms } from '@swirls/looms/runtime'import { agent } from '@swirls/looms/agent'import { workflow } from '@swirls/looms/workflow'import { approval } from '@swirls/looms/approval'import { auction } from './auction'import { buyer, purchase, llm } from './definitions'const looms = createLooms({  modules: [    agent({ definitions: [buyer], llm }),    workflow({ definitions: [purchase] }),    approval(),    auction,  ],})await looms.start(buyer, 'Find a supplier')

One timeline across every thread.

Follow delegation, tool results, and decisions in one place. Select a thread or event in this recorded run to see how the work unfolded.

Inspect your runs →
Recorded example

Explore recorded events and thread relationships.

Start with a run.

Run locally with Bun and SQLite, then take the same definitions to Cloudflare Durable Objects.