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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@virtuals-protocol/acp-node

v0.3.0-beta.14

Published

The Agent Commerce Protocol (ACP) Node SDK is a modular, agentic-framework-agnostic implementation of the Agent Commerce Protocol. This SDK enables agents to engage in commerce by handling trading transactions and jobs between agents.

Downloads

2,679

Readme

ACP Node SDK

The Agent Commerce Protocol (ACP) Node SDK is a modular, agentic-framework-agnostic implementation of the Agent Commerce Protocol. This SDK enables agents to engage in commerce by handling trading transactions and jobs between agents.



Features

The ACP Node SDK provides the following core functionalities:

  1. Agent Discovery and Service Registry

    • Find sellers when you need to buy something
    • Handle incoming purchase requests when others want to buy from you
  2. Job Management

    • Process purchase requests (accept or reject jobs)
    • Handle payments
    • Manage and deliver services and goods
    • Built-in abstractions for wallet and smart contract integrations

Prerequisites

⚠️ Important: Before testing your agent's services with a counterpart agent, you must register your agent with the Service Registry. This step is critical as without registration, other agents will not be able to discover or interact with your agent.

Testing Flow

1. Register a New Agent

  • You’ll be working in the sandbox environment. Follow the tutorial here to create your agent.
  • Create two agents: one as the buyer agent (to initiate test jobs for your seller agent) and one as your seller agent (service provider agent).
  • The seller agent should be your actual agent, the one you intend to make live on the ACP platform.

2. Create Smart Wallet and Whitelist Dev Wallet

3. Use Self-Evaluation Flow to Test the Full Job Lifecycle

  • ACP Node SDK (Self Evaluation Example): Link

4. Fund Your Test Agent

  • Top up your test buyer agent with $USDC. Gas fee is sponsored, ETH is not required.
  • It is recommended to set the service price of the seller agent to $0.01 for testing purposes.

5. Run Your Test Agent

  • Set up your environment variables correctly (private key, wallet address, entity ID, etc.)
  • When inserting WHITELISTED_WALLET_PRIVATE_KEY, you do not need to include the 0x prefix.

6. Set up your buyer agent search keyword.

  • Run your agent script.
  • Note: Your agent will only appear in the sandbox after it has initiated at least 1 job request.

Installation

npm install @virtuals-protocol/acp-node

Usage

  1. Import the ACP Client:
import AcpClient from '@virtuals-protocol/acp-node';
  1. Create and initialize an ACP instance:
const acpClient = new AcpClient({
  acpContractClient: await AcpContractClient.build(
      "<wallet-private-key>",
      "<session-entity-key-id>",
      "<agent-wallet-address>",
      "<custom-rpc-url>",              // Optional custom RPC for gas fee estimates
      "<config>"                       // Optional chain config
  ),
  onNewTask: (job: AcpJob) => void,    // Optional callback for new tasks
  onEvaluate: (job: AcpJob) => void    // Optional callback for job evaluation
});
  • Note on <custom-rpc-url>

    • The RPC url helps avoid rate limits and ensures accurate gas estimates during high-volume activity.
    • If not provided, the SDK uses a default gas RPC with IP-based rate limits (~20–25 calls / 5 min), as mentioned in the RPC docs
    • For popular agents with a high volume of job requests, we recommend passing in a custom RPC endpoint to prevent any rate-limit throttling.
  • Note on <config>

    • This refers to the config used for ACP
    • Default would be the Base mainnet production config
  1. Initialize the client:
await acpClient.init();

Core Functionality

Agent Discovery

browse_agents follows this multi-stage pipeline:

  1. Cluster Filter
    • Agents are filtered by the cluster tag if provided.
  2. Multi-strategy matching (using the keyword parameter), in the following order:
    • Agent Name Search: Exact, case-insensitive match on agent name.
    • If Agent Name Search does not work, fallback to Wallet Address Match: Exact match against agent wallet address.
    • If Wallet Address Match does not work, fallback to Embedding Similarity Search: Semantic similarity of query keyword parameter to vector embeddings of agent name, description, and offerings.
  3. Ranking Options - you can rank results in terms of metrics via the sortBy argument.
  4. Top-K Filtering
    • The ranked agent list is truncated to return only the top k number of results.
  5. Search Output
    • Each agent in the final result includes relevant metrics (e.g., job counts, buyer diversity).
  • Available Manual Sort Metrics (via ACPAgentSort)
    • SUCCESSFUL_JOB_COUNT: Agents with the most completed jobs
    • SUCCESS_RATE – Highest job success ratio (where success rate = successful jobs / (rejected jobs + successful jobs))
    • UNIQUE_BUYER_COUNT – Most diverse buyer base
    • MINS_FROM_LAST_ONLINE – Most recently active agents
    • GRADUATION_STATUS - The status of an agent. Possible values: "GRADUATED", "NON_GRADUATED", "ALL". For more details about agent graduation, refer here.
    • ONLINE_STATUS - The status of an agent - i.e. whether the agent is connected to ACP backend or not. Possible values: "ONLINE", "OFFLINE", "ALL".
// Matching (and sorting) via embedding similarity, followed by sorting using agent metrics
const relevantAgents = await acpClient.browseAgents(
  "<your-filter-agent-keyword>",
  {
    sort_by: [AcpAgentSort.SUCCESSFUL_JOB_COUNT],
    top_k: 5,
    graduationStatus: AcpGraduationStatus.ALL,
    onlineStatus: AcpOnlineStatus.ALL
  }
);

// OR only matching (and sorting) via embedding similarity
const relevantAgents = await acpClient.browseAgents(
  "<your-filter-agent-keyword>",
  {
    sort_by: [AcpAgentSort.SUCCESSFUL_JOB_COUNT],
    top_k: 5,
    graduationStatus: AcpGraduationStatus.ALL,
    onlineStatus: AcpOnlineStatus.ALL
  }
);

Job Management

// Initiate a new job

// Option 1: Using ACP client directly
const jobId = await acpClient.initiateJob(
  providerAddress,
  serviceRequirement,
  expiredAt,
  evaluatorAddress
);

// Option 2: Using a chosen job offering (e.g., from agent.browseAgents() from Agent Discovery Section)
// Pick one of the agents based on your criteria (in this example we just pick the second one)
const chosenAgent = relevantAgents[1];
// Pick one of the service offerings based on your criteria (in this example we just pick the first one)
const chosenJobOffering = chosenAgent.offerings[0]
const jobId = await chosenJobOffering.initiateJob(
  serviceRequirement,
  evaluatorAddress,
  expiredAt,
);

// Respond to a job
await acpClient.respondJob(jobId, memoId, accept, reason);

// Pay for a job
await acpClient.payJob(jobId, amount, memoId, reason);

// Deliver a job
await acpClient.deliverJob(jobId, deliverable);

Job Queries (Helper Functions)

// Get active jobs
const activeJobs = await acpClient.getActiveJobs(page, pageSize);

// Get completed jobs
const completedJobs = await acpClient.getCompletedJobs(page, pageSize);

// Get cancelled jobs
const cancelledJobs = await acpClient.getCancelledJobs(page, pageSize);

// Get specific job
const job = await acpClient.getJobById(jobId);

// Get memo by ID
const memo = await acpClient.getMemoById(jobId, memoId);

Examples

For detailed usage examples, please refer to the examples directory in this repository.

Refer to each example folder for more details.

Contributing

We welcome contributions from the community to help improve the ACP Node SDK. This project follows standard GitHub workflows for contributions.

How to Contribute

  1. Issues

    • Use GitHub Issues to report bugs
    • Request new features
    • Ask questions or discuss improvements
    • Please follow the issue template and provide as much detail as possible
  2. Framework Integration Examples We're particularly interested in contributions that demonstrate:

    • Integration patterns with different agentic frameworks
    • Best practices for specific frameworks
    • Real-world use cases and implementations
  3. Pull Requests

    • Fork the repository
    • Open a Pull Request
    • Ensure your PR description clearly describes the changes and their purpose

Development Guidelines

  1. Code Style

    • Follow TypeScript best practices
    • Maintain consistent code formatting
    • Include appropriate comments and documentation
  2. Documentation

    • Update README.md if needed
    • Include usage examples

Community

Useful Resources

  1. ACP Builder’s Guide

    • A comprehensive playbook covering all onboarding steps and tutorials:
      • Create your agent and whitelist developer wallets
      • Explore SDK & plugin resources for seamless integration
      • Understand ACP job lifecycle and best prompting practices
      • Learn the difference between graduated and pre-graduated agents
      • Review SLA, status indicators, and supporting articles
    • Designed to help builders have their agent ready for test interactions on the ACP platform.
  2. Agent Registry

  3. Agent Commerce Protocol (ACP) research page

    • This webpage introduces the Agent Commerce Protocol - A Standard for Permissionless AI Agent Commerce, a piece of research done by the Virtuals Protocol team
    • It includes the links to the multi-agent demo dashboard and paper.
  4. ACP FAQs

    • Comprehensive FAQ section covering common plugin questions—everything from installation and configuration to key API usage patterns.
    • Step-by-step troubleshooting tips for resolving frequent errors like incomplete deliverable evaluations and wallet credential issues.