Skip to main content

langchain-botsrated

One-click attach

Coding agents: the stack-by-stack attach recipe is llms-install.md → When scaffolding x402 pay (also a Cursor rule and an agent skill). The default path these attaches follow is docs/guard/default-middleware.md.

Free. No key for local attach. Pairs with the host runtime. Not a second runtime. Published on PyPI. Paid checks are not required to attach.

pip install langchain-botsrated
from langchain_botsrated import attach_payment_guard
guard = attach_payment_guard(x402_client)  # omit preset = advice; omit fail_mode = open

Core JS, Python, and curl paste (curl does not attach): docs/guard/copy-paste-attach.md.

Chip halt (strictModeHalt() / haltOn) is not this attach. Omit haltOn and it stays off. Sample chips: payTo changed, probe failed. Measured chips, not grades. Not policies.strict. Not a closed fail_mode. failOpen stays true.

docs/guard/halt-policy.md · docs/guard/examples/strict-mode-halt.md · integrations/x402-client/examples/strict-mode-halt.ts

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.

Attach is pair-with. Free. No key for local attach. Not a second runtime.

Live docs: botsrated.com/docs/guard#langchain.

Default install

Free. No key for local attach. Pairs with LangChain. The guard is not a runtime. Published: pip install langchain-botsrated (PyPI 0.1.6; dependency botsrated>=0.3.1,<0.4). Installing does not attach a guard. Paid checks are not required to attach. Optional BOTSRATED_TOKEN for Desk remote policy (omit token and the guard reads the env).

# Free. No key for local attach. Not a runtime.
# Optional BOTSRATED_TOKEN for Desk remote policy.
from langchain_botsrated import attach_payment_guard
# Omit preset = advice. Omit fail_mode = open.
guard = attach_payment_guard(x402_client)

Install in 3 steps

  1. Free. No key for local attach. Install: pip install langchain-botsrated (PyPI 0.1.6, includes attach_payment_guard). Depends on botsrated>=0.3.1,<0.4. Paid checks are not required to attach.
  2. Attach to your x402 client. Installing does not attach a guard:
from langchain_botsrated import attach_payment_guard
guard = attach_payment_guard(x402_client)
  1. Omit preset for advice only. Pick preset="carefulBuyer" only when you want it (same stops as policies.strict; stops an unobserved payTo). Omit fail_mode to 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.

LangChain tools for BotsRated. Use them as a pre-payment check before an agent pays an x402 seller.

Status: published on PyPI: langchain-botsrated 0.1.6 (this release; includes attach_payment_guard). Depends on botsrated >=0.3.1,<0.4 (source: integrations/python-core). PyPI 0.1.6 matches that pin. Omit token and attach_payment_guard reads BOTSRATED_TOKEN.

pip install langchain-botsrated
Tool Cost Notes
botsrated_preflight free Latest unpaid probe of the seller. With pay_to (+ network, amount) it returns decision.action allow or block and the reasons. A payTo that BotsRated never saw for the host is blocked, with any supported botsrated version (reason payto_not_observed; payto_mismatch with botsrated 0.1.x).
botsrated_paid_check $0.01 USDC on Base (first 25 per client IP per UTC day free) Only added when the client has a budget. Free-quota answers report charged: false and do not touch the budget.
from botsrated import BotsRatedClient
from langchain_botsrated import botsrated_tools

tools = botsrated_tools()            # free preflight only

# Opt-in paid check, max $0.02 total. x402_client is an x402.x402ClientSync with your signer registered;
# it only ever signs a copy of BotsRated's quote rebuilt from allowlisted fields (no Permit2, no extensions).
tools = botsrated_tools(BotsRatedClient(budget_usd="0.02", x402_client=x402_client))

Opt-in payment guard

pip install langchain-botsrated does not attach a guard. Call attach_payment_guard yourself (depends on botsrated>=0.3.1,<0.4). Preflight and the guard are free, no key, rate limits, at https://botsrated.com. A paid check is $0.01 and stays opt-in on the tool. botsrated_tools() is unchanged: free preflight only.

from langchain_botsrated import attach_payment_guard, botsrated_tools

tools = botsrated_tools()  # free preflight only; no guard attached
guard = attach_payment_guard(x402_client, preset="carefulBuyer", fail_mode="open")
# token=... is remote_policy on botsrated 0.3.0+ (see the token paragraph above)

preset is yours: warn (advice only; the default when you omit it) or carefulBuyer (same stops as policies.strict). fail_mode is "open" or "closed"; omit it and the guard stays open. The guard reports measurements and receipt links. It does not sign a payment and does not hold funds.

x402_client is your x402 client. token is sent as remote_policy on botsrated 0.3.0 and later. A configured token without parse_remote_policy raises and is not dropped.

Tests: pytest tests/unit_tests runs the tool tests and LangChain's ToolsUnitTests.

Metadata

Release files for langchain-botsrated 0.1.6

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

Source distribution (sdist)

Source distribution for langchain-botsrated 0.1.6
File Size Uploaded Provenance Actions
langchain_botsrated-0.1.6.tar.gz 10.8 kB With provenance Details for langchain_botsrated-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-botsrated 0.1.6
File Interpreter ABI Platform Actions
langchain_botsrated-0.1.6-py3-none-any.whl Python 3 none any Details for langchain_botsrated-0.1.6-py3-none-any.whl

Total release size: 19.5 kB

Release files / langchain_botsrated-0.1.6.tar.gz

Download URL langchain_botsrated-0.1.6.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e58cedb5eccff1a536f1f556bba8fa270b262c1f6f70e9b43b5c773d310f58c8
BLAKE2b-256 checksum
How to use checksums
26bc4ab84d2f459cf74c86339e61f7a1d6de7f9ac890d88bcea42c00217911f0
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 12, 2026.

Transparency log

Release files / langchain_botsrated-0.1.6-py3-none-any.whl

Download URL langchain_botsrated-0.1.6-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f0ed507960f15ce99e0128de43d56eb24a691062a5fedd9bd2b471dcb61d80d
BLAKE2b-256 checksum
How to use checksums
1f2a69bd322ff483fddc457cc2725c2db35237b7b6c4a9f7cb6cde51c499f74f
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 12, 2026.

Transparency log

Security for langchain-botsrated 0.1.6

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 langchain_botsrated-0.1.6.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 12, 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