Skip to content
pleach
Integrate

Pleach + OpenAI Agents SDK

Already on @openai/agents? What the Agents SDK does natively, what is easy beside it, and what gets hard when you need all of it on one record.

This page is for readers already running the OpenAI Agents SDK (@openai/agents). If you call openai.chat.completions.create or openai.responses.create directly, see Pleach + OpenAI SDK instead. The other coexist patterns (Anthropic SDK, Mastra, Inngest) follow the same posture.

Already on the OpenAI Agents SDK?

The Agents SDK @openai/agents@0.18.0 is native for human-in-the-loop, memory, MCP and compaction. Each other row alone is a side module beside it. Pleach's column is what the runtime path does today; the four interactions that get hard together are on the landscape page.

CapabilityNative on the Agents SDK (@openai/agents@0.18.0)Easy beside itHard in combinationPleach today
Row per attempt—with maxRetries: 0 + modelSettings.retry; otherwise hard—On the built-in providers, every request the runtime sends writes its own row, retries included, for sub-agents too; a provider that doesn't declare per-attempt rows keeps one row per call. The provider SDK's own retries are turned off so none hide inside it. An attempt cut off by an abort still closes its row.
Chained row——trace processors can't fail closedCall rows are hash-chained by default, in Postgres and in the quickstart store. The verifier names the first row that doesn't match. It catches an edit, a backfill or a deletion; it doesn't stop one, and an unkeyed chain can be rewritten end to end by anyone with write access.
Typed keys + sub-agent rollup—a side module beside the runner—the root turn and the subagent depth on every row
Cost per turn and tenant—easy to hard, depending on which calls bypass your wrapper—modelCall.costUsd on each per-call row (costOmitted says why when it is absent). Calls that write the prompt cache are priced only when the call reports how many writes were 5-minute and how many 1-hour and there is a rate for each, and marked unpriced otherwise.
Tenant on row, span and HTTP—a side module beside the runner—The tenant id on every row and span. Providers stamp it on outbound HTTP as x-tenant-id by default; tenantHeader: false turns that off and tenantHeader: "<name>" renames it.
Scrub before write——traces export to OpenAI by defaultA default PII redactor runs on the call ledger before the row is hashed. Opt out explicitly with piiRedactorNoop(). Event-log scrubbers run on the Postgres and SQLite writers by default; opt out of SQLite scrubbing with createSqliteDurableStore(path, { redaction: "off" }) (the sidecar uses PLEACH_REDACT=0).
Replay without re-firing——not providedReplay re-serves a turn's recorded responses instead of calling the model. replayRecordedTurn (from @pleach/replay/recorded) replays a recorded turn 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.
Fork and rewind——not providedA fork's first row commits to the parent row it branched from; verifyBranchPoint checks it. A rollback leaves a tombstone row.
Erasure with a chain——not providedCrypto-shred erasure keeps every event-log row hash verifying. Call-ledger rows are sealed per subject by default wherever a key store is configured; shredding the subject's key keeps every call-row row hash verifying and makes the sealed fields unreadable. User ids and the row's wrapper columns aren't erased, and the quickstart's default store has no key store, so its rows stay plaintext unless you pass subjectKeys.
Human-in-the-looptool approvals——N
Checkpoints and crash resume——RunState double resume unguardedN
Family lock—a side module beside the runner—A session stays in one model family. When a model fails, the cascade retries within that family and never silently widens, including for models outside the routing matrix. The old cross-family fallback is opt-in.
OTel threading——tracing isn't OTelparent-threaded spans
Memory, MCP, skills, compactionmemory, MCP and compaction——N

What gets hard on the Agents SDK together

  • The runner owns the retries. The runner disables the client's own retries (maxRetries = 0) and retries itself, so a wrapper around the model sees one call per run step. Wrap modelSettings.retry to see each attempt.
  • Some paths skip your wrapper. Compaction, the WebSocket transport and abort-reconcile don't go through a model wrapper, so a row written there misses those calls.
  • Hosted tools are invisible. Tools that run on OpenAI's side never pass through your process, so nothing local can write their row.
  • Traces leave by default. Tracing exports to OpenAI unless you turn it off, and a trace processor can't fail the run when your own write fails.
  • Resume isn't guarded. Resuming the same RunState twice runs the step twice; nothing stops the second resume.

Stay on the Agents SDK alone if

  • You want OpenAI's hosted tools, tracing dashboard and runner, and nobody downstream asks for the call trail in your own database.
  • One tenant, no per-turn cost rollup, no audit obligation. The runner and its traces are enough for that shape; the comparison page covers when a host alone is the right call.

Reach for Pleach when the row per attempt, the chained record and the per-tenant rollup have to hold together. Pleach is not on npm yet.

Where to go next