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

@402md/agent-tools

v0.1.1

Published

Agent tools for 402.md — framework-agnostic + LangChain adapter

Readme

@402md/agent-tools

Ready-made tools for AI agents to discover and pay for 402.md skills. Framework-agnostic core with a LangChain adapter.

Note: LangChain is currently the only supported framework adapter. Support for Vercel AI SDK, CrewAI, and others is planned. The framework-agnostic core (ToolDef) can be used to build custom adapters for any framework.

Install

npm install @402md/agent-tools @402md/cli

For LangChain:

npm install @402md/agent-tools @402md/cli @langchain/core

Quick Start

Initialize your project with one of the two payment modes:

Wallet-pay — uses a managed wallet created on the 402.md dashboard. The backend handles gas and signing on your behalf (recommended for getting started):

npx @402md/cli init \
  --mode wallet-pay \
  --api-key sk_your_api_key \
  --wallet 0xYOUR_WALLET_ADDRESS \
  --network base-sepolia

x402 — self-custody mode. You provide your own private key and the agent signs USDC transfers directly on-chain:

npx @402md/cli init \
  --mode x402 \
  --key 0xYOUR_PRIVATE_KEY \
  --network base

To point at a custom backend (e.g. local development):

npx @402md/cli init \
  --mode wallet-pay \
  --api-key sk_your_api_key \
  --wallet 0xYOUR_WALLET_ADDRESS \
  --network base-sepolia \
  --api-url http://localhost:3001

Then install a skill:

npx @402md/cli add <skill_name>
import { ChatAnthropic } from '@langchain/anthropic'
import { createAgent } from 'langchain'
import { HumanMessage } from '@langchain/core/messages'
import { createAll402Tools } from '@402md/agent-tools/langchain'
import type { StructuredToolInterface } from '@langchain/core/tools'

const paymentTools = createAll402Tools() as StructuredToolInterface[]

const agent = createAgent({
  model: new ChatAnthropic({ model: 'claude-sonnet-4-6' }),
  tools: paymentTools,
  systemPrompt: 'You are an AI agent with a USDC wallet on Base.',
})

const result = await agent.invoke({
  messages: [new HumanMessage('Check my balance and call ditto at /test')],
})

API

LangChain (@402md/agent-tools/langchain)

import {
  create402Tools,                  // 2 core tools: balance, call
  create402SearchTool,             // 1 tool: search (opt-in)
  createToolsFromInstalledSkills,  // 1 tool per installed skill
  createAll402Tools,               // all combined (core + search + skills)
} from '@402md/agent-tools/langchain'

All functions return DynamicStructuredTool[] and accept an optional { projectDir?: string }.

Framework-Agnostic (@402md/agent-tools)

import { createCoreTools, createSearchTool, createSkillTools } from '@402md/agent-tools'

// Core tools (balance + call)
const tools = [...createCoreTools(), ...createSkillTools()]

// Add search if needed
const allTools = [...createSearchTool(), ...tools]

// Each tool: { name, description, schema, execute }
const result = await tools[0].execute({ query: 'sentiment' })

Tools

| Tool | Source | Description | |------|--------|-------------| | check_balance | create402Tools | Check USDC wallet balance | | call_skill | create402Tools | Call any skill with automatic payment | | search_skills | create402SearchTool | Search the 402.md marketplace (opt-in) | | <skill-name> | createToolsFromInstalledSkills | One tool per installed skill (auto-generated) |

Error Handling

Tools never throw. If payment isn't configured, they return:

{ "error": "No payment configured. Run:\n  npx @402md/cli init ..." }

Examples

See the examples repo for complete working demos, including an interactive LangChain agent with autonomous payments.

License

MIT