Guide
Use Aut from LangChain
langchain-autonomo gives a LangChain or LangGraph agent Aut's APIs as tools, in Python and TypeScript. You give the agent a task, and it finds the right API, checks the price and pays for the call itself, in USDG or $AUTONOMO on Robinhood Chain. You don't write code for each API: an API listed on Autonomo tomorrow works the same way.
| Works with | LangChain and LangGraph, in Python (3.10 or later) and TypeScript (Node 20 or later) |
| The agent needs | A wallet just for it, with a little USDG. Most APIs cost 0.01 USDG |
| Built on | The Aut SDK, so it pays and keeps to limits the same way |
Set up
01Install it
pip install langchain-autonomo langchainnpm install langchain-autonomo langchain @langchain/core02Make a wallet for the agent
Make a new wallet just for the agent and send it only what it may spend: a dollar of USDG on Robinhood Chain covers about 100 calls. Paying in $AUTONOMO also needs a little ETH once, for a Permit2 approval. Then set its key, and your model provider's key, in the terminal:
# macOS and Linux
export AUTONOMO_WALLET_KEY=0x…
export ANTHROPIC_API_KEY=…
# Windows PowerShell
$env:AUTONOMO_WALLET_KEY = "0x…"
$env:ANTHROPIC_API_KEY = "…"03Give the agent the tools
import os
from langchain.agents import create_agent
from langchain_autonomo import AutonomoToolkit
# A new wallet just for the agent, holding only what it may spend.
toolkit = AutonomoToolkit(
private_key=os.environ["AUTONOMO_WALLET_KEY"],
per_call={"usdg": "0.05"}, # the most one call may cost
daily={"usdg": "1"}, # per UTC day
max_calls=5, # paid calls in this run, then the tool stops
)
agent = create_agent(
"anthropic:claude-sonnet-5-5",
tools=toolkit.get_tools(),
system_prompt="Use Aut's APIs for live crypto data. Say what you paid and link the receipt.",
)
result = agent.invoke({"messages": [("user", "Is this token safe? 0x86b57bcb9d249cf096cf8e21426c9dc9cafdec49")]})
print(result["messages"][-1].content)
print(f"Paid calls: {toolkit.paid_calls}")import { createAgent } from "langchain";
import { AutonomoToolkit } from "langchain-autonomo";
// A new wallet just for the agent, holding only what it may spend.
const toolkit = new AutonomoToolkit({
privateKey: process.env.AUTONOMO_WALLET_KEY,
limits: { perCall: { usdg: "0.05" }, daily: { usdg: "1" } }, // the most one call may cost, and per UTC day
maxCalls: 5, // paid calls in this run, then the tool stops
});
const agent = createAgent({
model: "anthropic:claude-sonnet-5-5",
tools: toolkit.getTools(),
systemPrompt: "Use Aut's APIs for live crypto data. Say what you paid and link the receipt.",
});
const result = await agent.invoke({
messages: [{ role: "user", content: "Is this token safe? 0x86b57bcb9d249cf096cf8e21426c9dc9cafdec49" }],
});
console.log(result.messages.at(-1)?.content);
console.log(`Paid calls: ${toolkit.paidCalls}`);Any chat model that can call tools works. Swap anthropic:claude-sonnet-5-5 for the one you use.
What the agent does
01It finds the API
For "is this token safe?", it asks autonomo_find_apis and gets the APIs that take a token address, best first, each with its price and track record. It picks Token Risk.
02It checks the price against your limits
autonomo_call_api reads the price before signing anything. A call above the per-call cap, past today's budget or past max_calls is refused, and the agent is told why, so it can choose a cheaper API or answer with what it has.
03It pays and reads the answer
It pays 0.01 USDG with a signed x402 payment and gets the report back with a receipt that links the payment on Blockscout. Aut settles it on-chain and pays the gas. If the API fails, the payment doesn't settle, so the agent isn't charged.
The tools
| autonomo_find_apis | Free. The best APIs for a task, or all of them: what each does, its path, its price and its track record |
| autonomo_get_price | Free. What one call would cost, every way to pay it, and the exact URL |
| autonomo_call_api | Pays. Calls the API and returns its answer with a receipt: the route, the amount and the transaction link |
Without a wallet key, the toolkit gives only the two free tools, so an agent can look but not pay:
tools = AutonomoToolkit().get_tools() # autonomo_find_apis and autonomo_get_price onlyconst tools = new AutonomoToolkit().getTools(); // autonomo_find_apis and autonomo_get_price onlyLimits
| Per call | The most one call may cost. Default 0.05 USDG or 5,000 $AUTONOMO |
| Per day | Per UTC day, shared with the SDK in ~/.autonomo/spend.json. Default 1 USDG or 10,000 $AUTONOMO |
max_calls / maxCalls | Paid calls through one toolkit, then the tool stops. Default 10; None or null for no limit |
max_output_chars / maxOutputChars | Longer answers are cut before they reach the model. Default 20,000 characters |
Gloam, Borro and other options
The toolkit takes the same options as the SDK, or a client you made yourself. To borrow from a Borro credit line when the wallet is short:
from Aut import Aut
client = Aut(private_key=os.environ["AUTONOMO_WALLET_KEY"], borro_account="0xYourCreditLine")
toolkit = AutonomoToolkit(client, max_calls=5)import { Aut } from "autonomo-sdk";
const client = new Aut({ privateKey: process.env.AUTONOMO_WALLET_KEY, borro: { account: "0xYourCreditLine" } });
const toolkit = new AutonomoToolkit({ client, maxCalls: 5 });With Gloam set up the same way, the agent can ask for a private payment. A private call only ever pays through Gloam, never as a public payment. See Pay privately with Gloam in the SDK guide for the setup.
Good to know
- Prefer APIs marked Verified with a good track record. Aut lists outside creators' APIs too, and doesn't vouch for each one. The find tool tells the model to prefer verified ones.
- Each paid call is public on Robinhood Chain: the wallet, the amount and the API it paid.
- The packages are open source:
langchain-autonomoon PyPI and npm. Their tests run offline against a fake Aut and pay nothing. - Not on LangChain? Use the SDK directly, or the MCP server in Claude, Cursor and other MCP clients.