Agent SDK quickstart
Three steps from a fresh project to a covered call. Assumes you’re on mainnet; for devnet or localnet, read the B1 callout first.
1. Install
Section titled “1. Install”npm install @q3labs/pact-sdk2. Create the client
Section titled “2. Create the client”import { createPact } from "@q3labs/pact-sdk";import { Keypair } from "@solana/web3.js";
const pact = await createPact({ network: "mainnet", signer: Keypair.fromSecretKey(/* your 64-byte ed25519 secret */),});The SDK ships a default for every host, proxy, indexer, and program ID. On mainnet you shouldn’t have to touch any of them to try it.
3. Call (drop-in fetch)
Section titled “3. Call (drop-in fetch)”const res = await pact.fetch("https://api.helius.xyz/v0/addresses/…");That’s the whole thing on mainnet.
One-time: enable on-chain coverage
Section titled “One-time: enable on-chain coverage”Once per agent, sign one SPL approve to the SettlementAuthority
delegate. After this, covered breaches refund automatically via
settle_batch — no claim form, no
dispute.
await pact.setup({ allowanceUsdc: 5 });If you skip this, pact.fetch() still works — calls just won’t be
covered until the approve lands.
Supported runtimes
Section titled “Supported runtimes”- Node ≥ 18 — relies on the built-in
fetch,TextEncoder, andWebCryptoglobals. - Browser — works under any ESM bundler (Vite, Webpack 5, esbuild, Rollup).
- ESM-only — there is no CJS export. If your toolchain still requires CJS, file an issue.
- Environment & E2E — the env-var convention for piping config through the CLI, dashboard, and your own deploys.
- Classifier & refund policy — what counts as a covered breach.