Skip to main content

crewai-paysafe

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

pip install crewai-paysafe

Two additions

from crewai import Agent
from paysafe_x402 import PaySafeClient
from crewai_paysafe import paysafe_tools, register_paysafe_provenance

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

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

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

PaySafe'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_paysafe_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. (PaySafe'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_paysafe import guarded_payment

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

For wallet-level enforcement (the signer itself refuses unscanned payments), see PaySafeEnforcer in the paysafe-x402 SDK.

The toolset

Tool When the agent is told to use it
paysafe_scan_payment ALWAYS, immediately before settling any x402 payment (or before paying a received 402 offer with direction="incoming")
paysafe_check_reputation Before dealing with an unfamiliar counterparty address
paysafe_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. PaySafe 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_paysafe-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

crewai_paysafe-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: crewai_paysafe-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for crewai_paysafe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b8698dfaf0864cb3c7d1da48dbcd3d385feec9ab15e83aa72d5b8b5d363b9563
MD5 a67d4fea94e9684099222973a3cee653
BLAKE2b-256 af08c19bdb37afb54501e72335bbfa2cdf002e499675cdfb0a49b9c0af5f7e92

See more details on using hashes here.

Provenance

The following attestation bundles were made for crewai_paysafe-0.1.0.tar.gz:

Publisher: publish-pypi.yml on corbinallison/paysafe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: crewai_paysafe-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for crewai_paysafe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13ab6f630fa7973692c61b472668b5581acda5a0b5727a4ac94090777165a03e
MD5 90dedfbf147464c6ccff87413beee2ff
BLAKE2b-256 c91882db35aed0ddcf2022a7e7ff9dba44ae00e181fa879d1d7eaaa7877efcf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for crewai_paysafe-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on corbinallison/paysafe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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