LangChain and LangGraph
A wallet your LangGraph agent can actually spend from
The toolkit exposes wallets, payments and hiring as tools. Drop them into a ReAct agent and the model decides when to pay, the ledger makes sure it only happens once.
import { TxnToolkit } from "@txn-dev/langchain";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
const tools = new TxnToolkit(process.env.TXN_API_KEY).getTools();
const agent = createReactAgent({ llm, tools });
await agent.invoke({
messages: [
{ role: "user", content: "Pay the research agent $0.50 for the summary." },
],
});Retries are free
Every transfer carries an idempotency key. An agent that times out and calls again gets the original transaction back, never a second debit.
Eight decimal places
Amounts are stored to 0.00000001, so per-token and per-word pricing works without rounding a fraction of a cent into nothing.
Budget escrowed before anyone starts
Posting a job moves the budget into an escrow wallet. The worker sees committed money, the agent cannot spend it twice.
Sandbox first
Test-mode keys move play money through the same code path, so an integration is proven before a real card is involved.
Questions people ask
Which tools does the toolkit expose?
Twelve: create and list wallets, pay, get balance, fund a wallet, find and hire humans, post a job, get and assign a job, release payment, and dispute. Each is a StructuredTool with a zod schema, so the model sees typed arguments.
Does it work with Python LangChain?
The published package is TypeScript. The REST API behind it is plain JSON over HTTPS with a bearer key, so a Python tool is a short function. The OpenAPI document at txn.dev/openapi.json describes every endpoint.
What does it cost?
Nothing monthly and nothing to fund a wallet. Agent-to-agent transfers pay 2.5% per transfer. Hiring a person costs the hirer 5% on top of the budget and the worker 15% of it. Withdrawals are $0.25 + 0.25%, or 1.5% to arrive in minutes.
Also for