Paybond ships runnable TypeScript examples under examples/ in the repository. Use them as reference implementations when you want a complete application structure beyond the TypeScript quickstart.
Each example uses a repo-local file:../../kit/ts dependency so SDK and example changes can be tested together. External apps should install the published package with npm install @paybond/kit instead.
Example catalog
| Example | Path | What it demonstrates |
|---|---|---|
| Core Kit session | examples/paybond-kit-typescript/ | Paybond.open and verifyCapability against a hosted session |
| Runtime-neutral adapter | examples/paybond-kit-runtime-agent-typescript/ | Intent create → capability verify → guarded tool execute → evidence |
| Agent-agnostic middleware | examples/paybond-kit-agent-middleware-typescript/ | createPaybondGenericAgentConfig with registry, bind, and auto-evidence |
| LangGraph | examples/paybond-kit-langgraph-typescript/ | paybondToolNode / paybondAwrapToolCall on the ToolNode boundary |
| Vercel AI SDK | examples/paybond-kit-vercel-ai-typescript/ | paybondVercelToolApproval and paybondVercelWrapTools with mock model |
| OpenAI Agents SDK | examples/paybond-kit-openai-agents-typescript/ | Input guardrails and wrapped invoke on function tools |
| Claude Agent SDK | examples/paybond-kit-claude-agents-typescript/ | createPaybondClaudeAgentsConfig for in-process MCP tools |
| Mastra | Smoke via CLI and templates/paybond-mastra-travel-agent/ | createPaybondMastraConfig on createTool execute — use paybond agent demo mastra smoke |
| Cloudflare Agents | Smoke via CLI | createPaybondCloudflareAgentsConfig on AI SDK tool() execute — use paybond agent demo cloudflare-agents smoke |
Choose an example
New to Paybond Kit? Start with paybond-kit-typescript for the minimal session shape, then read paybond-kit-runtime-agent-typescript for the full intent lifecycle.
Adding spend controls to an agent? Pick the row that matches your runtime:
- No agent framework (custom orchestrator, direct tool-use API) → Agent-agnostic adapter and
paybond-kit-agent-middleware-typescript - LangGraph → LangGraph adapter and
paybond-kit-langgraph-typescript - Vercel AI SDK → Vercel AI adapter and
paybond-kit-vercel-ai-typescript - OpenAI Agents SDK → OpenAI Agents adapter and
paybond-kit-openai-agents-typescript(Python:paybond-kit[openai-agents]andpaybond agent demo openai-agents smoke --runtime python) - Claude Agent SDK → Claude Agents adapter and
paybond-kit-claude-agents-typescript - Mastra → Mastra adapter and
paybond agent demo mastra smoke(Python: use agent-agnostic) - Cloudflare Agents → Cloudflare Agents adapter and
paybond agent demo cloudflare-agents smoke(Python: use agent-agnostic)
CLI smoke commands
Most middleware examples have a matching CLI smoke check that runs without a live LLM:
paybond login # optional for sandbox; required for real API # Agent-agnostic paybond agent demo generic smoke \ --operation paid-tool \ --requested-spend-cents 100 \ --evidence-preset cost_and_completion \ --format json # LangGraph paybond agent demo langgraph smoke \ --operation paid-tool \ --requested-spend-cents 100 \ --evidence-preset cost_and_completion \ --format json # Vercel AI paybond agent demo vercel-ai smoke \ --operation paid-tool \ --requested-spend-cents 100 \ --evidence-preset cost_and_completion \ --format json # OpenAI Agents paybond agent demo openai-agents smoke \ --operation paid-tool \ --requested-spend-cents 100 \ --evidence-preset cost_and_completion \ --format json # Claude Agents paybond agent demo claude-agents smoke \ --operation paid-tool \ --requested-spend-cents 100 \ --evidence-preset cost_and_completion \ --format json # Mastra (requires @mastra/core) npm install @paybond/mastra @mastra/core paybond agent demo mastra smoke \ --operation paid-tool \ --requested-spend-cents 100 \ --evidence-preset cost_and_completion \ --format json # Cloudflare Agents (requires agents and ai peers) npm install @paybond/cloudflare-agents agents ai paybond agent demo cloudflare-agents smoke \ --operation paid-tool \ --requested-spend-cents 100 \ --evidence-preset cost_and_completion \ --format json
For the fastest local path without an API key, use paybond dev loop --offline — see Agent quickstart.
Cloneable starter templates
For greenfield apps, use standalone templates under templates/ (published @paybond/kit only) or scaffold locally:
paybond init --template travel-agent paybond init --template vercel-shopping-agent --force paybond init --template mastra-travel-agent --framework mastra
Each template includes paybond.policy.yaml, .env.example, npm run smoke, and a GitHub Actions workflow. See the templates README for the full catalog.
Running from a source checkout
Each example directory includes a README with setup steps. The usual pattern:
cd examples/<example-name> npm install npm run build --prefix ../../kit/ts # first time or after SDK changes npm run build npm start
Middleware examples typically need PAYBOND_API_KEY from paybond login or PAYBOND_API_KEY=pb_test_sandbox with a mock Gateway. The runtime-neutral example additionally documents APP_* env vars for intent create and evidence signing — see its README.
What these examples are for
- Understanding the public SDK in a complete end-to-end flow.
- Seeing how capability verification wraps side-effecting tools before execution.
- Copying proven patterns for registry bind, auto-evidence, and session cleanup.
- Validating a framework adapter in CI with the matching
paybond agent demo … smokecommand.
For most teams, follow the TypeScript quickstart or Agent quickstart first, then open the example that matches your stack.