Skip to main content

pay-safely

Check that a seller is safe to pay before your AI agent pays.

pay-safely asks Screwtape.ai one question at the moment your agent is about to pay: is this seller safe to pay? You get back allow, review or block, with reasons and a signed receipt you can verify later.

It has no required dependencies and drops into LangChain, LangGraph, CrewAI, the OpenAI Agents SDK, AgentKit, Haystack, Pydantic AI, LlamaIndex and Agno.

What the check looks at

  • The price and payee the seller asks for, compared with what the seller has published.
  • The payee against a denylist and a sanctions list.
  • Whether the amount is far above what your agent intended to pay.
  • Whether the same payment was already made.
  • Whether the seller URL answers with a valid payment request.

If the check cannot confirm something, it says review, not allow. If it cannot run at all (network error, timeout), this package stops the payment by default.

Install

pip install screwtape-pay-safely
# plus the extra for your framework:
pip install "screwtape-pay-safely[langchain]"      # LangChain and LangGraph
pip install "screwtape-pay-safely[crewai]"
pip install "screwtape-pay-safely[openai-agents]"
pip install "screwtape-pay-safely[agentkit]"
pip install "screwtape-pay-safely[haystack]"
pip install "screwtape-pay-safely[pydantic-ai]"
pip install "screwtape-pay-safely[llama-index]"
pip install "screwtape-pay-safely[agno]"

Use it in plain Python

from pay_safely import PaySafely, PaymentBlocked, NeedsReview

guard = PaySafely(agent_id="my-agent")          # 3 free checks a day, no key

try:
    verdict = guard.require_safe("https://seller.example/pay", amount=0.05)
except PaymentBlocked as err:
    print("Do not pay:", err)
except NeedsReview as err:
    print("Ask a person first:", err)
else:
    print("OK to pay. Receipt:", verdict.receipt_id)
    # ... make your payment here ...

Or wrap your payment function:

@guard.protect(seller_url=lambda url, usd: url, amount=lambda url, usd: usd)
def pay(url, usd):
    ...

LangChain and LangGraph

from pay_safely import PaySafely
from pay_safely.langchain import seller_check_tool, guard_tool

guard = PaySafely(agent_id="my-agent")
tools = [
    seller_check_tool(guard),                                      # the agent can ask "is this seller safe?"
    guard_tool(my_payment_tool, guard, seller_url_arg="url", amount_arg="usd"),  # runs only on allow
]

CrewAI

from pay_safely import PaySafely
from pay_safely.crewai import SellerCheckTool

buyer = Agent(role="Buyer", goal="Buy safely", backstory="...", tools=[SellerCheckTool(guard=PaySafely(agent_id="buyer"))])

OpenAI Agents SDK

from agents import Agent, function_tool
from pay_safely import PaySafely
from pay_safely.openai_agents import seller_check_tool, payment_guardrail

guard = PaySafely(agent_id="buyer")
pay = function_tool(pay_seller, tool_input_guardrails=[payment_guardrail(guard, "url", "usd")])
agent = Agent(name="Buyer", tools=[seller_check_tool(guard), pay])

AgentKit

from pay_safely import PaySafely
from pay_safely.agentkit import pay_safely_action_provider

# add to the action_providers list in your AgentKit config
provider = pay_safely_action_provider(PaySafely(agent_id="buyer"))

Haystack

from pay_safely import PaySafely
from pay_safely.haystack import SellerCheck

check = SellerCheck(guard=PaySafely(agent_id="buyer"))
print(check.run(seller_url="https://seller.example/pay", amount_usd=0.05)["result"])

Pydantic AI

from pydantic_ai import Agent
from pay_safely import PaySafely
from pay_safely.pydantic_ai import seller_check_capability

agent = Agent("openai:gpt-4o", capabilities=[seller_check_capability(PaySafely(agent_id="buyer"))])

LlamaIndex

from pay_safely import PaySafely
from pay_safely.llama_index import seller_check_tool

tools = [seller_check_tool(PaySafely(agent_id="buyer"))]

Agno

from agno.agent import Agent
from pay_safely import PaySafely
from pay_safely.agno import SellerCheckTools

agent = Agent(tools=[SellerCheckTools(guard=PaySafely(agent_id="buyer"))])

Free checks, keys and paid use

Checks
No key 3 free a day
Free API key 10 free a day. Get one at https://screwtape.ai/v1/signup and pass PaySafely(api_key="...")
After that $0.005 per check. See https://screwtape.ai/llms.txt for how an agent pays per call. Pass your own payment-capable HTTP client with transport=

When the free checks run out, check() raises DailyLimitReached with the link to get a free key.

Options

Option Default Meaning
fail_open False If True, a check that cannot run lets the payment go ahead.
allow_review False If True, a review verdict does not stop the payment.
timeout 10.0 Seconds to wait for the check.
transport built in Your own function to send the request.

Limits

This is a second opinion, not a guarantee. The check advises and records. Your code decides whether to pay, and the check cannot stop a payment your code makes anyway. It does not hold funds.

Verify a receipt

Every answer includes a receipt_id and verify_url. Verify it for free at https://screwtape.ai/verify/.

Develop

pip install -e ".[test]"
pytest

Support

support@screwtape.ai · https://screwtape.ai

MIT license.

Metadata

Release files for screwtape-pay-safely 0.2.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 screwtape-pay-safely 0.2.0
File Size Uploaded Provenance Actions
screwtape_pay_safely-0.2.0.tar.gz 11.8 kB With provenance Details for screwtape_pay_safely-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for screwtape-pay-safely 0.2.0
File Interpreter ABI Platform Actions
screwtape_pay_safely-0.2.0-py3-none-any.whl Python 3 none any Details for screwtape_pay_safely-0.2.0-py3-none-any.whl

Total release size: 27.5 kB

Release files / screwtape_pay_safely-0.2.0.tar.gz

Download URL screwtape_pay_safely-0.2.0.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
95d8002067d10fe1ece9deacabbfc4c4094eebc62dea3449364f88da93b8b92e
BLAKE2b-256 checksum
How to use checksums
14ca2bd389c44b9108304c14db7c115f8b93a8a30cef0855156418e8b9cbf992
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 17, 2026.

Transparency log

Release files / screwtape_pay_safely-0.2.0-py3-none-any.whl

Download URL screwtape_pay_safely-0.2.0-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e7abf3f2c183d23987cd500bc3ba9982b240a878326c0cdcc41b78236ecbc67
BLAKE2b-256 checksum
How to use checksums
4fe98981f85ad37ac6dcd0fac5e2da7f20b1c36b4187a6ed3c7d5f61a98b0f9d
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 17, 2026.

Transparency log

Security for screwtape-pay-safely 0.2.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 screwtape_pay_safely-0.2.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 17, 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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