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
| Package | Runs on | For |
|---|---|---|
@provenanceauth/ | Node 18 and later, and browsers | The full API, plus offline verifiers and webhook signature checks |
provenanceauth-sdk | Python 3.10 and later | The main API resources, plus the same verifiers |
provenanceauth-verify | Python 3.10 and later | Offline token checks only |
go. | Go 1.26 and later | Offline 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.tgzgit clone https://github.com/michaelnbane-jpg/provenance.git provenance
pip install ./provenance/python/sdk ./provenance/python/verifyTools
| Package | Runs on | For |
|---|---|---|
@provenanceauth/ | Node 20 and later | The CLI: forward sandbox events to a local URL and resend webhook deliveries |
@provenanceauth/ | Any MCP client | The agent tools over stdio (agent tools) |
@provenanceauth/ | Node 18 and later | Connect 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.tgzAgent frameworks
| Package | Runs on | For |
|---|---|---|
@provenanceauth/ | Node 18 and later | Gating agent tools in your own loop or on an MCP server |
@provenanceauth/ | Node, with ai 5, 6 or 7 (>=5 <8) | Gating Vercel AI SDK tools |
@provenanceauth/ | Node, with @langchain/ 0.3 or 1.x (>=0.) | Gating LangChain tools |
provenanceauth-langchain | Python 3.10 and later, with langchain-core 0.3 or 1.x (>=0.) | Gating LangChain tools |
@provenanceauth/ | Node 18 and later, with @anthropic-ai/ (>=0.) | Gating Claude Agent SDK tools |
provenanceauth-claude-agent-sdk | Python 3.10 and later | Gating Claude Agent SDK tools |
@provenanceauth/ | Node 18 and later, with @openai/ (>=0.) | Gating OpenAI Agents SDK tools |
provenanceauth-openai-agents | Python 3.10 and later | Gating OpenAI Agents SDK tools |
provenanceauth-google-adk | Python 3.10 and later | Gating Google ADK tools |
provenanceauth-crewai | Python 3.10 and later | Gating CrewAI tools |
Each framework guide has its install line.
Stores, sites and claims systems
| Package | Runs on | For |
|---|---|---|
@provenanceauth/ | Node | Verify agent orders where agents pay: checkout, ACP, x402 and AP2 bindings, deals, tabs, grants and disputes (agent payments) |
@provenanceauth/ | Node 18 and later, Cloudflare Workers, Vercel Edge | Identify middleware: name signed agents and likely bots, and apply your traffic policy in-process |
provenanceauth-identify | Python 3.10 and later | The same middleware for FastAPI, Starlette and Django |
@provenanceauth/ | Node | Claim-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.tgzgit clone https://github.com/michaelnbane-jpg/provenance.git provenance
pip install ./provenance/python/sdk ./provenance/python/identifyApps on a phone
| Package | Runs on | For |
|---|---|---|
@provenanceauth/ | React Native 0.74 and later, Expo 51 and later | Capture on a phone: photos signed in the phone's secure hardware |
ProvenanceTextConsent | iOS 16 and later, Swift Package Manager | The consent step and box in your own iOS app |
com. | Android | The 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:
| Reference | Covers |
|---|---|
| Node SDK | @provenanceauth/, by namespace |
| Python SDK | provenanceauth-sdk, by namespace |
| Rails | @provenanceauth/ and its subpaths: checkout, ACP, x402, AP2, deals, tabs, mandates, disputes, discovery |
| Verifiers | The offline verifiers for TypeScript, Python and Go |
How it works
- Create a client with your key and the API's base URL.
- Call a resource method. Node takes and returns camelCase; Python takes and returns the API's snake_case.
- Errors become exceptions.
429and5xxresponses are retried up to three times with exponential backoff, honoringRetry-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"
import { NotFoundError, Provenance } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
try {
await prov.attest.claims.getProvenance("CLM-DOES-NOT-EXIST");
} catch (err) {
if (err instanceof NotFoundError) console.log(err.code, err.param, err.requestId);
else throw err;
}
import os
from provenanceauth import Provenance
from provenanceauth.errors import NotFoundError
prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
try:
prov.attest.claims.get_provenance("CLM-DOES-NOT-EXIST")
except NotFoundError as err:
print(err.code, err.param, err.request_id)
{
"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:
type | Exception |
|---|---|
authentication_ | AuthenticationError |
permission_ | PermissionError |
invalid_ | InvalidRequestError, or NotFoundError for resource_ |
rate_ | RateLimitError, after the retries run out |
billing_ | BillingError, with billing on trial_, spend_ and seat_ |
api_, unavailable_ | ApiError, 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
429and5xx. 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);
from provenanceauth_verify import fetch_jwks, verify_intent_token
jwks = fetch_jwks(os.environ["PROVENANCE_API"])
result = verify_intent_token(token, jwks)
import pv "go.provenanceauth.com/verify"
jwks, err := pv.FetchJWKS(os.Getenv("PROVENANCE_API"))
result := pv.VerifyIntentToken(token, jwks, 0)
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.