botsrated-openai-agents
One-click attach
Free. No key for local attach. Pairs with the host runtime. Not a second runtime. Paid checks are not required to attach.
pip install "botsrated[x402]"
from botsrated import PaymentGuard
guard = PaymentGuard(preset="carefulBuyer") # omit preset = warn only, never stops a payment
guard.install(x402_client) # the x402 client your agent already pays with
The pair-with package is not on PyPI yet: pip install -e integrations/openai-agents, then attach_payment_guard from botsrated_openai_agents.
Preflight and the guard surface signed receipt links (receipt_url). When org ledger is enabled, paid checks write there by default. No custody. Facts, not grades.
Live docs: botsrated.com/docs/guard#openai-agents.
Default install
Pairs with the OpenAI Agents SDK. Payment-client hook only: it does not replace Agent or Runner. Not a runtime. Free. No key for local attach. Today: pip install "botsrated[x402]" and PaymentGuard. The pair-with package is not on PyPI yet: pip install -e integrations/openai-agents (botsrated>=0.3.1,<0.4).
Pair-with package (not on PyPI yet):
# Free. No key for local attach. Not a runtime.
# Optional BOTSRATED_TOKEN for Desk remote policy.
from botsrated_openai_agents import attach_payment_guard
# Omit preset = advice. Omit fail_mode = open.
guard = attach_payment_guard(x402_client)
Install in 3 steps
- Free. No key for local attach. Install the guard that works today:
pip install "botsrated[x402]", thenPaymentGuardon the x402 client your agent already pays with (one-click above). The pair-with package is not on PyPI yet. From a checkout, in a clean virtualenv:pip install -e integrations/openai-agents(pullsbotsrated>=0.3.1,<0.4). - On the pair-with package, attach to your x402 client. Installing does not attach a guard:
from botsrated_openai_agents import attach_payment_guard
guard = attach_payment_guard(x402_client)
- Omit
presetfor advice only (carefulBuyer/strictstop an unobserved payTo when you pass them). Omitfail_modeto stay open."closed"stops the payment when BotsRated or your policy cannot answer. A missing decision is never a pass. A remote pass never clears a local block.
BOTSRATED_TOKEN is optional. Omit token and the guard reads BOTSRATED_TOKEN. On botsrated 0.3.0 and later it is sent only as remote_policy={"token", "fail_mode"}, never as a bare string. A configured token on a core without parse_remote_policy raises and is not dropped. The policy decision is not signed. Get a token in Desk.
Omit fail_mode and the guard stays open. "closed" stops the payment when BotsRated or your policy cannot answer. A missing decision is never a pass. A remote pass never clears a local block. Nothing defaults you to closed.
Behavior
This is the OpenAI Agents SDK mirror of LangChain attach_payment_guard (PR #14). You keep the SDK's Agent and Runner. The hook is the x402 client those paid calls already use:
from agents import Agent, Runner
from botsrated_openai_agents import attach_payment_guard
guard = attach_payment_guard(x402_client)
# Omit token and the guard reads BOTSRATED_TOKEN. Agent and Runner stay the SDK's.
| Argument | Omit | Set |
|---|---|---|
preset |
Advice only (warn). An unobserved payTo is reported and the payment is not stopped. |
warn (same advice), carefulBuyer, or strict. carefulBuyer and strict are the same stops: an unobserved payTo, an invalid payTo, a host mismatch, or an unknown paid URL blocks. strict is passed as that policy table because PaymentGuard preset names are warn, carefulBuyer, and dry-run-only. |
fail_mode |
Open. "closed" stops the payment when BotsRated or your policy cannot answer. A missing decision is never a pass. A remote pass never clears a local block. |
"open" or "closed". Nothing defaults you to closed. |
token |
Reads BOTSRATED_TOKEN when it is set. Unset sends nothing extra. |
An explicit token wins over BOTSRATED_TOKEN. On botsrated 0.3.0 and later it is sent only as remote_policy={"token", "fail_mode"}. A configured token without parse_remote_policy raises and is not dropped. The policy decision is not signed. Get a token in Desk. |
The guard's lookup is the free preflight at https://botsrated.com (host name only). It does not sign a payment, does not custody funds, and does not add a payment-creation-failure hook. The client enforces a block by honoring the x402 AbortResult from on_before_payment_creation. Tell the guard which URL is being paid with guard.request(url) or guard.wrap_get on that client, the same way PaymentGuard documents it.
Optional free preflight tools
botsrated_preflight_tools() returns a free HTTP preflight callable and https://botsrated.com/mcp. It does not attach a guard. Same rule as botsrated_tools() in the LangChain package.
from agents import Agent, function_tool
from botsrated_openai_agents import botsrated_preflight_tools
free = botsrated_preflight_tools()
agent = Agent(
name="buyer",
instructions="Look up the seller with the free preflight tool before paying.",
tools=[function_tool(fn) for fn in free.http],
)
# free.mcp_url is the hosted MCP server. Add it with the SDK's MCP client if you want it.
# The guard is still a separate attach_payment_guard(x402_client) on the payment client.
Tests: pytest -m "not live" in this directory.
Metadata
Release files for botsrated-openai-agents 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| botsrated_openai_agents-0.1.0.tar.gz | 9.4 kB | With provenance | Details for botsrated_openai_agents-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| botsrated_openai_agents-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for botsrated_openai_agents-0.1.0-py3-none-any.whl |
Total release size: 17.4 kB
Release files / botsrated_openai_agents-0.1.0.tar.gz
| Download URL | botsrated_openai_agents-0.1.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7bcbeb3e0e17da8f3069af2b68f2ae46e900c047ee1ba1c0b81f16c0273d6b3
|
|
BLAKE2b-256 checksum How to use checksums |
81409b0b2eb0dcef01e13d99263b7af48de617f1cc0899c4fe36ee83fe11c3bb
|
| 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 Oct 30, 2026.
Transparency logRelease files / botsrated_openai_agents-0.1.0-py3-none-any.whl
| Download URL | botsrated_openai_agents-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8ce5795c23d3ddf9dbc58c421981ef5245ee143cb5a5924ec8b4aeb668eeeb3
|
|
BLAKE2b-256 checksum How to use checksums |
b033655e1844c7ea0a6bf995778e492da63d55a559eaedba9203263dff24be96
|
| 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 Oct 30, 2026.
Transparency logSecurity for botsrated-openai-agents 0.1.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.
Attestation for botsrated_openai_agents-0.1.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 Oct 30, 2026.
Transparency logA 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.