@gnldev/durable has 54 recorded weekly downloads on npm, a decrease of 86.0% over the past 30 days, ranking #2762 of 3,247 tracked listings.
About @gnldev/durable
@gnldev/durable
The durable core of GNL, a full agent framework for TypeScript — call-scoped exactly-once effect + deterministic replay for Vercel AI SDK agents. Use it inside the agent you already have, or with the rest of the framework.
Wraps the AI SDK's agent loop (generateText/streamText) without changing it. After a crash/restart a
completed tool call is never executed a second time, and the agent makes the same decisions
(deterministic replay). The one thing neither other agent frameworks nor plain AI SDK give you structurally:
correctness.
The precise guarantee is at-most-once for a side effect, because the crash window between executing a tool and journaling its result cannot be closed by any client-side library — see the callout below. gnl's answer to that window is to refuse to guess: it blocks and asks, rather than silently re-running or silently continuing.
Install:
pnpm add @gnldev/durable— the storage adapters ship inside the same package. (Or clone the repo andpnpm install && pnpm -r build.)
npm i @gnldev/durable ai @ai-sdk/anthropic
Durability in 2 lines
import { runDurable } from '@gnldev/durable';
import { SqliteStorage } from '@gnldev/durable/sqlite';
import { anthropic } from '@ai-sdk/anthropic';
import { tool, stepCountIs } from 'ai';
import { z } from 'zod';
const chargeCard = tool({
description: "Charge the customer's card",
inputSchema: z.object({ amount: z.number() }),
execute: async ({ amount }) => paymentApi.charge(amount),
});
const res = await runDurable({
runId: 'order-123', // ← the id of THIS WORK — never a sessionId (see below)
journal: new SqliteStorage('runs.db').runs, // ← state lives here
model: anthropic('claude-opus-4-8'),
tools: { chargeCard },
stopWhen: stepCountIs(10),
prompt: 'Process the order',
});
If the process crashes mid-turn, call again with the same runId → it resumes where it left off, the
card is never charged a second time:
const res = await runDurable({ runId: 'order-123', journal, model, tools, prompt: 'Process the order' });
One id is one JOB, never one session.
runDurableis the raw surface: the string you pass is the identity, so asessionIdor a conversation id there makes every later turn replay the first one forever. ThroughcreateGnlyou name the work instead (workKey) and the engine derives the id — see Work identity.
<a id="what-never-charged-twice-actually-means"></a> What "never charged twice" actually means: the guarantee is at-most-once. If a step already completed, it's replayed and skipped. But if the crash lands in the narrow window after the charge executed and before its success was journaled, resume can't know whether the charge went through — so for a side-effect tool with no
recover()and noidempotent/approval, it does not silently re-run and does not silently continue: it blocks and asks a human. Safe direction (never a double charge), but resume is not always seamless.Concretely,
runDurablethrowsSideEffectRetryBlockedError— it does not come back inresult.interrupts, which carries approval suspensions only. Catch it:import { SideEffectRetryBlockedError } from '@gnldev/durable'; try { await runDurable({ runId: 'order-123', journal, model, tools, prompt }); } catch (e) { if (e instanceof SideEffectRetryBlockedError) { // e.detail.key names the tool call that is in doubt. Ask an authorised person (this is an // approve question: the end user whose work it is cannot answer it), then re-run as staff // (`caller: STAFF`) with approvals: { [toolCallId]: true } — a yes sent before this error // existed answers nothing — or give the tool a recover() so this resolves itself. } else throw e; }
recover()is the way to avoid the human: it re-checks the provider and must return{ done: true, output }or{ done: false }. Any other shape is treated as "could not determine" and lands back on this same gate rather than re-running the effect.
If you know generateText, you already know this — same arguments, same return type. The only addition:
runId + journal.
How it works
durableTool— wraps a tool'sexecute. The key is thetoolCallIdthe AI SDK assigns; on replay the model response is reproduced verbatim, so the same id is generated → a tool that already succeeded never runs again.withDurableModel— via awrapLanguageModelmiddleware, records every model response to the journal and replays it on resume → the agent reproduces the same tool chain.Journal— an append-only log.InMemoryJournal(dev) ·SqliteStorage().runs(prod,node:sqlite, zero native dependencies).…
Description from the npm listing.
- ai
- agent
- llm
- typescript
- ai-sdk
- durable
- exactly-once
- journal
- replay
- idempotency
- crash-recovery
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm AI SDKs plugins
All 20 @gnldev/durable alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@gnldev/durable. First seen Oct 16, 2026; last successful collection Nov 22, 2026. See the methodology.