Skip to main content

fizzl

Safety checks for Python AI agents that pay: LangChain, LangGraph, the OpenAI Agents SDK, Pydantic AI, CrewAI or your own loop.

An official LangChain integration: listed in the LangChain docs among the security tools.

For LangChain.js and LangGraph.js: fizzl-langchain on npm.

Check What the agent checks Service Price
check_before_signing a transaction, token approval or signature before signing it: green / orange / red with reason codes (drainers, unlimited approvals to unknown spenders, look-alike tokens, Permit/Permit2/Seaport signatures that hand over tokens). With from_address (the agent's wallet) a transaction is simulated, so a hidden approval, an NFT leaving or a transaction that would fail shows up; with intent (one sentence) signing something else than meant is caught; with x402 (the accepts entry being paid) a payment that pays more or someone else is red presign-guard $0.01
check_xrpl_transaction an XRP Ledger transaction before signing it: account takeover (SetRegularKey, SignerListSet, master key off), AccountDelete, fake RLUSD (red); partial payments, destinations that refuse or need a tag, risky issuers, DEX orders far below the market (orange) presign-guard $0.01
check_solana_transaction a Solana transaction before signing it: every instruction is read and the transaction simulated. Token account takeover (SetAuthority), System Assign (red); unlimited delegates, durable nonces, closing to someone else, hidden owner or delegate changes, a failing transaction (orange) presign-guard $0.01
check_message a plain message before personal_sign / eth_sign: eth_sign, a Sign-In with Ethereum message for another site (red); unreadable bytes, a sign-in for another URI, address or chain (orange) presign-guard $0.01
check_algorand_transaction an Algorand transaction or atomic group before signing it: every transaction your account sends is read and the group simulated. Rekey to another key, closing the account or an asset holding to someone else, fake USDC (red); clawbacks, risky opt-ins, app update/delete/clear-state, a partial group, a group that would fail (orange) presign-guard $0.01
check_stellar_transaction a Stellar transaction before signing it, also an x402 payment (a Soroban authorization the facilitator sends): every operation and authorized call is read and the call simulated. Account merge, an added signer, master key off, fake USDC/EURC, a payment to a look-alike address (red); token approvals, also hidden in a sub-call, a missing required memo (orange) presign-guard $0.01
check_token a token before buying or accepting it: honeypot, rug-pull signs, look-alikes (Solana, EVM, XRPL tokens as CURRENCY.rIssuer, and Algorand assets by id) presign-guard $0.01
check_wallet_approvals every open approval of a wallet and which to revoke presign-guard $0.02
screen_wallet a wallet address before paying it or accepting money from it: any chain's address (EVM, Solana, Tron, Bitcoin, XRPL, Algorand) against the OFAC SDN sanctions list, synced from the US Treasury, plus theft and phishing reports for EVM (red names the SDN entry) presign-guard $0.01
check_endpoint_before_paying an x402 or MPP paid API before paying it: go / caution / no_go, the cheapest option that settles, budget, track record, bait signs (fake brands, airdrop lures, output that doesn't match) x402 Doctor $0.001

The checks only check. They never sign, pay or move anything themselves. A failed check comes back as {"error": ..., "message": ...} instead of raising, so the agent can tell its user.

One more, which buys, so the tool sets only include it when you ask (buy=True, or in only):

Method What the agent gets Service Price
buy_live_data live data it can't get itself (a weather forecast, a crypto or stock price, an exchange rate, web search results, news, a company or address lookup) in one call: say what you need; Fizzl Buy picks the paid x402 API x402 Doctor has seen paying out day after day at a fair price, pays it and returns the answer, checked for hidden instructions. Nothing is charged when no seller delivers Fizzl Buy $0.02
fizzl.buy_live_data("weather forecast for Amsterdam tomorrow")
# {'delivered': True, 'answer': {...}, 'service': {'url': ..., 'track_record': ...}, 'paid_usd': 0.005, 'answer_check': {...}}

Without a paying session it answers with a free preview: the seller Fizzl Buy would buy from, not the data itself.

Let the agent pay any x402 API, with code deciding (pay_api)

pay_api calls any x402 API and returns its answer. The model only says what to call; code decides whether it is paid. You give it a session from fizzl.pay.safe_session:

from x402 import x402ClientSync
from fizzl import Fizzl
from fizzl.pay import safe_session

payer = x402ClientSync()                      # register an EVM scheme with a wallet just for the agent
pay = safe_session(payer, max_usd=0.05)       # per payment; the model can't raise it
fizzl = Fizzl(session=pay, pay_session=pay)
fizzl.pay_api("https://api.example.com/weather?city=Amsterdam")
# {'status': 200, 'ok': True, 'paid': True, 'data': {...}, 'untrusted': '...'}
  • Budget: the x402 client's own spend controls cap every payment at max_usd, in known dollar tokens only.
  • Checked first: x402 Doctor's preflight runs before each payment ($0.001). Only a go is paid; a caution stops unless on_caution="pay" or your function says yes; a no_go never pays.
  • Never paid twice for nothing: a request that was paid and answered with an error is not paid again for 30 minutes.
  • A budget for the whole task (optional): safe_session(payer, max_usd=0.05, max_total_usd=0.10, max_per_seller_usd=0.10). A seller that splits its answer over many cheap calls (2 cents a page, "call again for the next page") stays under max_usd every time; max_total_usd caps every payment of the session together, max_per_seller_usd every payment to one host. Past it nothing is paid and no preflight is bought; pay.spent() says what was paid. Make one session per task or user.
  • A refusal comes back as {"not_paid": "no_go" | "caution" | "over_budget" | "over_total_budget" | "over_seller_budget" | "paid_no_delivery" | ..., "message": ...}, so the agent can tell the user.

pay_api only works with a session from safe_session. A plain paying session is refused, because then the model would decide what to pay. Why that matters: in our wallet exam the same model scored 65 on its own and 96 when code decided the payment (the sittings). Install with pip install "fizzl[x402]".

Install

pip install "fizzl[x402]"              # with the x402 client, to pay per check
pip install "fizzl[langchain,x402]"    # plus LangChain tools
pip install "fizzl[openai-agents]"     # OpenAI Agents SDK tools (Python 3.10+)
pip install "fizzl[pydantic-ai]"       # Pydantic AI tools (Python 3.10+)
pip install "fizzl[crewai]"            # CrewAI tools (Python 3.10–3.13)

Use

import requests
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import wrapRequestsWithPayment
from x402.mechanisms.evm.exact import ExactEvmScheme
from fizzl import Fizzl

payer = x402ClientSync().register("eip155:8453", ExactEvmScheme(Account.from_key(AGENT_KEY)))  # USDC on Base
session = wrapRequestsWithPayment(requests.Session(), payer)

fizzl = Fizzl(session=session)
fizzl.check_endpoint_before_paying("https://api.example.com/funding", max_usd=0.05)
# {'verdict': 'go', 'summary': 'OK to pay: $0.02 on Base.', 'options': [...], 'reasons': [], ...}
fizzl.check_token("base", "0x...")
fizzl.check_before_signing(type="approval", chainId=8453, token="0x...", spender="0x...", amount="115792089237316195423570985008687907853269984665640564039457584007913129639935")

Try it without a wallet: Fizzl() with no paying session and no credit keys falls back to the free quick checks for check_token, check_before_signing, check_solana_transaction, check_algorand_transaction, check_stellar_transaction, check_message and check_endpoint_before_paying: the verdict only, a few per hour, marked "free": True with a note on what the full check costs. check_wallet_approvals, screen_wallet and check_xrpl_transaction have no free version. Fizzl(free=False) returns payment_required instead.

Prepaid credits instead of a payment per check: buy a pack once (presign-guard: 100 checks for $0.80; x402 Doctor: 1000 preflights for $0.80), then use a plain session:

fizzl = Fizzl(credit_keys={"presign": PRESIGN_CREDIT_KEY, "doctor": DOCTOR_CREDIT_KEY})

Already pay with the x402 client? One line

If your agent pays with the official x402 Python client (x402ClientSync or x402Client), add x402 Doctor's preflight as a hook and every payment that client makes is checked first:

import requests
from x402 import x402ClientSync
from x402.http.clients import wrapRequestsWithPayment
from fizzl.hook import doctor_preflight

payer = x402ClientSync()                       # register your schemes as before
session = wrapRequestsWithPayment(requests.Session(), payer)
payer.on_before_payment_creation(doctor_preflight(session=session, max_usd=0.05))

Before the client signs, the hook asks x402 Doctor ($0.001, paid through the same session, or 1 prepaid credit with credit_key):

  • no_go: the payment is aborted (PaymentAbortedError); nothing is signed.
  • caution: aborted, unless on_caution="pay" or your function says yes.
  • go: it goes ahead. With on_incomplete="stop", a go whose checks_complete is false is aborted too.

The verdict is reused while the endpoint asks the same payTo, amount, token and network. Doctor's own 402 for the preflight is skipped by the hook and paid only up to $0.002. If Doctor can't be asked, the payment stops (on_error="pay" lets it through). Install with pip install "fizzl[x402]".

LangChain / LangGraph

from langgraph.prebuilt import create_react_agent
from fizzl.langchain import fizzl_tools

tools = fizzl_tools(session=session)          # or credit_keys={...}; only=[...] for some of them; buy=True adds buy_live_data
# tools = fizzl_tools(session=pay, pay_session=pay)   # adds pay_api (pay = safe_session(payer, max_usd=0.05), see above)
agent = create_react_agent(model, tools + your_tools,
    prompt="Before you pay any API, call check_endpoint_before_paying. Before you sign anything, call check_before_signing. Never continue on red or no_go.")

The tools are plain StructuredTools with typed arguments, so other frameworks that take LangChain tools can use them too.

OpenAI Agents SDK

from agents import Agent, Runner
from fizzl.openai_agents import fizzl_tools

agent = Agent(name="buyer", tools=fizzl_tools(session=session),   # or credit_keys={...}, or nothing for the free checks
    instructions="Before you pay any API, call check_endpoint_before_paying. Before you sign anything, call check_before_signing. Never continue on red or no_go.")
print(Runner.run_sync(agent, "Is https://api.example.com/funding safe to pay, at most $0.05?").final_output)

The checks run in a worker thread, so a blocking requests session doesn't stall the agent's event loop. Bad arguments from the model come back as {"error": "bad_input", ...} without calling (or paying for) the check.

Pydantic AI

from pydantic_ai import Agent
from fizzl.pydantic_ai import fizzl_tools

agent = Agent(model, tools=fizzl_tools(session=session),   # or credit_keys={...}, or nothing for the free checks
    instructions="Before you pay any API, call check_endpoint_before_paying. Before you sign anything, call check_before_signing. Never continue on red or no_go.")
print(agent.run_sync("Is https://api.example.com/funding safe to pay, at most $0.05?").output)

Each tool's schema is the check's typed arguments. Bad arguments from the model come back as {"error": "bad_input", ...} without calling (or paying for) the check.

CrewAI

from crewai import Agent, Crew, Task
from fizzl.crewai import fizzl_tools

buyer = Agent(role="Buyer", goal="Buy data from paid APIs without getting cheated", tools=fizzl_tools(session=session),
    backstory="Before you pay any API you call check_endpoint_before_paying, and you never pay on red or no_go.")
Crew(agents=[buyer], tasks=[Task(description="Is https://api.example.com/funding safe to pay, at most $0.05?",
     expected_output="go, caution or no_go, and why", agent=buyer)]).kickoff()

Native CrewAI BaseTools with the check's typed arguments as args_schema; CrewAI validates the model's arguments before the check runs, so a wrong argument never reaches (or pays for) it.

Want the wallet to enforce it, not just inform the model?

Tools inform the model; a model can still ignore them. To make red and over-budget payments impossible, guard the wallet itself: presign-guard-wallet (Node) checks every signature with presign-guard and your spending limits, with Telegram approval above them.

License

MIT

Metadata

Release files for fizzl 0.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fizzl 0.16.0
File Size Uploaded Provenance Actions
fizzl-0.16.0.tar.gz 32.8 kB With provenance Details for fizzl-0.16.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fizzl 0.16.0
File Interpreter ABI Platform Actions
fizzl-0.16.0-py3-none-any.whl Python 3 none any Details for fizzl-0.16.0-py3-none-any.whl

Total release size: 63.2 kB

Release files / fizzl-0.16.0.tar.gz

Download URL fizzl-0.16.0.tar.gz
Size 32.8 kB
Tags Source
SHA-256 checksum
How to use checksums
80079167901aea3e991a38169f50332cb130e3e1572a1087d45dc9534f9237ba
BLAKE2b-256 checksum
How to use checksums
b8562d0649f269e4c384db6d0ab5e1eaa91d88fef94da946357fc593870203ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fizzl-0.16.0-py3-none-any.whl

Download URL fizzl-0.16.0-py3-none-any.whl
Size 30.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e64827eb9cc5a22deaf783b2b0499ec8512ba857d109d5b6d72c2b79ec7ccd64
BLAKE2b-256 checksum
How to use checksums
17f42fe60f3ce365b986aaa891af802b83db1f4a0a21dad624f646d4e9864018
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for fizzl 0.16.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fizzl-0.16.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page