# Comparison (/docs/comparison)



This page compares agent runtimes by what each gives a regulated
reviewer. Reviews under 21 CFR Part 11, ALCOA+, HIPAA, GDPR, the EU AI
Act and SOC 2 ask the same questions of every system: can a record be
changed unnoticed, when did it happen by a clock you trust, who approved
it, can a third party check it, how do you erase one person, and how long
is it kept.

`@pleach/core` is the agent runtime whose every model call is a typed,
hash-chained, replayable row in your own database. The `AuditableCall`
ledger and the four-stage lattice are structural invariants, not opt-in
middleware. That is the difference from the AI SDK, LangChain, LlamaIndex
and Mastra. It also overlaps differently with harnesses and toolkits like
Claude Code, pi, Goose, OpenHands, AutoGen and CrewAI. The page also says
when `@pleach/core` is the wrong tool.

Pleach is a library, not a validated system or a certification. Each row
names a mechanism and the requirement it supports; validation, procedures
and signatures stay with you. The [Part 11 and ALCOA+ page](/docs/compliance/part-11-alcoa)
lists, by topic, what you still provide.

The AI SDK and LangChain hand you a pot and a few stakes, enough to keep
one branch upright. Pleach hands you the lattice.

## TL;DR [#tldr]

A hash log, a time-stamp client and a scrubber are each something you
could add beside your own loop. A side module can't easily give you one
record that still agrees with itself after these events:

* **An abort.** On the runtime's call path, each attempt writes one row
  whether it completes, errors or is aborted.
* **Parallel calls.** Rows from parallel work land in one order on the
  chain. The bundled stores (Postgres, SQLite, memory) provide the
  compare-and-set this needs; a store you bring must provide it too.
* **A rollback.** It writes a chained row that records the branch rather
  than removing history.
* **An erasure.** Shredding one subject's key erases that subject's
  sealed fields, and every row hash still verifies.

If no reviewer will ever ask for the record, the AI SDK is the cleaner
pick. Three axes decide whether to reach for Pleach instead of, or
alongside, the alternatives:

<Callout>
  Competitor columns reflect each project's public docs as of 2026-06 and may have changed since.
</Callout>

| Axis                                                                                                                     | `@pleach/core` | AI SDK                                                                 | LangChain                                            | LlamaIndex                                           | Mastra                                               |
| ------------------------------------------------------------------------------------------------------------------------ | -------------- | ---------------------------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |
| **Per-call audit ledger** (`AuditableCall` row keyed by `turnId`, tenant-stamped, joinable to billing in one `GROUP BY`) | ✅ structural   | <span className="text-fd-muted-foreground">no</span>                   | partial via `callbacks`                              | <span className="text-fd-muted-foreground">no</span> | <span className="text-fd-muted-foreground">no</span> |
| **Replay from the record + write-side hash chain**                                                                       | ✅ structural   | <span className="text-fd-muted-foreground">no</span>                   | partial (LangSmith, external)                        | partial (eval)                                       | partial (workflow)                                   |
| **Family + transport lock + lattice invariants** (no silent cross-family fallback; four-stage lattice lint-enforced)     | ✅ structural   | <span className="text-fd-muted-foreground">no</span> provider-agnostic | <span className="text-fd-muted-foreground">no</span> | <span className="text-fd-muted-foreground">no</span> | partial (lattice)                                    |

Next: the evidence a reviewer asks for, then the row-by-row capability
matrix. If you need none of the three axes, use the AI SDK.

## What each runtime gives a regulated reviewer [#what-each-runtime-gives-a-regulated-reviewer]

Each row is a question a reviewer asks, the Pleach mechanism that answers
it, whether it's on by default, and the requirement it supports. The
Pleach column states a mechanism, not a claim that your system meets the
requirement.

<Callout>
  Competitor cells are carried over from the capability matrix below (public docs as of 2026-06 to 2026-09). A dash means this page has no sourced verdict for that runtime on that row, not that the capability is absent. For approvals, the competitor cell records the pause-and-resume primitive only. A requirement is cited only beside a mechanism that ships; beta and experimental mechanisms carry none.
</Callout>

| Evidence                        | `@pleach/core` mechanism                                                                                                                                                                                                  | Default                                                                                                               | Requirement it supports                      | Vercel AI SDK           | LangChain                     | LlamaIndex          | Mastra               |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | ----------------------- | ----------------------------- | ------------------- | -------------------- |
| **Tamper evidence**             | Each call row carries the previous row's hash, and `verifyAuditableCallChain` names the first row that doesn't match. The event log has its own chain (`verifyChain`). The [WORM tier](/docs/worm) makes both append-only | Call-row chain on. HMAC chaining needs your key. WORM is opt-in                                                       | Part 11 · ALCOA+ · HIPAA · EU AI Act · SOC 2 | none                    | none                          | none                | none                 |
| **Trusted time**                | Each row has a recorded time. Event-log segments can be time-stamped by an RFC 3161 authority you choose; call rows can be anchored with `withAuditRecordedAnchor`                                                        | Recorded time built in. Anchoring is opt-in: point the client at your authority and run your own schedule             | ALCOA+ · Part 11                             | —                       | —                             | —                   | —                    |
| **Approvals**                   | A tool can wait for human approval. The decision is a chained row with its actor, linked to the call it gated. Permission grants are Ed25519-signed                                                                       | Per-tool opt-in. Sign grants with the bundled local server, or with `signPermissionRow` and your key in your own host | EU AI Act · Part 11 · ALCOA+                 | partial (tool approval) | yes (LangGraph `interrupt()`) | partial (workflows) | yes (suspend/resume) |
| **Signed attestation**          | Ed25519 attestation envelopes over slices of the ledger, verifiable offline                                                                                                                                               | Beta. Wire your key store to sign                                                                                     | No clause cited while beta                   | —                       | —                             | —                   | —                    |
| **Erasure**                     | Per-subject keys encrypt their fields. Destroying a key erases the data, the chain still verifies, and a KMS-signed shred proof records it                                                                                | Wire a KMS key store                                                                                                  | GDPR · HIPAA                                 | —                       | —                             | —                   | —                    |
| **Retention**                   | `runChainRetentionPass` removes whole event-log chains and `runCallLedgerRetentionPass` removes call-row sessions past your period. Both skip legal holds; the WORM tier records each disposal                            | Set the period and schedule the passes                                                                                | Part 11 · GDPR · EU AI Act                   | —                       | —                             | —                   | —                    |
| **Personal data in the record** | Call rows pass through a PII redactor before hashing. Compliance profiles add scrubbers for SSNs, card numbers and driver licences                                                                                        | Redactor on (`piiRedactorNoop()` opts out). Profiles are opt-in                                                       | GDPR                                         | consumer-wired          | consumer-wired                | consumer-wired      | consumer-wired       |

These mechanisms matter together more than one at a time. The
interactions in the [TL;DR](#tldr) are why they live on one record
rather than in side modules. Three related mechanisms are earlier-stage
and carry no clause here:

* Linking a forked session's first row to the parent's row hash is done
  by an experimental reader, on by default when your event-log writer
  uses the v3 chain identity.
* Scheduling anchoring from a recipe uses the experimental
  `chainAnchorScheduler` in `@pleach/recipes/chain-anchoring`.
* Attestation envelopes are beta, signed once you wire your key store.

What stays with you (validation, electronic signatures, identity,
procedures, the anchoring schedule, archival copies) is listed on the
[Part 11 and ALCOA+ page](/docs/compliance/part-11-alcoa).

## Capability matrix [#capability-matrix]

The column is framed as "capability," not "who wins." Other libraries are
excellent at their own jobs; this table records which capabilities each
ships as a first-class concept. Rows fall into five themes:
observability and accounting, execution shape, routing and replay,
storage and contracts, and streaming and corrections.

<Callout>
  Competitor columns reflect each project's public docs as of 2026-06 to 2026-07 for most rows. The rows for context compaction, sandboxed code execution, safety policies, Agent Skills, durable execution, background runs, long-term memory, MCP, and OTel spans were last checked as of 2026-09. Any of them may have changed since. The three streaming and corrections rows carry no competitor verdict yet: a dash means this page has no sourced verdict for that runtime, not that the capability is absent.
</Callout>

| Capability                                                                    | `@pleach/core`                                                                                                                                                                                                                                                                                      | Vercel AI SDK                                 | LangChain                         | LlamaIndex                        | Mastra                          |
| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- | --------------------------------- | --------------------------------- | ------------------------------- |
| **Observability & accounting**                                                |                                                                                                                                                                                                                                                                                                     |                                               |                                   |                                   |                                 |
| Per-call audit row                                                            | `AuditableCall` ledger                                                                                                                                                                                                                                                                              | none                                          | partial via `callbacks`           | none                              | none                            |
| Append-only event log (typed `StreamEvent`)                                   | yes                                                                                                                                                                                                                                                                                                 | partial (`UIMessage` stream)                  | partial via `callbacks`           | partial (instrumentation)         | yes (workflow events)           |
| Subagent spawn + depth rollup to parent `turnId`                              | `SpawnTreeState`                                                                                                                                                                                                                                                                                    | none                                          | partial (LangGraph subgraphs)     | partial (workflows)               | partial (agent network)         |
| Per-call cost allocation by `turnId`                                          | yes (`modelCall.costUsd` on each per-call row)                                                                                                                                                                                                                                                      | manual                                        | manual                            | manual                            | partial                         |
| Typed audit records (discriminated `payload.kind`)                            | yes (TS narrowing on `payload.kind`)                                                                                                                                                                                                                                                                | opaque JSON                                   | per-vendor shapes via `callbacks` | per-module shapes                 | partial (typed workflow events) |
| Tamper-evident hash chain (write-side)                                        | yes (previous-row hash and row hash)                                                                                                                                                                                                                                                                | none                                          | none                              | none                              | none                            |
| PII scrubber gate at write time                                               | yes (default PII redactor on call rows before hashing; default scrubbers on the Postgres and SQLite event-log writers; a failed scrub drops the row)                                                                                                                                                | consumer-wired                                | consumer-wired                    | consumer-wired                    | consumer-wired                  |
| Built-in OTel span set with auto parent-threading                             | yes (parent-threaded spans; core spans use `pleach.*` attributes, and the GenAI-semconv `gen_ai.*` set ships in `@pleach/observe`'s OTel destination)                                                                                                                                               | partial (per-call spans, no parent threading) | partial (per-operation spans)     | partial                           | partial                         |
| Multi-tenant facet stamping the tenant id on every row + span + outbound HTTP | yes (`runtime.tenant` facet; providers send `x-tenant-id` by default, `tenantHeader: false` opts out)                                                                                                                                                                                               | consumer responsibility                       | consumer responsibility           | consumer responsibility           | consumer responsibility         |
| **Execution shape**                                                           |                                                                                                                                                                                                                                                                                                     |                                               |                                   |                                   |                                 |
| 4-stage lattice (lint-enforced edges)                                         | yes                                                                                                                                                                                                                                                                                                 | none                                          | none                              | none                              | partial                         |
| One synthesize seam per runtime (retries are extra billed rows)               | yes                                                                                                                                                                                                                                                                                                 | none                                          | none                              | none                              | none                            |
| Reactive channels (LangGraph-shaped)                                          | yes                                                                                                                                                                                                                                                                                                 | none                                          | partial (LangGraph)               | none                              | partial (workflow channels)     |
| Plugin contract with lattice invariants                                       | yes                                                                                                                                                                                                                                                                                                 | none                                          | partial (chains)                  | partial (modules)                 | yes                             |
| Human-in-the-loop interrupts                                                  | yes                                                                                                                                                                                                                                                                                                 | partial (tool approval)                       | yes (LangGraph `interrupt()`)     | partial (workflows)               | yes (suspend/resume)            |
| Context compaction (history summarization + tool-result eviction)             | yes, opt-in (`SummarizationMiddleware`, `ResultEvictionMiddleware`)                                                                                                                                                                                                                                 | manual                                        | partial                           | partial                           | partial                         |
| Sandboxed code execution                                                      | contract + adapters (`@pleach/sandbox`; core's `code_exec` refuses until a runner is injected)                                                                                                                                                                                                      | consumer-wired                                | consumer-wired                    | consumer-wired                    | consumer-wired                  |
| Safety-policy API (typed, registerable)                                       | `defineSafetyPolicy` — `advisory` / `guardrail` / `refusal`; enforced as prompt text and an audit record today, blocking effects declared but not wired                                                                                                                                             | none                                          | consumer-wired                    | none                              | none                            |
| Agent Skills (markdown skills, intent-matched injection)                      | yes (`SkillLoader` — `SKILL.md` + frontmatter, three sources)                                                                                                                                                                                                                                       | none                                          | none                              | none                              | none                            |
| **Routing & replay**                                                          |                                                                                                                                                                                                                                                                                                     |                                               |                                   |                                   |                                 |
| Family + transport lock (session-scoped)                                      | yes                                                                                                                                                                                                                                                                                                 | provider-agnostic, no lock                    | none                              | none                              | none                            |
| Replay from the record (no model call)                                        | yes                                                                                                                                                                                                                                                                                                 | none                                          | none                              | none                              | none                            |
| Time-travel checkpoints                                                       | yes                                                                                                                                                                                                                                                                                                 | none                                          | partial (LangGraph checkpointers) | none                              | partial (suspend/resume)        |
| Eval / replay diff engine                                                     | DIY against the ledger today; `@pleach/eval@0.1.0` ships the contract and scoring, `@pleach/replay@0.1.0` ships `replayTurn` and a chain verifier                                                                                                                                                   | none                                          | partial (LangSmith, external)     | partial (eval module)             | none                            |
| Durable execution (resume after a crash)                                      | partial — per-turn checkpoints, `checkpoints.rollback`, `sessions.resume`, event-granular replay; no automatic mid-turn resume of in-flight work                                                                                                                                                    | none                                          | partial (LangGraph checkpointers) | partial (workflow checkpoints)    | partial (suspend/resume)        |
| Background / scheduled runs                                                   | partial — schedule tools persist intent to the store; the runtime has no timer, so the host fires due tasks via `readScheduledTasks`                                                                                                                                                                | none                                          | partial (hosted platform)         | none                              | partial (hosted platform)       |
| **Storage & contracts**                                                       |                                                                                                                                                                                                                                                                                                     |                                               |                                   |                                   |                                 |
| BYO-DB storage adapters                                                       | Memory / IndexedDB / Supabase                                                                                                                                                                                                                                                                       | LocalStorage only                             | none for runtime                  | vector stores                     | yes                             |
| Long-term memory (fact extraction + semantic recall)                          | yes, executor-gated (`@pleach/core/memory` extraction + cross-agent consolidation; pgvector search via `SupabaseStore.search`)                                                                                                                                                                      | none                                          | partial                           | partial                           | yes                             |
| MCP (Model Context Protocol)                                                  | server (`@pleach/mcp` — `MCPServer` wraps the runtime; stdio / SSE / WebSocket); no client-side `mcpServers` attach                                                                                                                                                                                 | client (experimental)                         | client (adapters)                 | client (tool adapters)            | client + server                 |
| Offline-first sync (IndexedDB ↔ server)                                       | yes                                                                                                                                                                                                                                                                                                 | none                                          | none                              | none                              | none                            |
| Tamper-evident hash chain                                                     | writer-side stamping on by default; verifier shipping in `@pleach/core/eventLog` (`verifyChainForChat`, `generateProof`); `@pleach/compliance@0.1.0` adds scrubbers and attestation                                                                                                                 | none                                          | none                              | none                              | none                            |
| Language-agnostic wire contract                                               | yes (TypeScript reference; a Go implementation is planned, and the contract already works in a Go reference consumer)                                                                                                                                                                               | none (TS-only)                                | none (separate JS / Py codebases) | none (separate JS / Py codebases) | none (TS-only)                  |
| **Streaming & corrections**                                                   |                                                                                                                                                                                                                                                                                                     |                                               |                                   |                                   |                                 |
| Retract streamed answer text, with a typed reason                             | yes (`content.correction` carries the replacement body and a `reason` from `CONTENT_CORRECTION_REASONS`; `useChat`, `useHarness`, `useSessionMessageStream` and `collectStream` apply it mid-stream and drop a correction left over from an earlier turn)                                           | —                                             | —                                 | —                                 | —                               |
| Answer, draft and narration lanes on streamed text                            | yes (`laneOfDelta` reads the call class stamped on each `message.delta`; the shipped clients build the reply through `isAnswerDelta`, so `utility` and `reasoning` output is never answer text. A tool-loop step's prose arrives separately as `narration.segment`. Untagged deltas read as answer) | —                                             | —                                 | —                                 | —                               |
| Withheld prose is carried out, not discarded                                  | yes (when the runtime keeps a decision turn's prose out of the answer, `content.suppressed` carries the full text, a fingerprint and that round's tool calls, so a host can archive it)                                                                                                             | —                                             | —                                 | —                                 | —                               |

Source notes for the row data live next to the comparison table in the
`@pleach/core` README; this page mirrors them. A few cells need a gloss:

* **"Partial via `callbacks`"** (LangChain): a `BaseCallbackHandler`
  observes events, but they share no row identity, so no
  `(sessionId, turnId, stageId, seqWithinTurn)` tuple joins an observation
  to the call that caused it.
* **"Manual"** (cost allocation): you can compute it but write the
  aggregation yourself. With `@pleach/core`, the
  [`AuditableCall` row](/docs/auditable-call-row) carries each call's cost
  in `modelCall.costUsd`, keyed to `turnId`.
* **"Partial (`UIMessage` stream)"** (AI SDK event log): the stream is
  typed and parseable, but it's the rendered-message stream, not a durable
  audit-keyed log you can `GROUP BY` six months later.
* **"Opt-in"*&#x2A; and &#x2A;*"executor-gated"**: the mechanism ships but installs
  only when the host wires it. A bare `createPleachRoute` passes tool
  results through unmodified until you set `resultOffloadBackend`, and the
  memory-extraction and consolidation nodes register only when you supply
  the matching executor.
* **"Blocking effects declared but not wired"** (safety): all three levels
  currently map to a log-only effect. Policy text reaches the prompt and
  the audit record, but no code path refuses a tool call or a synthesis on
  a policy verdict. The blocking effects (`block_tool_call`,
  `block_synthesis`) are declared future values.
* **"No automatic mid-turn resume"** (durable execution): nothing scans for
  an in-flight turn on process restart, and pending async tasks are not
  rehydrated. The
  [durable-execution platforms](#durable-execution-platforms-inngest-triggerdev-dbos-temporal)
  section is the compose-don't-compete version of this row.
* **Streaming and corrections**: the event shapes, the lane table and
  the rules the core clients follow when they apply a correction are on
  [stream events](/docs/stream-events#delta-lanes). Guardrail products
  outside this table also retract streamed text: Azure OpenAI's
  asynchronous filter and Guardrails AI's error spans are compared in
  [streaming an answer a guard may correct](/blog/streaming-an-answer-a-guard-may-correct).
* **"Language-agnostic wire contract"**: the contract pins HTTP+SSE shapes,
  fingerprint canonicalization and the `AuditableCall` row layout. A Go
  implementation is planned, and a Go reference consumer already reads the
  SSE frames and checkpoint envelopes. Other libraries publish per-language
  SDKs that share a name but not a contract, so a recorded turn from one
  can't replay against the other.

## Worked example: adding an agent to a multi-tenant SaaS [#worked-example-adding-an-agent-to-a-multi-tenant-saas]

The matrix is axis-by-axis. Here is the same difference as one narrative.
You run a SaaS where every customer owns their data, as per-tenant rows or
a schema or database each. You want an in-app agent that answers questions
and takes actions over *that customer's* data. Same feature, five
runtimes: what you build yourself versus what the runtime hands you.

| The job                                            | `@pleach/core`                                                       | AI SDK                           | LangChain                         | LlamaIndex         | Mastra                       |
| -------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------- | --------------------------------- | ------------------ | ---------------------------- |
| Define the "query this customer's DB" tool         | `defineTool` + Zod                                                   | `tool()` + Zod                   | `@tool` / `DynamicStructuredTool` | query engine + Zod | `createTool` + Zod           |
| Keep tenant A's agent out of tenant B's data       | `runtime.tenant` facet; outbound `x-tenant-id` header by default     | closure you thread by hand       | `config` / closure by hand        | per-index, manual  | `requestContext` per request |
| Bill each customer for their agent spend           | `AuditableCall` row, tenant-stamped, one `GROUP BY`                  | read `usage`, attribute yourself | callbacks, manual                 | manual             | partial                      |
| Show a customer an audit of what the agent did     | hash-chained call rows and event log, per tenant                     | build it                         | external (LangSmith)              | none               | partial                      |
| Stream the answer into your UI                     | `@pleach/react` hooks + canonical SSE routes                         | first-class (`useChat`)          | stream events, partial            | partial            | yes                          |
| Let an enterprise tenant bring their own model key | transport + family locked per session                                | swap provider, manual            | manual per chain                  | manual             | per-workflow                 |
| Debug one customer's broken session after the fact | replay from the record, without calling the model (`@pleach/replay`) | re-run and hope                  | logs only                         | none               | partial                      |

The first two rows are close to a wash: everyone writes a tool, and
everyone can thread a tenant id through a closure. The split is below them.
Per-tenant **cost**, **audit** and **replay** are what a SaaS discovers it
needs after the agent ships, and where "manual" becomes next quarter's
backlog. If you'll ship the DB tool and stop there, the AI SDK or Mastra
needs less learning.

### Already on LangGraph (or another runtime)? [#already-on-langgraph-or-another-runtime]

Your runtime can write to the same record. What the record keeps together
is four interactions: a row per attempt that closes on an abort, a chain
that holds under concurrent writers, resume and fork without forking the
chain, and replay next to erasure
([Landscape](/docs/landscape#if-you-already-run-a-runtime)). Two paths fit
a reader who already runs a loop (not on npm yet):

* **Observe** keeps your loop. `@pleach/observe` records each call you hand
  it, with one-call hooks for the AI SDK, LangChain, the OpenAI Agents SDK
  and Mastra. It does not give you family-lock, replay or checkpoints. The
  LangChain and OpenAI Agents hooks write one row per invocation, so a retry
  inside the client is not its own row.
* **Core brownfield** lets core drive the turn over your provider, store and
  tools (`createPleachRuntime({ provider })`, or `createBrownfieldRuntime`;
  LangChain chat models go through `LangChainProvider` from
  `@pleach/langchain`). It gives the whole runtime, but core runs that turn
  instead of your graph, and your store must pair storage with a
  checkpointer.

Each piece on its own (a tool, a tenant id, usage logging, a retry wrapper)
fits beside your current runtime. Keeping them on one record is the hard
part. The [adoption-paths chooser](/docs/adoption-paths#choose-your-path)
names the first step for each path.

## Where Pleach differs structurally [#where-pleach-differs-structurally]

Most TS LLM frameworks treat audit, multi-tenancy, OTel and redaction as
consumer responsibilities you wire on top. The runtime stays small and the
integration work moves to you.

`@pleach/core` treats them as substrate-level invariants. Audit rows have a
typed shape and are hash-chained by default, as are event-log rows. OTel
spans are parent-threaded and carry the tenant id. Calls through a seam,
and the tool loop's own provider requests, each get an `llm.invocation`
span, and a retry adds an `llm.attempt` child span.
A sub-agent run by the built-in tool-loop executor gets a `subagent.run`
span.

A default redactor runs on the call ledger before hashing, and event-log
scrubbers run on the Postgres and SQLite writers by default. A failed scrub
behaves differently per writer:

* **Postgres and SQLite:** drops the row and emits a probe, except that a
  SQLite `audit.recorded` row throws instead of dropping.
* **Supabase `EventLogWriter`:** a dropped audit-level event leaves a
  metadata-only redaction row in its place.

CI checks that every core event type has a redaction decision and a
producer, and that public capabilities sit on a facet.

The trade-off is real: more machinery to learn upfront and a stricter
contract for what counts as "a feature." The return is fewer ways for a
load-bearing property to regress silently. If these invariants don't matter
to your product, the cost won't pay back; [see below](#when-to-reach-for-something-else)
for what to use instead.

## When to reach for something else [#when-to-reach-for-something-else]

`@pleach/core` is a substrate, not a chat shell. It costs a runtime
contract to model your agent inside and a lattice that constrains where
calls live. That is the price of the audit ledger, the family lock and
replay from the record. If you don't need those, the overhead isn't free.

A single-shot RAG bot with no persistence, multi-tenancy or audit
obligation gets little from the substrate compared with a 30-line AI SDK
script. The lattice and ledger pay off in a multi-tenant production agent
with replay, OTel and compliance gates. Below that, the AI SDK is the right
floor.

<DecisionFlowDiagram />

* **A chat shell with tools and nothing more?** The AI SDK's `streamText` /
  `generateText` fits. You get less to learn, fewer constraints and no
  ledger. Your audit story is the provider's request id and your own log
  line, which is enough until finance asks for a monthly rollup per end
  customer, or per employee, team or cost-center under one Anthropic
  Workspace or OpenAI Project. Then you re-key logs or reach for the
  `AuditableCall` row.
* **Chain abstractions and a large pre-built component catalog?**
  LangChain. The ecosystem breadth is the value, and the `Runnable`
  contract is mature.
* **A retrieval-first system with indexes as the primary primitive?**
  LlamaIndex. RAG-shaped problems map cleanly.
* **A workflow runtime with a hosted control plane?** Mastra. The hosted
  surface is the differentiator.

## When `@pleach/core` is the right call [#when-pleachcore-is-the-right-call]

Three signals move the runtime from overkill to undersell:

1. **Audit obligations.** You need to point a regulator, a customer or your
   future self at the **tool invocations and subagent spawns** a session
   made, attributed to the turn that caused them. The
   [evidence table](#what-each-runtime-gives-a-regulated-reviewer) maps each
   mechanism to the requirement it supports. The lattice fires anchor-plan,
   synthesize and post-turn every turn by construction; the ledger records
   which tool ran with what input, which subagent spawned, and how deep.
2. **Cost attribution at the turn level.** Tool-call fan-out and synthesis
   size vary, and a turn is the unit that rolls them up. Each row carries
   `turnId`, `toolName`, `subagentDepth` and its cost in
   `modelCall.costUsd`, so the math is one `GROUP BY`, not a regex pass over
   logs. A call that writes the prompt cache is priced only when it reports
   how many writes were 5-minute and how many 1-hour, and there is a rate
   for each; otherwise it is marked unpriced.
3. **Replay without calling the model.** A recorded turn re-serves its
   responses. `replayRecordedTurn` (`@pleach/replay/recorded`) replays it
   against its original record and names the first request that drifted.
   Steps the runtime doesn't fingerprint yet (decision, synthesize) are
   marked blind, so a turn on a stock runtime is never reported `matched`.

If none of the three apply, the AI SDK is probably the right floor.

### Not regulated? What the rows still give you [#not-regulated-what-the-rows-still-give-you]

The ledger is built for regulated review, but three properties help
anywhere. The record is **complete**: on the built-in providers, every
attempt is recorded, including aborted, failed and fallback attempts. It is
**honest about unknowns**: an unpriced call is marked unpriced, never $0.
And it is **verifiable**: a row removed after it was written shows up as a
gap in the chain.

| You want to know                               | What the row gives you                                                                                                                                                                                                                                                                                     |
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Why an answer changed                          | The model requested and, when the provider reports it, the model that served it, on every attempt, fallbacks included. On the runtime (not `@pleach/observe`), replay names the first request that drifted, with decision and synthesize steps marked blind.                                               |
| What a turn really cost                        | Aborted attempts are counted; one whose usage never arrived is unpriced, not $0. The rollup marks its total `partial` when any call was unpriced, so read it as a floor. If no call was priced, the total is left out.                                                                                     |
| That nothing was removed later                 | A row deleted from the middle of a chain breaks the chain. Store the committed chain head to extend the check to the last row.                                                                                                                                                                             |
| Cost per customer                              | Every row carries a tenant id: the runtime's `tenantId`, `"default"` until you set one.                                                                                                                                                                                                                    |
| How to delete a user's data and keep the trail | Event-log scrubbers redact matched PII before hashing, so nothing is rewritten later. With a configured key store, shredding a subject's key erases that subject's sealed call-row fields and every row hash still verifies. Sealing event-log content per subject works the same way and is experimental. |

If all you need is debugging, a tracing tool covers most of it. The rows
earn their place when numbers must reconcile, such as billing customers or
cost per tenant, or when you must show a recorded call wasn't removed
afterwards.

## Durable-execution platforms (Inngest, Trigger.dev, DBOS, Temporal) [#durable-execution-platforms-inngest-triggerdev-dbos-temporal]

Inngest and its siblings are **not** competitors to `@pleach/core`. They
sit one layer up. A durable-execution platform wraps the **request**: step
memoization across crashes, retries, scheduling, cron, fan-out and a hosted
run dashboard. `@pleach/core` owns the **LLM turn inside the request**: the
typed `AuditableCall` row, family-lock, replay from the record and subagent
cost rollup.

<Callout>
  Competitor columns reflect each project's public docs as of 2026-08 and may have changed since.
</Callout>

| Capability                         | `@pleach/core`                                                                                                                                                   | Inngest / Trigger.dev / DBOS               |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| Category                           | LLM-turn runtime                                                                                                                                                 | durable-execution platform                 |
| Step memoization across crashes    | none — per-turn checkpoints only                                                                                                                                 | yes (their core primitive)                 |
| Cron / event-triggered execution   | none                                                                                                                                                             | yes                                        |
| Concurrency, throttling, fan-out   | none                                                                                                                                                             | yes                                        |
| Hosted run dashboard               | none                                                                                                                                                             | yes                                        |
| Per-call audit row in YOUR schema  | yes (`AuditableCall` in your Postgres)                                                                                                                           | run history is vendor-shaped               |
| Family-locked provider routing     | yes                                                                                                                                                              | not provider-aware                         |
| Replay-deterministic LLM stream    | yes (re-serves the recorded responses and names the first request that drifted; decision and synthesize steps marked blind, so a stock turn never reads matched) | code-level memoization, not stream-level   |
| Subagent rollup to parent `turnId` | yes (`SpawnTreeState`)                                                                                                                                           | manual                                     |
| Tamper-evident audit trail         | yes (previous-row hash and row hash on call rows and the event log)                                                                                              | run history isn't cryptographically signed |
| Multi-tenant tenant-id stamping    | on every row and span, and on outbound HTTP by default (`tenantHeader: false` opts out)                                                                          | your event metadata                        |

The honest pattern is **use both**: wrap `runtime.executeMessage` inside
`step.run` and get Inngest's operational trail and Pleach's business trail.
See [Pleach + Inngest](/docs/with-inngest).

### When you don't need the durable-execution platform [#when-you-dont-need-the-durable-execution-platform]

* A request-scoped agent turn that completes inside one HTTP request, with
  no external waits, cron or fan-out. Call `runtime.executeMessage` directly
  from an API route.

### When you don't need `@pleach/core` [#when-you-dont-need-pleachcore]

* The AI SDK plus Inngest covers single-tenant chatbots with tools and no
  audit or replay requirement. Pleach's overhead doesn't pay back there.

## Observability, cost, and eval tools (a read-side category) [#observability-cost-and-eval-tools-a-read-side-category]

Helicone, Langfuse, LangSmith, LiteLLM, MLflow, Logfire, Braintrust,
OpenMeter and general ops platforms are the tools a team shops against when it wants "audit, cost and
replay." The overlap with `@pleach/core` is real, and so is the boundary.
These tools **read**: they ingest spans or proxy requests into an analytical
store for dashboards, eval suites and cost rollups. `@pleach/core`
**writes**: it produces the typed `AuditableCall` row, in your own
database, that those tools could read. Most are excellent at the read job,
and several compose with Pleach rather than replace it.

<Callout>
  Competitor columns reflect each project's public docs as of 2026-08 and may have changed since.
</Callout>

| Capability                           | `@pleach/core`                                                                                             | Helicone / Langfuse / LangSmith        | LiteLLM                            | MLflow / Logfire                 | Braintrust          | OpenMeter                     |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------- | -------------------------------------- | ---------------------------------- | -------------------------------- | ------------------- | ----------------------------- |
| Category                             | write-side substrate                                                                                       | observability (proxy / spans)          | gateway proxy                      | tracing                          | eval platform       | usage metering                |
| Per-tenant cost allocation           | row, tenant-stamped                                                                                        | yes (metadata tag)                     | yes (`customer_id`)                | via span attrs                   | metadata            | yes (its core job)            |
| Subagent spend rolled to parent turn | parent `turnId` on each `AuditableCall` row                                                                | reconstructed from trace tree          | none                               | tree walk                        | grouping key        | none                          |
| One row per call **in your DB**      | yes (`AuditableCall`)                                                                                      | their store (self-host = their schema) | yes (`SpendLogs` in your Postgres) | MLflow: your Postgres            | their store         | events, not call rows         |
| SQL-queryable, joinable to billing   | yes                                                                                                        | filter DSL / API                       | yes (spend rows)                   | MLflow yes / Logfire their cloud | proprietary         | metering join, not call shape |
| Tamper-evident hash chain            | Previous-row hash on call rows and the event log                                                           | none                                   | none                               | none                             | none                | none                          |
| Deterministic replay of the turn     | re-serves the record and names the first request that drifted (decision and synthesize steps marked blind) | none (re-run)                          | none                               | none                             | re-generate + score | n/a                           |
| PII redaction at write               | default scrubbers; a failed scrub drops the row                                                            | hook (delegates to Presidio)           | Presidio guardrail                 | masking hook                     | none first-class    | n/a                           |
| Sampling                             | none — every call                                                                                          | expected / recommended                 | n/a                                | configurable                     | n/a                 | n/a                           |

Glosses:

* **"Reconstructed from trace tree"** (subagent spend): child tokens are
  captured as nested spans, but the parent's cost is summed at query time by
  walking the tree, not stored on the parent. Most observability tools share
  this gap.
* **"Their store"*&#x2A; vs &#x2A;*"your DB"** is the load-bearing axis. LiteLLM and
  MLflow write call or trace records into a Postgres you own. For the rest,
  "self-host" means your infra running their schema, not joinable rows in
  your application database.
* **OpenMeter** is the billing destination, not the attribution source. It
  ingests usage events and syncs to Stripe, but doesn't carry the agent
  run's structure. It pairs with the ledger rather than replacing it.
* **General ops platforms** (logs, traces, uptime and on-call) take
  OpenTelemetry traces of model calls, one span per request with its token
  usage and latency, and store prompt text only when an admin turns it on.
  None we read chains those spans or writes a call row to your database.
  They're a sink for the same events, not a ledger.

The honest pattern is **compose**: let `@pleach/core` write the row, point
Langfuse or your OTel collector at the same events for dashboards, and meter
to OpenMeter or Stripe off the tenant-stamped row. The substrate owns the
write; the read tools stay good at reading. The
[landscape page](/docs/landscape) ranks all twenty capabilities by how much
of each is structural here versus available in the tools above.

## Governance control planes and AI gateways (a proxy-side category) [#governance-control-planes-and-ai-gateways-a-proxy-side-category]

This category has the largest surface overlap on this page, and it is the
newest. A governance control plane (Portkey, Cloudflare AI Gateway, Kong AI
Gateway, LiteLLM, TrueFoundry, and the enterprise governed-proxy control
planes emerging above them, of which Merge Gateway and Concentrate are the
clearest-drawn) sits in the request path as a proxy. It is a one-URL swap,
OpenAI-compatible, with zero code change. It enforces *in flight*: access
control bound to SSO, budget refusal before the model is contacted, inline
guardrails and PII redaction, model routing and failover, and a
tamper-evident log of every request exported for SOC 2 or ISO.

The newest of these push the overlap along two axes.
[Merge Gateway](https://www.merge.dev/gateway) prices at provider cost plus
5% and offers budget caps *per customer tier*, per-tenant usage reporting
and pass-through billing, the closest a proxy has come to the
[`AuditableCall` cost row](/docs/auditable-call-row).
[Concentrate](https://concentrate.ai/pricing) went the other way on price.
It [launched in June 2026 on a $5M pre-seed](https://www.finsmes.com/2026/06/concentrate-ai-raises-5m-in-pre-seed-funding.html)
with routing, cross-provider fallback, PII redaction, RBAC, SSO and audit
logs in a free tier at zero markup on tokens. It charges for log retention,
org- and model-level rate limits, and the contract. Routing is no longer a
priced surface in this category.

That overlaps `@pleach/gateway` and `@pleach/compliance` more than anything
else here, which kills a tempting-but-wrong differentiator. A control plane
enforces at **runtime**, same as the substrate. "We're runtime-native, they
analyze after the fact" is true against the
[read-side observability tools](#observability-cost-and-eval-tools-a-read-side-category)
above and **false** against a governed proxy. Both refuse the over-budget
call before any model is contacted.

The axis that splits them is **altitude**, not timing: a proxy governs the
*call*; the substrate governs the *agent*.

<Callout>
  Competitor columns reflect each project's public docs as of 2026-09 and may have changed since.
</Callout>

| Capability                    | `@pleach/core` (+ `@pleach/gateway`)                                                                                                    | Governed-proxy control plane                            |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| Category                      | agent execution substrate                                                                                                               | in-path model proxy                                     |
| Vantage point                 | the agent's execution graph — session, turn, subagent tree                                                                              | flattened HTTP calls to the provider                    |
| What the audit record carries | `turnId`, `toolName`, `subagentDepth`, cost rolled to the parent turn                                                                   | who / what / when / model, per call                     |
| Where the record lives        | the `AuditableCall` row in **your** Postgres                                                                                            | the proxy vendor's plane; you export it out             |
| Cross-provider routing        | family + transport lock (provenance of which model ran)                                                                                 | routing + failover across providers                     |
| PII redaction at write        | default scrubbers; a failed scrub drops the row and emits a probe                                                                       | inline redaction                                        |
| Cost attribution per axis     | tenant-stamped row, one `GROUP BY`                                                                                                      | per-key / per-team on the proxy                         |
| Deployment                    | fair-source, self-host, no phone-home, BYO audit destination                                                                            | proprietary SaaS; all traffic routes through the vendor |
| Adoption cost                 | `init()` + `recordCall()` around the loop you already run ([observe brownfield](/docs/adoption-paths)); adapter graft to add governance | one-URL swap, zero code change                          |

Two cells carry the boundary.

**Vantage point.** A proxy sees the HTTP call to the provider, so it can't
record subagent depth or roll a fan-out up to the turn that caused it. That
structure never crosses the wire. The substrate sits *inside* the agent, so
`subagentDepth` and the turn tree are columns, not a reconstruction. A
proxy's cost dimensions (project, tag, customer) are whatever header the
calling code sent, so the plane records your own claim about yourself. The
substrate derives the tenant id, `turnId` and `delegated_from` from having
executed the work, which is the difference between a log and an
[attestation](/docs/attestation).

**Deployment.** A governed proxy routes 100% of your model traffic through
a third party, the posture a security team usually wants to reduce. The
substrate records inside your perimeter and writes to a database you own.

The reverse is just as true. The proxy's one-URL swap governs apps you don't
control and code you'll never touch; the substrate can't, because it *is*
the code.

Inside code you do control, that gap is narrower than it reads.
[`@pleach/observe`](/docs/observe) wraps the loop you already run and
records each call you hand it, without owning the turn
([not on npm yet](/docs/install#not-on-npm-yet)): `init()` once,
`recordCall()` per call. Pointed at Postgres (or any ledger you pass), it
writes a chained row to the same table and chain the runtime writes to. Tags
and the full sub-agent path are copied only with `ledgerPayload`. OTel and
in-memory destinations get telemetry. It does not give you family-lock,
replay or checkpoints, which need the runtime to drive the loop;
[adoption paths](/docs/adoption-paths) is the decision between the two.

For routing and cost the two compose: put a gateway in front of org-wide
traffic that isn't on the substrate yet, and use the substrate where the
thing you must audit is the agent's execution rather than the model call.

For provenance they contradict. A proxy's headline reliability feature,
automatic cross-provider failover, is non-reproducible by definition: the
record says which model the router happened to pick, under that moment's
latency and quota. The substrate's [family + transport lock](/docs/determinism)
is the opposite bet. It pins the provider family and transport for the
session so the same turn [replays](/docs/replay) through the same path, and
records the lock in the row. If deterministic replay is part of your audit
posture, send the substrate's own model calls direct, not through a failover
proxy. Keep the gateway fencing the unmanaged traffic beside it, not
underneath it.

### When to reach for a governed proxy instead [#when-to-reach-for-a-governed-proxy-instead]

* **You need org-wide governance over apps you don't own, today.** Personal
  keys, unmanaged tools, a dozen teams calling a provider directly. A
  proxy's one-URL swap fences all of it without a code change; a substrate
  can't retrofit code you don't control.
* **Closed SaaS is acceptable and the call is the unit.** If "who called
  which model, under which policy" is the whole audit question, a proxy
  answers it with less to adopt.

### When you'd build on `@pleach/core` instead [#when-youd-build-on-pleachcore-instead]

* **The object of record is the agent's execution, not the model call.**
  Subagent depth, the turn tree and per-turn cost rollup are the audit
  surface, and a proxy structurally can't see them.
* **The record has to live in your own database.** The
  [`AuditableCall` row](/docs/auditable-call-row) lands in your Postgres,
  joinable to your billing schema, with no traffic routed through a vendor
  plane and nothing to export back out.
* **Routing all traffic through a third-party proxy is the posture you're
  avoiding.** Self-hosted and fair-source, the substrate keeps the audit
  inside your perimeter.

## Compliance review and archiving platforms (a records-side category) [#compliance-review-and-archiving-platforms-a-records-side-category]

Compliance review platforms for regulated financial firms cover
advertising review, communications supervision and archiving. Their AI
checks content against the firm's own policies and suggests changes. A
person still makes every review decision.

The overlap with `@pleach/core` is real: human approval of AI output,
write-once retention and a named audit trail. The two split on the object
of record. A review platform records what a person decided about a piece of content.
The ledger records the model calls that produced it.

<Callout>
  The review-platform column reflects vendors' public pages as of 2026-11 and may have changed since.
</Callout>

| Capability                       | Review and archiving platform                                  | the `AuditableCall` ledger                                                                                             |
| -------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Object of record                 | a review action on a piece of content                          | one provider call: model, tokens, cost, turn                                                                           |
| Who decides                      | a person makes every review decision, recorded with their name | an [approval gate](/docs/interrupts) records an approver reference and the time; your identity table resolves the name |
| What sits behind an AI flag      | the policy clause and reasoning, kept with the review record   | one row per model call, no sampling                                                                                    |
| Tamper evidence                  | archived records on WORM storage                               | hash chain on call rows; opt-in [WORM tier](/docs/worm)                                                                |
| Where records live               | the vendor's platform                                          | your database                                                                                                          |
| Staff use of generative AI tools | archived as a channel                                          | not captured; the ledger records your agent's calls                                                                    |
| Run it yourself                  | not documented                                                 | yes, a library in your process                                                                                         |

They compose rather than compete. An agent drafts a piece of client
communication, and its calls land in the ledger. The draft goes into the
firm's review queue, and a reviewer decides there. An examiner who asks who
approved it gets the review trail. One who asks how the draft was written
gets the turn's rows.

Neither side documents an integration today. Export the turn's rows and
attach them as evidence. The [SEC and FINRA page](/docs/compliance/sec-finra)
says what Pleach covers for a regulated firm, and what stays with you.

## Agent-memory & knowledge-graph substrates (a read-side category) [#agent-memory--knowledge-graph-substrates-a-read-side-category]

Memory layers and knowledge-graph engines (Letta, Mem0, Zep) persist what
an agent has learned so a later turn can read it back. The sharpest form is
event-sourced: an append-only, content-addressed graph where each tool call
and decision is a write-once node, and the agent recalls by querying the
graph instead of embedding-searching its own scrollback.

That form looks adjacent to `@pleach/core`: append-only rows, content
hashes, a causal chain, fork and replay. They split on the object of record.

Memory is not a category the substrate lacks. `@pleach/core` ships its own
memory layer: LLM-driven fact extraction, cross-agent consolidation, a
confidence-decay auditor, and pgvector-backed semantic recall through
`SupabaseStore.search` ([Memory](/docs/memory)). The table compares a
dedicated memory product against the **audit ledger**, the substrate's
object of record, not the whole package.

<Callout>
  Competitor columns reflect each project's public docs as of 2026-09 and may have changed since.
</Callout>

| Capability                  | Memory / knowledge-graph substrate                                          | the `AuditableCall` ledger                              |
| --------------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------- |
| Object of record            | the agent's **knowledge and decisions** — files, entities, notes, rationale | one **provider call** — model, tokens, cost, family     |
| Read by                     | the **agent itself**, to shape its next step                                | **people** — billing, audit, compliance                 |
| Read paradigm               | graph traversal / Datalog over entities                                     | SQL rows joinable to your billing schema                |
| Fields about the model call | none — no provider, model, token, or cost column                            | the whole row                                           |
| Which path is the product   | the **read** — you query it to reason                                       | the **write** — record every call, then read to account |

A memory substrate is a **read substrate**: the graph exists so the agent
can query it and decide. `@pleach/core` is a **write substrate**: the ledger
exists so every call is recorded, and the reads serve the people who answer
for the spend. Both can record a tool call, but a memory graph stores the
tool's *semantics* so the agent recalls causally, while the ledger stores
its *economics* so finance attributes it.

They compose rather than compete. A memory graph can sit beside the
[`AuditableCall` row](/docs/auditable-call-row), reading the same session.
Reach for a dedicated memory product when the agent's recall outgrows the
built-in layer: knowledge-graph traversal, entity resolution, memory shared
across applications. Reach for `@pleach/core` when the account of what the
agent spent is the problem.

This differs from the observability cohort above, which reads for a **human
dashboard**. A memory substrate reads for the **agent's next step**. Neither
is the write-side ledger, and both can read the rows Pleach writes.

## Agent harnesses (a different category) [#agent-harnesses-a-different-category]

Harnesses like Claude Code, Goose, OpenHands, AutoGen and CrewAI aren't
competitors to `@pleach/core`. They sit one layer up. A harness ships a
complete agent loop you launch and use; a substrate ships the primitives
you'd build a harness on. The axis is opinionation versus embeddability: a
harness picks the UX, tool surface, loop shape and session model for you,
and a substrate gives those decisions back. Many harnesses are
session/turn/tool-loop/synthesis internally, the shape the four-stage
lattice formalizes.

<Callout>
  Competitor columns reflect each project's public docs as of 2026-09 and may have changed since.
</Callout>

| Capability                                                             | `@pleach/core`       | pi                                                                                                                              | Claude Code                 | Goose                       | OpenHands               | AutoGen                    | CrewAI                     |
| ---------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | --------------------------- | ----------------------- | -------------------------- | -------------------------- |
| Category                                                               | runtime substrate    | dev harness (CLI) + embeddable toolkit                                                                                          | dev harness (CLI)           | dev harness (CLI / desktop) | agentic dev environment | multi-agent framework      | multi-agent framework      |
| Embeddable in your product                                             | yes (npm dep)        | yes (`pi-ai` / `pi-agent-core`); CLI is not                                                                                     | no (end-user tool)          | no (end-user tool)          | partial (server mode)   | yes (library)              | yes (library)              |
| Per-call audit row keyed `(sessionId, turnId, stageId, seqWithinTurn)` | yes                  | no — [spans, no exporter or persistence by design](https://github.com/earendil-works/pi/blob/main/packages/telemetry/README.md) | no                          | no                          | no                      | no                         | no                         |
| Family + transport lock                                                | yes                  | 30+ providers, no lock                                                                                                          | provider-locked (Anthropic) | configurable, no lock       | configurable, no lock   | provider-agnostic, no lock | provider-agnostic, no lock |
| Replay determinism                                                     | re-serves the record | no                                                                                                                              | no                          | no                          | no                      | no                         | no                         |
| Multi-tenant cost attribution by `turnId`                              | yes                  | per-call `usage.cost.total`, not persisted or rolled to a turn                                                                  | n/a (single-user)           | n/a (single-user)           | n/a (single-user)       | manual                     | manual                     |
| Time-travel checkpoints                                                | yes                  | session tree with branch + compaction                                                                                           | session resume              | session resume              | session resume          | none                       | none                       |
| Lattice-enforced stage edges                                           | yes                  | implicit loop                                                                                                                   | implicit loop               | implicit loop               | implicit loop           | freeform                   | role-graph                 |

**pi is the case this axis handles least cleanly.** Most harnesses are one
opinionated product. pi ships as five packages, and two of them are
ordinary embeddable libraries: `pi-ai` (a unified API over 30+ providers)
and `pi-agent-core` (the agent loop, tool contract and event stream). So pi
sits on both sides of the line. Its CLI is squarely the category above,
while its core is a genuine alternative in the slot `@pleach/core` occupies.
If you're choosing a loop to build a product on, compare against
`pi-agent-core`, not the CLI.

Its [`pi-telemetry`](https://github.com/earendil-works/pi/blob/main/packages/telemetry/README.md)
package is the closest thing in the harness cohort to Pleach's recording
surface, and the comparison is narrow. It defines vendor-neutral spans with
a conformance suite for adapter authors, and explicitly ships no exporter,
no persistence, and no cost or audit concept. That is a deliberate scope,
not a gap, but it yields a span tree, not a typed row you can join to
billing. [Landscape](/docs/landscape) draws the same line between a trace
and an `AuditableCall`.

Verdicts in the table come from each project's published documentation. A
"no" means no first-class concept in those docs, not proof the capability
can't be assembled.

### When to reach for a harness instead [#when-to-reach-for-a-harness-instead]

* **You're the user, not the vendor.** You want an agent on your own
  machine to write code, refactor a repo or drive a browser. Install Claude
  Code or Goose; you don't need a substrate.
* **The harness's loop is the loop you want.** Off-the-shelf harnesses ship
  a planning / tool-loop / synthesis cycle that suits dev tooling. If your
  product needs the same shape, the harness saves the build.
* **You're prototyping a multi-agent topology.** AutoGen and CrewAI give you
  role primitives and conversation patterns out of the box.

### When you'd build on `@pleach/core` instead [#when-youd-build-on-pleachcore-instead-1]

* **You're shipping a customer-facing agent product.** Harnesses are
  end-user tools; a substrate is what you embed where each customer gets
  their own session, audit trail and invoice.
* **The audit ledger is load-bearing.** Per-call rows joinable to a billing
  schema and a compliance review differ in shape and durability from a
  harness's session log.
* **You're already past a harness.** Teams sometimes hit per-tenant
  accounting across sub-agents or the replay wall and find the session log
  isn't the row shape they need.

`@pleach/core` itself is written inside harnesses. The runtime they write is
the one a *product team* embeds: different consumer, same surface.

## If you already buy direct from Anthropic or OpenAI [#if-you-already-buy-direct-from-anthropic-or-openai]

Pleach isn't an alternative to an Anthropic Enterprise or OpenAI Enterprise
contract. It composes underneath one. SSO/SAML, ZDR, Workspaces or
Projects, the Admin / Usage API, dedicated capacity, prompt caching,
snapshot pinning, evals and fine-tuning stay where they are. The runtime
adds three pieces the vendor contract doesn't cover:

1. **Per-axis rollup inside one Workspace / Project.** The Admin or Usage
   API reports the Workspace or Project total. The `AuditableCall` row
   carries an opaque `tenantId` you wire to whichever axis you bill or audit
   against: external customers in a multi-tenant SaaS, or employees, teams
   and cost-centers inside a company. There is one row per request the
   provider received, so sums reconcile to the vendor total for priced
   calls. Cache-write calls follow the pricing rule under cost attribution
   above and are marked unpriced otherwise.
2. **Hash-chained audit row in your own DB.** ZDR governs what the vendor
   stores. The row-hash chain on every `AuditableCall` row (on by default)
   governs what *you* store and how you defend it to a downstream auditor: a
   customer's compliance team, an SEC inquiry, an EU AI Act review.
3. **Replay from the record.** A recorded turn re-serves its responses
   without calling the model, so a bug report can be re-run without
   re-billing it.

No new vendor, no new SOC 2 boundary, no new ZDR review. Pleach is one
package and a Postgres table you already run (not on npm yet).

<Cards>
  <Card title="Migrating from Anthropic Enterprise" href="/docs/migrating-from-anthropic-enterprise" description="Keep SSO, ZDR, Workspaces, the Admin API. Close the three gaps the vendor contract doesn't cover." />

  <Card title="Migrating from OpenAI Enterprise" href="/docs/migrating-from-openai-enterprise" description="Keep SSO/SCIM, ZDR, Projects, the Usage API. Close the three gaps the vendor contract doesn't cover." />
</Cards>

Cloud-mediated transports (Bedrock, Azure OpenAI, Vertex) hit the same three
walls with a different BYOK substrate (IAM federation rather than API key)
and network posture (VPC, region pinning, residency). The ledger,
fingerprint and family-lock primitives compose with any provider you wire
through the SDK. Cloud-mediated provider adapters land in `@pleach/gateway`
v1.x.

Two sibling SKUs reach the same reader through adjacent doors.
[`@pleach/coding-agent`](/docs/coding-agent) is the sandboxed coding-agent
surface for the internal dev-tools team, with the same audit row, `tenantId`
axis and chargeback query. The
[language-agnostic contract](/docs/language-agnostic-contract) answers
Enterprise IT's "is this TypeScript-only?": the substrate is wire shapes. A
Go implementation is planned, and a Go reference consumer already reads the
SSE frames and checkpoint envelopes.

## An agent-forward surface (a usage axis) [#an-agent-forward-surface-a-usage-axis]

One axis cuts across every category above: *who operates the surface*.
Most of these tools are a human console first, a dashboard you read or an
API you wire, with agent access added on top. Pleach is built the other way.
The runtime, the docs and the discovery surface are made to be read and
driven by an agent, and a developer reads the same surface. All of this
ships today:

* The runtime exposes a typed, introspectable [facet API](/docs/facets)
  (`runtime.tenant`, `runtime.events`, `runtime.graph.*`), so an agent and a
  developer read the same short list.
* The docs render to [`/llms.txt`](/llms.txt) and
  [`/llms-full.txt`](/llms-full.txt), with a per-page Markdown twin on every
  URL (append `.md`) and per-page `TechArticle` JSON-LD whose `keywords`,
  `about` and `mentions` come from one controlled tag vocabulary.
* The site ships a live MCP server (`search_docs`, `get_doc_markdown`) and
  an agent-skills index with a SHA-256 digest per page, so a tool can
  discover and verify the surface without scraping HTML.

The line, reused from the FAQ: agent-friendly first, usable by developers
because they read the same surface. A dashboard-first tool can bolt on an
agent endpoint; it can't retro-fit the whole surface into one an agent was
meant to operate.

## Where to go next [#where-to-go-next]

<Cards>
  <Card title="Part 11 and ALCOA+" href="/docs/compliance/part-11-alcoa" description="By topic: which requirement each mechanism answers, whether it is on by default, and what you still provide." />

  <Card title="Landscape" href="/docs/landscape" description="Twenty capabilities ranked by how differentiated each is — structural to the audit row, assembled here, or table stakes." />

  <Card title="The AuditableCall row" href="/docs/auditable-call-row" description="What's in the per-call audit row, and what you can join it against." />

  <Card title="Architecture" href="/docs/architecture" description="The six pieces of the substrate — stage lattice, call classes, seams, family-lock, audit ledger, event log." />

  <Card title="Packages" href="/docs/packages" description="The @pleach/* matrix — which sibling layers on top of core for which job." />

  <Card title="Typed records" href="/docs/typed-records" description="Discriminated-union audit payloads that narrow on payload.kind in TypeScript." />

  <Card title="Hash chain" href="/docs/hash-chain" description="Call rows and event-log rows carry a previous-row hash and a row hash for tamper-evidence." />
</Cards>
