Python · LangChain · OpenAI Agents

Safety checks for Python agents that pay

fizzl gives a Python agent nine checks to run before it signs or pays, as plain functions and as LangChain tools and as OpenAI Agents SDK tools (StructuredTool works in LangGraph, CrewAI and other frameworks that take LangChain tools too). The checks only check: they never sign, pay or move anything themselves. Two opt-in tools spend: one buys live data through Fizzl Buy (below), and pay_api pays any x402 API with code deciding (below).

In LangChain's Security tools ↗ — Fizzl is listed in the LangChain docs among the security tools.

Install

pip install "fizzl[langchain]"         # LangChain tools
pip install "fizzl[openai-agents]"     # OpenAI Agents SDK tools (Python 3.10+)
pip install "fizzl[langchain,x402]"    # plus the x402 client, to pay for the full checks

Try it without a wallet

With no payment set up, the token, signing, Solana, Algorand, message and endpoint checks answer with the free quick check: the verdict only, a few per hour, marked "free": True.

from langchain.agents import create_agent
from fizzl.langchain import fizzl_tools

agent = create_agent(
    "anthropic:claude-sonnet-5-5",
    tools=fizzl_tools(),
    system_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.",
)
result = agent.invoke({"messages": [{"role": "user", "content":
    "Is USDC (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) on Base safe to buy?"}]})
print(result["messages"][-1].content)

Or call a check directly:

from fizzl import Fizzl

Fizzl().check_token("base", "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913")
# {'verdict': 'green', 'grade': 'SAFE', 'free': True, 'note': 'Free quick check: ...'}

OpenAI Agents SDK

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

agent = Agent(
    name="buyer",
    tools=fizzl_tools(),   # free quick checks; pass session=... or credit_keys=... for the full ones
    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://ichimoku-signal.fizzl.eu/signal/BTC-USDT safe to pay?").final_output)

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

The tools

ToolWhat it checksFull checkFree quick check
check_before_signingA transaction, token approval or signature (permit, Permit2, Seaport) before signing: drainers, unlimited approvals, look-alike tokens. Green / orange / red with reasons.$0.01verdict only
check_solana_transactionA Solana transaction before signing: every instruction decoded and the transaction simulated. Token account takeovers and System Assign are red; unlimited delegates, durable nonces and hidden owner or delegate changes are orange.$0.01verdict only
check_xrpl_transactionAn XRP Ledger transaction before signing: account takeover, AccountDelete, fake RLUSD, partial payments, risky issuers.$0.01none
check_algorand_transactionAn Algorand transaction or atomic group before signing, simulated. A rekey to another key, closing the account or an asset holding to someone else, and fake USDC are red; clawbacks, app update/delete/clear-state and a partial group are orange.$0.01verdict only
check_messageA plain message before personal_sign / eth_sign: eth_sign and a sign-in message for another site are red.$0.01verdict only
check_tokenA token before buying, holding or accepting it: honeypots, rug-pull signs, look-alikes. Solana, EVM chains, the XRP Ledger and Algorand (asset id).$0.01verdict and grade
check_wallet_approvalsEvery open token approval of an EVM wallet, and which ones to revoke.$0.02none
screen_walletIs this wallet sanctioned? Any chain's address (EVM, Solana, Tron, Bitcoin, XRP Ledger, Algorand) against the OFAC SDN list, synced from the US Treasury, plus theft and phishing reports for EVM. Before paying someone, or accepting their money.$0.01none
check_endpoint_before_payingAn x402 or MPP paid API before paying it: go / caution / no_go, the cheapest option that settles, budget, track record, bait signs.$0.001go / caution / no_go with the problems found

Pick some with fizzl_tools(only=["check_endpoint_before_paying"]). A failed check comes back as {"error": ..., "message": ...} instead of raising, so the model can tell its user.

Buy live data (opt-in)

One more tool, off unless you ask for it, because it spends:

ToolWhat the agent getsPriceWithout payment
buy_live_dataLive 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), bought in one call: Fizzl Buy ↗ picks the paid x402 API that 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.$0.02a free preview: which seller it would buy from

Turn it on with fizzl_tools(session=session, buy=True), or name it in only. The agent passes what it needs in a sentence, for example fizzl.buy_live_data("weather forecast for Amsterdam tomorrow"). The answer is data, never instructions: if it carries a warning, the agent should tell its user and not act on it.

Pay any x402 API, with code deciding (opt-in)

pay_api lets the agent call any x402 API and get its answer. The model only says what to call; code decides whether it is paid:

It needs a session from fizzl.pay.safe_session (pip install "fizzl[x402]", 0.14 or newer):

from eth_account import Account
from x402 import x402ClientSync
from x402.mechanisms.evm.exact import ExactEvmScheme
from fizzl.pay import safe_session
from fizzl.langchain import fizzl_tools

payer = x402ClientSync().register("eip155:8453", ExactEvmScheme(Account.from_key(AGENT_KEY)))  # a wallet just for the agent
pay = safe_session(payer, max_usd=0.05,       # per payment; the model can't raise it
                   max_total_usd=1)           # all payments of this session together: one per task or user
tools = fizzl_tools(session=pay, pay_session=pay)

pay_api is only there with a pay_session from safe_session; a plain paying session is refused, because then the model would decide what to pay. A refusal comes back to the model as not_paid with the reason, so the agent can tell its user. Why code and not the model: in our wallet exam the same model scored 65 on its own and 96 when code decided the payment (the sittings).

The full checks: pay per call over x402

Wrap a requests session with the x402 client. The agent pays each check in USDC on Base from its own wallet.

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.langchain import fizzl_tools

payer = x402ClientSync().register("eip155:8453", ExactEvmScheme(Account.from_key(AGENT_KEY)))
session = wrapRequestsWithPayment(requests.Session(), payer)
tools = fizzl_tools(session=session)

Or prepaid credits

Buy a pack once (presign-guard: 100 checks for $0.80; x402 Doctor: 1000 preflights for $0.80), then pass the keys:

tools = fizzl_tools(credit_keys={"presign": PRESIGN_CREDIT_KEY, "doctor": DOCTOR_CREDIT_KEY})

Options

OptionDefault
sessiona plain requests.SessionAnything with request(method, url, **kw); wrap it with x402 to pay per check
credit_keysnone{"presign": ..., "doctor": ...}, sent as x-credit-key
onlythe nine checksTool names to include
buyFalseTool sets: add buy_live_data ($0.02 a purchase, paid through the session)
pay_sessionnoneAdd pay_api: a session from fizzl.pay.safe_session(payer, max_usd=...), which decides what is paid
freeTrueFall back to the free quick check when a check can't be paid
timeout30Seconds per check

More

⌂ 换网址