Paybond integrates with CrewAI at the tool execution boundary — spend verify runs before side-effecting @tool / BaseTool handlers execute, then auto-evidence fires after success. Model inference stays on your LLM provider; Paybond guards paid and side-effecting tool calls only.
Python only — CrewAI is a Python framework. TypeScript Kit does not ship a CrewAI adapter; use agent-agnostic or MCP for other hosts.
Install
Install
npm install @paybond/kitImport from @paybond/kit/agent
// CrewAI is Python-only — use paybond-kit[crewai] in Python projects.- Python only. TypeScript Kit does not ship a CrewAI adapter — use agent-agnostic middleware or MCP for other hosts.
- Python: `paybond agent demo crewai smoke` requires the optional `crewai` extra. Use `pip install "paybond-kit[crewai]"`, `pipx install 'paybond-kit[crewai]'`, or `pipx inject paybond-kit crewai` (when base paybond-kit is already installed).
- Smoke: `paybond agent demo crewai smoke --operation procurement.submit_po --requested-spend-cents 12000 --evidence-preset cost_and_completion --format json`.
Recommended wiring
One-liner (sandbox): paybond.instrument({ policy, framework: "crewai", tools }) or paybond.agent({ policy, framework: "crewai", tools }) returns guarded CrewAI tools. Production: omit sandbox and call instrumented.bind() per session.
from crewai.tools import tool from paybond_kit import Paybond paybond = await Paybond.open(api_key=os.environ["PAYBOND_API_KEY"]) result = await paybond.instrument( policy="./paybond.policy.yaml", framework="crewai", tools=[submit_po_tool, search_catalog_tool], ) guarded_tools = result.tools # Register guarded_tools on your CrewAI agents and tasks.
Already bound a run? Use create_paybond_crewai_config(run, tools) — returns { tools, wrap_tool } for incremental wiring.
See Agent middleware for run binding, registry rules, and tenant isolation.
Advanced / manual wiring
When you need step-by-step control over registry and bind:
- Bind a
PaybondAgentRunwith a tool registry (sandbox bootstrap or production attach). - Register side-effecting tools on the registry so spend resolvers read tool args (for example
amount_centsfrom tool kwargs). - Wrap CrewAI tools with
create_paybond_crewai_configbefore registering them on crew agents.
from crewai.tools import tool from paybond_kit.crewai import create_paybond_crewai_config @tool("procurement.submit_po") def submit_po(vendor_id: str, amount_cents: int) -> str: """Submit a purchase order.""" ... config = create_paybond_crewai_config(run, [submit_po]) guarded_tools = config.tools
Non-side-effecting tools (per registry) pass through unchanged.
Scaffold and smoke
paybond init agent-middleware --framework crewai --out paybond_crewai.py paybond policy init --preset saas --out paybond.policy.yaml
Validate authorization and evidence without a live CrewAI crew or LLM:
paybond login paybond agent demo crewai smoke \ --operation procurement.submit_po \ --requested-spend-cents 12000 \ --evidence-preset cost_and_completion \ --format json
Requires the optional extra: pip install "paybond-kit[crewai]". With pipx: pipx install 'paybond-kit[crewai]' or pipx inject paybond-kit crewai.
Vertical template:
paybond init --template crewai-procurement-agent --framework crewai
Or clone the public starter:
git clone https://github.com/nonameuserd/paybond-crewai-procurement-agent.git
Approval holds
When Paybond returns an approval hold, surface it to operators, approve in the tenant console, then retry with the same operation, amount, metadata, and approvalToken. Hard denials must not execute the tool. Guarded CrewAI tools return a descriptive error string instead of performing the side effect.
Related
- Agent middleware — run binding, registry, auto-evidence
- Agent-agnostic adapter — fallback for custom orchestrators
- Support matrix — shipped framework surfaces
- CrewAI spend controls guide — task-oriented wiring walkthrough