Skip to content

Agent SDK overview

@q3labs/pact-sdk is the agent-side SDK for Pact Network. It’s a drop-in fetch() that routes calls through the Pact Market proxy and gets you on-chain refunds via settle_batch when a call goes sideways. One import, one call, no claim form.

If you only want to record reliability data and never want refunds — keep using the older pact-monitor-sdk. That’s a different product; see Monitor SDK → Overview. They live side by side on purpose. This page is about the new one.

Terminal window
npm install @q3labs/pact-sdk

The package is ESM-only. Node ≥ 18, or a browser bundled by Vite, Webpack 5, esbuild, or Rollup. There is no CJS build.

  • A pact.fetch() that matches the fetch() signature. Drop it in where you’d use fetch() today.
  • On-chain refunds for the calls the classifier labels as covered breaches — 5xx, timeouts, truncated or malformed bodies.
  • One SPL approve to the SettlementAuthority delegate, once per agent, and you’re covered up to the allowance you set.
  • Defaults for every host, proxy, indexer, and program ID on mainnet. You shouldn’t have to configure anything to try it.
  • It isn’t a payment SDK. The agent still pays the provider through x402 or MPP (via the CLI, pay.sh, or your own client). Pact sits underneath the payment and refunds principal + premium on a covered breach.
  • It isn’t a monitor-only library. If you want recording without on-chain settlement, that’s the Monitor SDK.
  • Building an agent in TypeScript → this SDK. One import, native fetch() semantics.
  • Shell scripts, demos, one-offs → the CLI (pact pay curl ...). Same wire format, same refunds.