Skip to main content

LangChain tools for Autonomo

Give a LangChain or LangGraph agent Autonomo's paid APIs. The agent finds the right API for its task, checks the price and pays for the call itself, in USDG or $AUTONOMO with x402 on Robinhood Chain. Spending caps are checked before anything is signed.

pip install langchain-autonomo
import os
from langchain.agents import create_agent
from langchain_autonomo import AutonomoToolkit

toolkit = AutonomoToolkit(private_key=os.environ["AUTONOMO_WALLET_KEY"])
agent = create_agent("anthropic:claude-sonnet-5-5", toolkit.get_tools())

agent.invoke({"messages": [("user", "Is this token safe? 0x86b57bcb9d249cf096cf8e21426c9dc9cafdec49")]})

The agent searches with autonomo_find_apis, picks Token Risk, pays 0.01 USDG with autonomo_call_api and answers from the report. No code was written for Token Risk; an API listed on Autonomo tomorrow works the same way.

Use a new wallet just for the agent, holding only what it may spend. Most APIs cost 0.01 USDG.

The tools

Tool Pays
autonomo_find_apis The best APIs for a task, or all of them: what each does, its path, price and track record No
autonomo_get_price What one call would cost, and the exact URL No
autonomo_call_api Calls the API, pays for it and returns the answer with a receipt and transaction link Yes

Without a wallet key, get_tools() gives only the two free tools.

Limits

AutonomoToolkit(
    private_key=...,
    per_call={"usdg": "0.05", "autonomo": "5000"},   # the most one call may cost (the defaults)
    daily={"usdg": "1", "autonomo": "10000"},        # per UTC day, kept in ~/.autonomo/spend.json
    max_calls=10,                                    # paid calls through this toolkit, then it stops (None: no limit)
    max_output_chars=20_000,                         # longer answers are cut before they reach the model
)

A call over a limit is refused before anything is signed, and the agent is told why, so it can choose a cheaper API or answer with what it has. If an API fails, the payment doesn't settle, so the agent isn't charged.

Gloam, Borro and other options

The toolkit runs on the Autonomo SDK. To pay privately through Gloam, borrow from a Borro credit line, or set anything else the SDK takes, make the client yourself and pass it in:

from autonomo import Autonomo

client = Autonomo(private_key=..., borro_account="0xYourCreditLine")
toolkit = AutonomoToolkit(client, max_calls=5)

With Gloam set up, the agent can ask for private: true. A private call only ever pays through Gloam, never as a public payment.

Full guide: autonomo.fun/docs/langchain.

Tests

They run offline against a fake Autonomo and pay nothing:

pip install -e . pytest && pytest

Metadata

Release files for langchain-autonomo 0.1.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 langchain-autonomo 0.1.0
File Size Uploaded Provenance Actions
langchain_autonomo-0.1.0.tar.gz 9.0 kB Without provenance Details for langchain_autonomo-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-autonomo 0.1.0
File Interpreter ABI Platform Actions
langchain_autonomo-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_autonomo-0.1.0-py3-none-any.whl

Total release size: 15.7 kB

Release files / langchain_autonomo-0.1.0.tar.gz

Download URL langchain_autonomo-0.1.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
db78d7fa169ad15726d2522db635026c7cc167460d66167b7d08479f84a80f7a
BLAKE2b-256 checksum
How to use checksums
7f91d191e4c22b847316c553c5f4820388f6169ca7df11dfd40c28483f57bcd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / langchain_autonomo-0.1.0-py3-none-any.whl

Download URL langchain_autonomo-0.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a170ccceae1778b1d670871eaaa369422bad7220136135874b7016d2586cc8f
BLAKE2b-256 checksum
How to use checksums
844fd70ccc7b55e9c2b8ba49bc034554f186baa323de4a87cdea365329e3065c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for langchain-autonomo 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.1.0 This release

2 release files No 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