Agent runtime · for regulated work
An agent runtime that keeps the evidence an auditor asks for.
Pleach writes every model call as a typed, hash-chained, replayable row in your own database. It can anchor that chain to an RFC 3161 time-stamp authority, hold a tool for human approval, and sign attestations with your own key.
Free · FSL-1.1 fair-source · your database · no phone-home · no account
Not on npm yet
@pleach/* packages aren't on npm yet. Some names are reserved with 0.0.1 placeholders. Each package's first real release ships under FSL-1.1-Apache-2.0. The commands on this page describe the install once it lands. Packages tracks each package's status.import { createPleachRuntime, setOrchestratorAdapterCtor } from "@pleach/core/runtime";
// wrap the provider + store you already run — no loop rewrite
setOrchestratorAdapterCtor(MyProviderAdapter);
const runtime = createPleachRuntime({
storage: new MyPostgresStorageAdapter(pool),
checkpointer: new MyPostgresCheckpointer(pool),
plugins: [myDomainPlugin],
});
// core now governs YOUR loop: family-lock, replay, checkpoints, audit rowShipped in @pleach/core@0.1.0. Core drives the loop you already run — family-lock, replay, checkpoints, and one audit row per call, over your infrastructure. The runnable end-to-end is on Adoption paths.
verifyChainships in@pleach/core; you run it, not us.verifyRfc3161Receiptchecks a time-stamp token's CMS signature against your trust anchors.- Every release is checked for out-of-lattice edges.
- Competitor claims carry the month they were written. Landscape →
Regulated work
Each audit question has a mechanism behind it.
Reviews under 21 CFR Part 11, ALCOA+, HIPAA, GDPR, the EU AI Act and SOC 2 ask the same questions of every system. A hash log, a time-stamp client and a scrubber are each something you could add to your own loop. Pleach writes them into one record in your database, so the answers still agree after an abort, parallel tool calls, a rollback or an erasure. No rule requires an agent runtime. These questions arrive with a complaint, an inspection or a model change, and only a record written at the time can answer them. Part 11 and ALCOA+, by topic → SEC and FINRA mapping →
Example: a diabetes coach’s reply nudged an insulin dose.
A chat coach that reads a glucose monitor ships as a medical device. It told a user to take “a little extra” at the next meal. The record shows the readings it had, the reply the user saw, and that no dosing guard matched. It doesn’t show how the model reasoned. Walk the record →
| The question | What answers it | Default | Regime it bears on | Docs |
|---|---|---|---|---|
| Can a record be changed without anyone knowing? | Each call row carries the hash of the one before it. A verifier names the first row that doesn't match. The WORM tier makes the event log and the call rows append-only for every application role.For example: Someone with database access edits one March reply. The verifier names that row as the first mismatch. Walk it → | Chain on; WORM opt-in | Part 11 · HIPAA · EU AI Act | Read → |
| When did it happen, by a clock you trust? | The log can be time-stamped by an authority you choose. Call rows can be anchored the same way.For example: A user disputes when the app told them to seek care. The authority's token dates the rows without your server clock. Walk it → | Opt-in | ALCOA+ · Part 11 | Read → |
| Who approved this action? | A tool can wait for human approval. The decision is written as a chained row with its actor, linked to the call it gated.For example: A supervisor edits a client note before it publishes. Both versions of its arguments are on record. Walk it → | Opt-in per tool | EU AI Act · Part 11 | Read → |
| Can a third party check it without trusting you? | Signed attestations over slices of the ledger, verifiable offline. Beta: envelopes are unsigned until you wire a key store.For example: An outside auditor checks one month of envelopes from a script, with no database access. Walk it → | Opt-in, beta | Independent review of the record | Read → |
| How do you erase one person and keep the chain? | Per-subject keys encrypt their fields. Destroying the key erases the data, and the chain still verifies.For example: A former employee asks for erasure. The key is destroyed and the chain still verifies. Walk it → | Opt-in, needs a KMS | GDPR | Read → |
| How long is it kept? | Retention removes data only after a period you set and skips anything under a legal hold.For example: A litigation hold stops the retention pass, and the refusal is recorded. Walk it → | Opt-in | Part 11 · GDPR · EU AI Act | Read → |
| Does personal data reach the record? | Call rows pass through a PII redactor by default. Compliance profiles add scrubbers for SSNs, card numbers and driver licences, and a PHI scrubber is a separate opt-in.For example: An employee pastes a Social Security number. The record holds it redacted, though the model still saw it. Walk it → | Redactor on; profiles opt-in | GDPR | Read → |
These are mechanisms, not a certification. Validation, electronic signatures and user identity stay with you; the Part 11 page says which is which. The WORM tier is enforced by database triggers a table owner can still disable, so we don’t grade it as the non-rewriteable storage format the SEC recordkeeping rules describe.
Capabilities
The row is the product. Everything else reads it.
As of 2026-06, these are the capabilities we didn't find shipping elsewhere among Helicone, Langfuse, LangSmith, Portkey, LangGraph, Temporal, and the rest. The landscape has the honest version, in both directions.
Backfill or delete a row and the chain breaks.
Every row carries a hash of the row before it, in a database only you hold. The verifier is yours to run, and it names the first row that doesn't match.
verifyChain({ entries, genesisHash })
// → { ok: true }
// → { ok: false, failedIndex, expected, actual, reason }Replay a recorded turn. Any drift is named.
Replay re-serves the recorded responses instead of calling the model, and names the first request that drifted from the record; steps the runtime doesn't fingerprint yet (decision, synthesize) are marked blind. A live model can't promise byte-identical output, so rerunning the same model and judging the result equivalent is the next step; it isn't shipped yet.
headless-replay: cache miss → ReplayDivergenceErrorckpt_7 makes the rewind exact.Every subagent call carries the turn that caused it.
Each row stores its parent turn, root turn, subagent depth and tool name. Each per-call row carries its cost. One query by root turn rolls nested fan-out back to the user message.
total by root turnEvery turn runs the same four stages.
@pleach/core sits in exactly one of these four stages. Every release is checked for out-of-lattice edges — the diagram is the invariant, not a best-practice diagram.The runtime is a contract, not a TypeScript API: HTTP + SSE routes, the audit row, the checkpoint envelope, the sync clock. @pleach/core is the reference implementation. A Go implementation is planned; the wire contract already works in a Go reference consumer, which reads the SSE frames and checkpoint envelopes. Read the contract or the architecture deep-dive.
A gateway governs the model call. Pleach governs the agent that made it.
A proxy's row is what your code claimed: project, tag, customer, sent as a header. Pleach's row is what the runtime did: turn, tool, subagent tree, written to your Postgres.
How that plays against Merge Gateway, Portkey, and the observability planes →Ways onto the record
Every way in writes to the same record.
The routes differ in who drives the turn, and so in how much of the runtime you get. The record keeps four things together: a row per attempt that closes when a stream aborts, a chain that holds while parallel work finishes out of order, resume and fork without forking the chain, and replay beside scrub and erasure. The four →
| Way in | First step | What the record holds |
|---|---|---|
| New projectPleach drives the turn. | npx @pleach/core create scaffolds one route and one page; a Next.js app also gets an /audit view of the rows. Getting started → | The whole runtime: family lock, checkpoints, replay from the record and interrupts. |
| Keep your loopYour loop drives; observe records. | @pleach/observe records each call you hand it. Not on npm yet. @pleach/observe → | A row per call. No family lock, replay or checkpoints: those need the runtime. |
| Core drives your loopOver your provider, store and tools. | createBrownfieldRuntime → | The whole runtime. Your store pairs storage with a checkpointer. |
| MigrateOne feature at a time, or all of it. | Tools first, then threads; or replace your runtime and bring your history. From the AI SDK →From LangChain → | Whatever you've moved. The parts you haven't moved stay outside the record. |
Already know a runtime and starting fresh? Mount createPleachRoute() as your chat route. Compare all six paths →
FAQ
What teams ask before adopting
- How is Pleach different from the AI SDK or LangChain?
- They ship faster for single-shot agents and broad chain composition. Pleach is the runtime when the agent is the product: per-customer cost, replay that names drift, time-travel checkpoints, and a typed audit row joinable to your billing and compliance schemas. See /docs/comparison.
- Already on Anthropic Enterprise or OpenAI Enterprise — what does Pleach add?
- It composes underneath. Your contract keeps doing its job; Pleach adds per-customer cost rollup inside one Workspace or Project, a tamper-evident audit row in your own Postgres, and replay across model snapshots. No new vendor — an npm install plus a table. See /docs/migrating-from-anthropic-enterprise.
- What license does Pleach use? Is it open source?
- Fair source — FSL-1.1-Apache-2.0. Source-available, free in production. Each release converts to Apache-2.0 two years after it ships. Not OSI-approved open source during that window.