Skip to main content

agent402-structured-tools (Python)

Turn Agent402's catalog of 500+ pay-per-call tools and skill packs into structured tools for Python agents, for use with LangChain.

Works with LangChain for Python (langchain-core). Agent402 is not affiliated with or endorsed by LangChain.

Formerly agent402-langchain: the same API under a new name. Change the dependency and the import specifier; nothing else changes.

Agent402 is the applied layer of Agentic Finance - agents that pay and get paid on their own over the two open wires, x402 and MPP (Machine Payments Protocol). Every paid endpoint answers both on the same 402; this package pays wallet-only tools through the x402_fetch callable you pass (below).

Pure-CPU tools (hashing, encoding, QR, markdown, JSON, readability…) are free via built-in proof-of-work - no wallet, no API keys. Live-data tools (market data, web search, EDGAR, on-chain) are wallet-only and settle in USDC.

pip install "agent402-structured-tools[langchain]"
from agent402_structured_tools import Agent402Toolkit

toolkit = Agent402Toolkit(base_url="https://agent402.tools")
tools = toolkit.get_tools()   # four meta-tools your agent can call

It exposes four meta-tools rather than 500+ individual ones (frameworks and LLMs both choke on thousands of tools):

Tool What it does
agent402_find Resolve a task description to the best tool (slug, price, schema, example)
agent402_route Cross-seller x402 router across the sellers Agent402 indexes
agent402_call Call a tool by slug - auto-pays via proof-of-work (free) or your x402 fetch (paid)
agent402_about The service manifest (identity, payment options, trust signals)

Paid (wallet-only) tools

Pass x402_fetch - a callable with the requests-style signature (method, url, **kwargs) -> requests.Response that signs the USDC payment:

toolkit = Agent402Toolkit(base_url="https://agent402.tools", x402_fetch=my_signed_fetch)

The callable is passed allow_redirects=False: a paid call never follows a redirect, and one is refused with the origin it pointed to, so point base_url at the address that serves the routes directly.

Without it, calling a wallet-only tool raises a clear error naming what's needed; the free proof-of-work tier keeps working regardless.

Spending caps. A paid call is checked before x402_fetch runs: a tool whose listed price is above max_per_call_usd (default 5, the same default as the JS client; 0 or "off" turns it off) is refused, and so is a call that would bring the rolling 24-hour total above daily_limit_usd (opt-in). Every call sent through x402_fetch counts its list price against that total, whatever its outcome. A refusal raises SpendingLimitError (its limit names the cap) and nothing is paid:

toolkit = Agent402Toolkit(x402_fetch=my_signed_fetch, max_per_call_usd=0.05, daily_limit_usd=2)

A proof-of-work challenge above 28 bits (MAX_POW_DIFFICULTY) is refused before any work.

Without LangChain

agent402_tool_specs() returns the same four entries as framework-agnostic dicts (name, description, JSON Schema, and a plain execute callable) - no langchain-core needed.

MIT © Havok Holdings LLC · github.com/MikeyPetrillo/Agent402

Metadata

Release files for agent402-structured-tools 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 agent402-structured-tools 0.2.0
File Size Uploaded Provenance Actions
agent402_structured_tools-0.2.0.tar.gz 11.2 kB With provenance Details for agent402_structured_tools-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent402-structured-tools 0.2.0
File Interpreter ABI Platform Actions
agent402_structured_tools-0.2.0-py3-none-any.whl Python 3 none any Details for agent402_structured_tools-0.2.0-py3-none-any.whl

Total release size: 20.9 kB

Release files / agent402_structured_tools-0.2.0.tar.gz

Download URL agent402_structured_tools-0.2.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
85db7f18d9cc3d5cec7b143a9f37a68d8609050b807b971fc8dfa62a7b01de37
BLAKE2b-256 checksum
How to use checksums
681fe8c1fadd0861087310014d05fba309d46b1766e7ee08e58e27a02df8345d
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 25, 2026.

Transparency log

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

Download URL agent402_structured_tools-0.2.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d875dfd562d22a05ef76c8c3511c53bff8641da27f6a3b4cebaf31092ba4a091
BLAKE2b-256 checksum
How to use checksums
83615d9092971f2de97d40940535c3bea0f5f6c32f8f2b12fd03b9d5ed70a941
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 25, 2026.

Transparency log

Security for agent402-structured-tools 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 agent402_structured_tools-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 25, 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