npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@starrohan/agentpay

v1.3.0

Published

Autonomous agent wallets with built-in spending policies for Ethereum

Readme

@starrohan/agentpay

The wallet protocol for AI agents. Give any AI agent a crypto wallet, spending limits, and transaction history in 3 lines of code.

npm version license built on Base


The problem

AI agents can think. They can't pay.

Millions of agents are being deployed to do real work — browse the web, call APIs, hire services. But every one hits the same wall: no way to handle money autonomously.

AgentPay fixes that.


Install

npm install @starrohan/agentpay

Quickstart — 1 command

Initialize your agent project in 5 seconds:

npx agentpay

Deploy to Railway Deploy on Vercel


Usage — 3 lines

import "dotenv/config";
import { AgentWallet, policy } from "@starrohan/agentpay";

const agent = new AgentWallet({
  privateKey: process.env.AGENT_PRIVATE_KEY as `0x${string}`,
  agentId: "my-agent",
  policy: policy().maxTx(0.001).dailyLimit(0.01).build()
});

await agent.pay({ to: "0xRECIPIENT", amount: 0.00001, memo: "API call" });

That's it. Your agent now has a wallet, spending limits, and a full transaction history.


Features

  • 💳 Autonomous payments — agent sends crypto with no human clicking anything
  • 🛡️ Spending policy — set max per transaction, daily limits, and recipient allowlists — enforced in code
  • 📋 Transaction history — every payment logged with timestamp, memo, and status
  • 📊 Daily spend tracker — know exactly how much your agent spent today
  • Base L2 — sub-second settlement, near-zero gas fees (~$0.000001 per tx)
  • 🔌 Framework agnostic — works with LangChain, AutoGen, CrewAI, or any agent

Examples & Use Cases

Check out our examples/ directory for high-impact integrations:

  • 🤖 Self-Sustaining Agent — An agent that pays for its own OpenAI/Anthropic API usage.
  • 🦜 LangChain Official Plugin — Built-in Tool support for LangChain agents.
  • 🤝 CrewAI Support — Native tool generator for multi-agent workflows.
  • 🤖 AutoGen Integration — JSON Schema & implementation for AutoGen functions.
  • 🤖 Claude Desktop / MCP Support — Use AgentPay directly in Claude with zero code.
  • 🤖 Self-Sustaining Agent — An agent that pays for its own OpenAI/Anthropic API usage.
  • 🕵️ Autonomous Researcher — Paying for premium data and search APIs.

🌟 Agent Showcase

Are you building something with AgentPay? Submit a PR to add your project here!

  • [Your Project Name] — A brief description of what your agent does.

Badges

Show the world your agent is self-funded:

[![Powered by AgentPay](https://raw.githubusercontent.com/starrohan-dotcom/agentpay/main/assets/powered-by.svg)](https://github.com/starrohan-dotcom/agentpay)


Integrations

LangChain

AgentPay provides an official LangChain tool for easy integration.

import { AgentWallet, AgentPayTool } from "@starrohan/agentpay";

const agent = new AgentWallet({ privateKey: "0x..." });
await agent.init();

const agentPayTool = new AgentPayTool(agent);

CrewAI

Generate tools compatible with CrewAI agents:

import { AgentWallet, createCrewAIPayTool } from "@starrohan/agentpay";

const wallet = new AgentWallet({ privateKey: "0x..." });
await wallet.init();

const walletTool = createCrewAIPayTool(wallet);
// const agent = new Agent({ tools: [walletTool], ... });

AutoGen

Native function registration for AutoGen:

import { AgentWallet, getAutoGenPayTool } from "@starrohan/agentpay";

const wallet = new AgentWallet({ privateKey: "0x..." });
await wallet.init();

const { schema, implementation } = getAutoGenPayTool(wallet);
// register_function(implementation, schema, ...);

Claude Desktop / MCP

AgentPay supports the Model Context Protocol (MCP). You can give your Claude Desktop AI a wallet in 60 seconds.

  1. Open your Claude Desktop config:

    • macOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add AgentPay to the mcpServers list:

{
  "mcpServers": {
    "agentpay": {
      "command": "npx",
      "args": ["-y", "@starrohan/agentpay", "mcp"],
      "env": {
        "AGENT_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY_HERE",
        "RPC_URL": "https://sepolia.base.org"
      }
    }
  }
}
  1. Restart Claude. You will now see a 💳 icon, and you can ask Claude: "What is my wallet balance?" or "Send 0.001 ETH to 0x..."

Claude Code (CLI)

If you use Anthropic's terminal agent, run:

claude mcp add agentpay npx -y @starrohan/agentpay mcp

Roo Code (VS Code)

AgentPay works perfectly with Roo Code.

  1. Open the Roo Code side panel in VS Code.
  2. Click on the MCP Settings icon (or open .roo/mcp_settings.json).
  3. Add the following configuration:
{
  "mcpServers": {
    "agentpay": {
      "command": "npx",
      "args": ["-y", "@starrohan/agentpay", "mcp"],
      "env": {
        "AGENT_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY_HERE",
        "RPC_URL": "https://sepolia.base.org"
      }
    }
  }
}
  1. Roo Code will automatically detect the new tools. You can now tell Roo: "Pay for the API credits using my AgentPay wallet."

API Reference

new AgentWallet(config)

const agent = new AgentWallet({
  privateKey: "0x...",     // agent's wallet private key
  agentId: "my-agent",    // optional human-readable name
  policy: SpendingPolicy, // optional spending rules
  rpcUrl: "https://...",  // optional custom RPC (default: Base Sepolia)
});

policy() — spending policy builder

const rules = policy()
  .maxTx(0.001)                          // max 0.001 ETH per transaction
  .dailyLimit(0.01)                      // max 0.01 ETH per day
  .allowOnly(["0xABC...", "0xDEF..."])   // whitelist of allowed recipients
  .warnAbove(0.0005)                     // log warning for large payments
  .build();

agent.pay(opts)TxRecord

const tx = await agent.pay({
  to: "0xRECIPIENT_ADDRESS",
  amount: 0.00001,           // in ETH
  memo: "weather API call",  // optional label
});

console.log(tx.hash);      // transaction hash
console.log(tx.status);    // "success" | "failed"
console.log(tx.timestamp); // Date

Policy violations throw immediately — the payment never goes out:

Error: [AgentPay] Policy violation: tx amount 99 ETH exceeds maxTxAmount 0.001 ETH

Security

  • Persistent state — daily limits and transaction history survive agent restarts (supports File, Redis, or SQL)
  • Smart Accounts (ERC-7579) — optional on-chain wallet for "un-hackable" security
  • USDC Support — native stablecoin payments on Base
  • BigInt math — all internal calculations use Wei for absolute precision (no floating-point errors)
  • Environment variables — secure private key management via .env support
  • Policy enforcement — autonomous guardrails that cannot be bypassed by agent logic

agent.balance()string

const bal = await agent.balance();
console.log(bal); // "0.000079 ETH"

agent.history()TxRecord[]

const txs = agent.history();
// [{ hash, to, amount, memo, timestamp, status }, ...]

agent.dailySpentSoFar(token?)string

const spent = agent.dailySpentSoFar("USDC");
console.log(`Agent spent ${spent} USDC today`);

agent.summary()

Prints a full summary of all assets to console:

[AgentPay] ── my-agent Summary ──
  Address:      0x5908AE35...
  Balance:      0.000079 ETH | 150.00 USDC
  Spent today:  0.00001 ETH | 5.00 USDC
  Transactions: 1
  Daily limit:  0.01 (Policy enforced)

Real example output

Agent balance: 0.000089873993838909 ETH
[AgentPay] my-agent paying 0.00001 ETH to 0x71C7... (paying for weather API call)...
[AgentPay] ✅ Payment sent!
[AgentPay] 🔗 https://sepolia.basescan.org/tx/0x8be8d2...

Policy blocked the payment: tx amount 99 ETH exceeds maxTxAmount 0.00001 ETH

[AgentPay] ── my-agent Summary ──
  Address:      0x5908AE35...
  Balance:      0.000079 ETH | 150.00 USDC
  Spent today:  0.00001 ETH | 5.00 USDC
  Transactions: 1
  Daily limit:  0.01 (Policy enforced)

Network

Supports Base Sepolia testnet and Base Mainnet.

To use Mainnet, simply provide a Mainnet RPC URL in the config:

const agent = new AgentWallet({
  privateKey: "0x...",
  rpcUrl: "https://mainnet.base.org" // Default is Base Sepolia
});

Roadmap

  • [x] AgentWallet class with pay, balance, history
  • [x] Spending policy engine (maxTx, dailyLimit, allowlist)
  • [x] Base Sepolia testnet
  • [x] Persistent state & BigInt precision (v1.1.1)
  • [x] USDC support (v1.2.0)
  • [x] Smart Account (ERC-7579) integration (v1.2.0)
  • [x] LangChain / AutoGen / CrewAI plugins (v1.2.0)
  • [x] Claude Desktop / MCP Support (v1.2.0)
  • [ ] Enterprise dashboard
  • [ ] Agent-to-agent payments

Built by

@starrohan-dotcom — building the economic infrastructure for AI agents.

Follow the journey on X: @starrohan


License

MIT