View as Markdown

Get started · Concept

SDKs and tools

The SDKs are typed clients for the Provenance API, for Node and Python, that add the key, retry rate-limited and failed requests, and turn error responses into typed exceptions. Around them sit smaller packages for one job each: verifiers that check a token offline with no API key, the CLI, the MCP server, packages that gate agent framework tools, payment rails, Identify middleware and native libraries for capture and consent.

When to use it

  • Call Provenance from your backend with less code than raw HTTP.
  • Check intent tokens, receipts or webhook signatures in your own service.
  • Give an agent Provenance as tools, with Provenance MCP, or gate the tools of the framework you already use.

Packages

Every package shares one version number.

API clients and verifiers

PackageRuns onFor
@provenanceauth/sdkNode 18 and later, and browsersThe full API, plus offline verifiers and webhook signature checks
provenanceauth-sdkPython 3.10 and laterThe main API resources, plus the same verifiers
provenanceauth-verifyPython 3.10 and laterOffline token checks only
go.provenanceauth.com/verifyGo 1.26 and laterOffline token checks only; not published yet, its source is in the Provenance repository

This package isn't on npm yet. These packages aren't on PyPI yet. Until then, every request in these docs runs over HTTP against the sandbox.

With access to the private Provenance repository, which your Provenance contact grants, install from it:

git clone https://github.com/michaelnbane-jpg/provenance.git provenance
cd provenance && pnpm install && pnpm build
node scripts/check-publishable.mjs --out ../provenance-packs
cd ../your-project
npm install ../provenance-packs/provenanceauth-sdk-1.0.0.tgz
git clone https://github.com/michaelnbane-jpg/provenance.git provenance
pip install ./provenance/python/sdk ./provenance/python/verify

Tools

PackageRuns onFor
@provenanceauth/cliNode 20 and laterThe CLI: forward sandbox events to a local URL and resend webhook deliveries
@provenanceauth/mcp-serverAny MCP clientThe agent tools over stdio (agent tools)
@provenanceauth/connectNode 18 and laterConnect an AI assistant to Provenance in one step: writes its MCP config, and for Claude Code adds a hook that asks before risky tool calls (connect your assistant)

These packages aren't on npm yet. Until then, every request in these docs runs over HTTP against the sandbox.

With access to the private Provenance repository, which your Provenance contact grants, install from it:

git clone https://github.com/michaelnbane-jpg/provenance.git provenance
cd provenance && pnpm install && pnpm build
node scripts/check-publishable.mjs --out ../provenance-packs
cd ../your-project
npm install ../provenance-packs/provenanceauth-cli-1.0.0.tgz ../provenance-packs/provenanceauth-sdk-1.0.0.tgz ../provenance-packs/provenanceauth-rails-1.0.0.tgz ../provenance-packs/provenanceauth-mcp-server-1.0.0.tgz

Agent frameworks

PackageRuns onFor
@provenanceauth/agent-adaptersNode 18 and laterGating agent tools in your own loop or on an MCP server
@provenanceauth/ai-sdkNode, with ai 5, 6 or 7 (>=5 <8)Gating Vercel AI SDK tools
@provenanceauth/langchainNode, with @langchain/core 0.3 or 1.x (>=0.3 <2)Gating LangChain tools
provenanceauth-langchainPython 3.10 and later, with langchain-core 0.3 or 1.x (>=0.3,<2)Gating LangChain tools
@provenanceauth/claude-agent-sdkNode 18 and later, with @anthropic-ai/claude-agent-sdk (>=0.2 <0.4)Gating Claude Agent SDK tools
provenanceauth-claude-agent-sdkPython 3.10 and laterGating Claude Agent SDK tools
@provenanceauth/openai-agentsNode 18 and later, with @openai/agents (>=0.8 <1)Gating OpenAI Agents SDK tools
provenanceauth-openai-agentsPython 3.10 and laterGating OpenAI Agents SDK tools
provenanceauth-google-adkPython 3.10 and laterGating Google ADK tools
provenanceauth-crewaiPython 3.10 and laterGating CrewAI tools

Each framework guide has its install line.

Stores, sites and claims systems

PackageRuns onFor
@provenanceauth/railsNodeVerify agent orders where agents pay: checkout, ACP, x402 and AP2 bindings, deals, tabs, grants and disputes (agent payments)
@provenanceauth/identifyNode 18 and later, Cloudflare Workers, Vercel EdgeIdentify middleware: name signed agents and likely bots, and apply your traffic policy in-process
provenanceauth-identifyPython 3.10 and laterThe same middleware for FastAPI, Starlette and Django
@provenanceauth/connectorsNodeClaim-system connectors for Guidewire ClaimCenter and Duck Creek Claims

These packages aren't on npm yet. This package isn't on PyPI yet. Until then, every request in these docs runs over HTTP against the sandbox.

With access to the private Provenance repository, which your Provenance contact grants, install from it:

git clone https://github.com/michaelnbane-jpg/provenance.git provenance
cd provenance && pnpm install && pnpm build
node scripts/check-publishable.mjs --out ../provenance-packs
cd ../your-project
npm install ../provenance-packs/provenanceauth-sdk-1.0.0.tgz ../provenance-packs/provenanceauth-rails-1.0.0.tgz ../provenance-packs/provenanceauth-identify-1.0.0.tgz ../provenance-packs/provenanceauth-connectors-1.0.0.tgz
git clone https://github.com/michaelnbane-jpg/provenance.git provenance
pip install ./provenance/python/sdk ./provenance/python/identify

Apps on a phone

PackageRuns onFor
@provenanceauth/react-nativeReact Native 0.74 and later, Expo 51 and laterCapture on a phone: photos signed in the phone's secure hardware
ProvenanceTextConsentiOS 16 and later, Swift Package ManagerThe consent step and box in your own iOS app
com.provenanceauth:text-consentAndroidThe consent step and box in your own Android app

Each of these guides has its install line.

Reference

Every method, generated from the SDK sources, with its signature, the HTTP operation it calls, the errors it can return and an example:

ReferenceCovers
Node SDK@provenanceauth/sdk, by namespace
Python SDKprovenanceauth-sdk, by namespace
Rails@provenanceauth/rails and its subpaths: checkout, ACP, x402, AP2, deals, tabs, mandates, disputes, discovery
VerifiersThe offline verifiers for TypeScript, Python and Go

How it works

  1. Create a client with your key and the API's base URL.
  2. Call a resource method. Node takes and returns camelCase; Python takes and returns the API's snake_case.
  3. Errors become exceptions. 429 and 5xx responses are retried up to three times with exponential backoff, honoring Retry-After. Any other error raises a typed exception at once.

Make a call and handle an error

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_full_K7mN3xQp9RbT2vWm8sYd4cFjLhXn6gAe

curl $PROVENANCE_API/v1/attest/claims/CLM-DOES-NOT-EXIST/provenance \
  -H "Authorization: Bearer $PROVENANCE_KEY"
{
  "error": {
    "type": "invalid_request_error",
    "code": "resource_missing",
    "message": "No such claim: 'CLM-DOES-NOT-EXIST'",
    "param": "claim_id"
  }
}

Each error type has its own exception class:

typeException
authentication_errorAuthenticationError
permission_errorPermissionError
invalid_request_errorInvalidRequestError, or NotFoundError for resource_missing
rate_limit_errorRateLimitError, after the retries run out
billing_errorBillingError, with billing on trial_ended, spend_cap_reached and seat_limit_reached
api_error, unavailable_errorApiError, UnavailableError

Every exception carries the fields of the error body, such as code and request_id. A request that never reached the API raises ConnectionError.

The client takes these options:

apiKey / api_keystring
Your key. Required.
baseUrl / base_urlstring
The API's base URL. Always set it; these docs use PROVENANCE_API.
maxRetries / max_retriesinteger
Retries for 429 and 5xx. Default 3; 0 turns retries off.
retryBaseMs / retry_base_msinteger
The first backoff, in milliseconds, doubled on each retry. Default 250.

The Python SDK covers the main resources. For endpoints it doesn't wrap yet, such as cases, agents and agreements, the guides call the API with httpx.

Verify without an API key

The verifier functions check a token's signature and expiry against the published keys. They're in both SDKs, and in the verifier-only libraries for Python and Go:

import { fetchJwks, verifyIntentTokenOffline } from "@provenanceauth/sdk";

const jwks = await fetchJwks(process.env.PROVENANCE_API!);
const result = await verifyIntentTokenOffline(token, jwks);

An offline check can't see revocations or check the payload; see verify tokens offline for what to add. Both SDKs also check webhook signatures, with verifyWebhookSignature and verify_webhook_signature; see webhooks.

Every library is tested against the same committed test vectors for token signatures and canonical JSON, so a payload hashes the same in every language. To port the format to another language, pass those vectors.