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

tag-per-track-agentkit

v1.0.6

Published

LangChain/AgentKit tool for Tag-per-Track API with x402 micro-payments

Readme

Tag-per-Track AgentKit Tool 🎸🤖

An Agentic-First LangChain/AgentKit tool designed to enable AI Agents to perform advanced audio analysis while handling on-chain micro-payments autonomously via the x402 protocol (HTTP 402 Payment Required).

🌟 Overview

This tool allows AI agents to submit audio files (via URL) to the Tag-per-Track API. In exchange for a small fee (e.g., 0.05 USDC on Base Mainnet), the agent receives a rich JSON payload containing:

  • BPM & Rhythm
  • Key & Scale
  • Genres (with confidence scores)
  • Moods & Instruments

What makes this unique is that the agent handles the payment itself using a Server-Managed Coinbase CDP Wallet, signing an EIP-3009 TransferWithAuthorization without any human intervention.

🚀 Key Features

  • Standardized Payment: Implements the x402 standard for frictionless monetized APIs.
  • Coinbase CDP Integrated: Native support for Coinbase SDK Managed Wallets.
  • Agentic Signing: Uses EIP-712 typed data signing for secure, gasless-for-user transactions.
  • LangChain Compatible: Ready to be plugged into any AgentExecutor or LangChain agent.

🛠 Prerequisites

  • Base Mainnet: The current implementation runs on the Base Mainnet.
  • USDC (Base Mainnet): Ensure your agent's wallet has USDC.
  • Coinbase CDP API Keys: You need CDP_API_KEY_NAME and CDP_API_KEY_PRIVATE_KEY.

📦 Setup

1. Installation

npm install

2. Environment Variables

Create a .env.local file at the project root:

# Coinbase CDP Credentials (from your project dashboard)
CDP_API_KEY_NAME="organizations/..."
CDP_API_KEY_PRIVATE_KEY="-----BEGIN ANY KEY-----..."

# The Seed for your agent's persistent wallet (keep this safe!)
CDP_WALLET_SECRET="your-cdp-shared-secret"

3. Wallet Setup (Provisioning)

If it's your agent's first time, run the setup script to create the wallet. Once created, you will need to manually send some ETH (for gas) and USDC (for payments) to the generated address on Base Mainnet:

npm run setup-wallet

(Note: If you are building/testing on Base Sepolia, you can append -- testnet to this command. The script will automatically call the testnet faucet to fund your agent's wallet with free test ETH and USDC).

💻 Usage Example

To use this tool, your agent needs a wallet capable of signing EIP-712 messages (e.g., using Viem or Coinbase CDP SDK).

import { createTagPerTrackTool } from 'tag-per-track-agentkit';
import { cdpWallet } from './your-cdp-config'; // Custom CDP setup

// 1. Initialize your agent's tool
const tagPerTrackTool = createTagPerTrackTool(cdpWallet);

// 2. Add to LangChain Agent tools array
const tools = [tagPerTrackTool, ...otherTools];

// 3. The Agent can now analyze music!
// Prompt: "Analyze the genre and BPM of this track: https://example.com/song.mp3"

⚡ How it Works (The x402 Cycle)

  1. Initial Call: The Agent calls the API without a proof. The API returns HTTP 402 Payment Required along with payment instructions.
  2. Challenge Extraction: The TagPerTrackTool parses the paymentRequirements (amount, asset, payTo).
  3. EIP-3009 Signing: The agent signs a TransferWithAuthorization EIP-712 message using its CDP-managed wallet.
  4. Resubmission: The tool sends a second request with the signed X-Payment-Proof header.
  5. Verification & Execution: The backend verifies the signature on-chain, settles the payment, and triggers the audio analysis.

📁 Project Structure

tag-per-track-agentkit/
├── src/
│   ├── TagPerTrackTool.ts    # Main LangChain tool (x402 payment cycle)
│   ├── builderCode.ts        # On-chain attribution utilities
│   ├── test-connector.ts     # End-to-end test script
│   └── setup-wallet.ts       # Mainnet wallet provisioning script
├── .env.example              # Environment variable template
├── package.json
└── tsconfig.json

🛠 Scripts

  • npm run test:connector — Runs a full end-to-end test of the tool.
  • npm run setup-wallet — Provisions the agent's wallet on Base Mainnet (use -- testnet for Sepolia).
  • npm run build — Compiles the TypeScript code.
  • npm run clean — Removes the dist/ output directory.

API Documentation & Under the Hood

This SDK is a wrapper around the core Tag-per-Track API. If you want to explore the underlying REST endpoints, inspect the precise JSON schemas returned by our Essentia/TensorFlow models, or test the inference manually, check out our interactive Swagger UI:

👉 Tag-per-Track API Swagger Documentation


Built for the Agentic Commerce era. 🚀