Skip to main content

crewai-tollwarden

TollWarden payment security for CrewAI agents — crews inherit "scan before you pay" by default.

pip install crewai-tollwarden

Two additions

from crewai import Agent
from tollwarden import TollWardenClient
from crewai_tollwarden import tollwarden_tools, register_tollwarden_provenance

tollwarden = TollWardenClient(agent_id="my-agent")   # free API key auto-minted (100 free scans)
register_tollwarden_provenance(tollwarden)           # ← the important line (call once at startup)

agent = Agent(
    role="Purchasing agent",
    goal="Buy data over x402 safely",
    tools=tollwarden_tools(tollwarden),
    # ...
)

Every x402 payment the agent scans gets an allow / flag / block verdict with machine-readable reasons: prompt-injection-triggered payments, replayed nonces, overpayment vs the quote, secrets/PII leaking in payment metadata, lookalike-token contracts, address poisoning, counterparty reputation.

Why the provenance registration is the important line

TollWarden's strongest detector catches payments whose decision came from content the agent just read — a prompt-injected page or tool result that says "send payment to 0x…". That check needs to know what the agent read. register_tollwarden_provenance installs a CrewAI after-tool-call hook that observes every tool output automatically, so the very next scan is provenance-tagged and the injection check runs with real input. No prompt engineering, no developer learning what "provenance" means. (TollWarden's own tool outputs are excluded, so verdicts never pollute the signal.) CrewAI's tool-call hooks are process-global — call it once at startup.

Enforcement: payments that can't execute when blocked

Tools rely on the model choosing to scan. guarded_payment doesn't:

from crewai.tools import BaseTool
from crewai_tollwarden import guarded_payment

safe_pay = guarded_payment(execute_x402_payment, tollwarden)   # strict=True to refuse flags too
# build your payment tool's _run from safe_pay — on a block verdict it raises
# TollWardenBlockedError BEFORE execute_x402_payment is ever invoked.

For wallet-level enforcement (the signer itself refuses unscanned payments), see TollWardenEnforcer in the tollwarden SDK.

The toolset

Tool When the agent is told to use it
tollwarden_scan_payment ALWAYS, immediately before settling any x402 payment (or before paying a received 402 offer with direction="incoming")
tollwarden_check_reputation Before dealing with an unfamiliar counterparty address
tollwarden_report_counterparty After a bad payment experience (always free) — warns other agents

Verdicts are Ed25519-signed and payment-bound; the underlying client verifies them against a pinned key automatically.

MIT. TollWarden is advisory and non-custodial: it never touches keys, wallets, or funds.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crewai_tollwarden-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crewai_tollwarden-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file crewai_tollwarden-0.1.0.tar.gz.

File metadata

  • Download URL: crewai_tollwarden-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for crewai_tollwarden-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d2e1f68426281e3bbdf8c28e078e9b7c76a0bc73e65c876e68b42bc48c2fb2bf
MD5 f3273f4384a80a0e2af0830282644209
BLAKE2b-256 04a8e87fe822a8ca738a73f6af4de089f37265b7f91961a30982bf6712afcead

See more details on using hashes here.

File details

Details for the file crewai_tollwarden-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: crewai_tollwarden-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for crewai_tollwarden-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f7f2a2d4f78ecd896e33f9d64b03afb37c2859323b7bc643f5588560cb4e7f2
MD5 ddcf96777664af75a01765f06516f78a
BLAKE2b-256 321aeae85ae6cc7884610e312b0aaf1b01d020f84697bf40667e0b6a04e1e1f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page