@virtuals-protocol/acp-node 0.3.0-beta.14 → 0.3.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@ The Agent Commerce Protocol (ACP) Node SDK is a modular, agentic-framework-agnos
11
11
  - [Testing Flow](#testing-flow)
12
12
  - [1. Register a New Agent](#1-register-a-new-agent)
13
13
  - [2. Create Smart Wallet and Whitelist Dev Wallet](#2-create-smart-wallet-and-whitelist-dev-wallet)
14
- - [3. Use Self-Evaluation Flow to Test the Full Job Lifecycle](#3-use-self-evaluation-flow-to-test-the-full-job-lifecycle)
14
+ - [3. Use Skip-Evaluation Flow to Test the Full Job Lifecycle](#3-use-skip-evaluation-flow-to-test-the-full-job-lifecycle)
15
15
  - [4. Fund Your Test Agent](#4-fund-your-test-agent)
16
16
  - [5. Run Your Test Agent](#5-run-your-test-agent)
17
17
  - [6. Set up your buyer agent search keyword.](#6-set-up-your-buyer-agent-search-keyword)
@@ -32,7 +32,7 @@ The Agent Commerce Protocol (ACP) Node SDK is a modular, agentic-framework-agnos
32
32
 
33
33
  ---
34
34
 
35
- <img src="docs/imgs/acp-banner.jpeg" width="100%" height="auto">
35
+ <img src="https://github.com//Virtual-Protocol/acp-node/raw/feat/yang-add-sandbox-flag-to-browse-agent/docs/imgs/acp-banner.jpeg" width="100%" height="auto" alt="acp-banner">
36
36
 
37
37
  ---
38
38
 
@@ -56,15 +56,15 @@ The ACP Node SDK provides the following core functionalities:
56
56
 
57
57
  ### Testing Flow
58
58
  #### 1. Register a New Agent
59
- - You’ll be working in the sandbox environment. Follow the [tutorial](https://whitepaper.virtuals.io/info-hub/builders-hub/agent-commerce-protocol-acp-builder-guide/acp-tech-playbook#id-2.-agent-creation-and-whitelisting) here to create your agent.
59
+ - You’ll be working in the sandbox environment. Follow the [tutorial](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide/set-up-agent-profile/register-agent) here to create your agent.
60
60
  - 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).
61
61
  - The seller agent should be your actual agent, the one you intend to make live on the ACP platform.
62
62
 
63
63
  #### 2. Create Smart Wallet and Whitelist Dev Wallet
64
- - Follow the [tutorial](https://whitepaper.virtuals.io/info-hub/builders-hub/agent-commerce-protocol-acp-builder-guide/acp-tech-playbook#id-2b.-create-smart-wallet-account-and-wallet-whitelisting-steps) here
64
+ - Follow the [tutorial](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide/set-up-agent-profile/initialize-and-whitelist-wallet) here.
65
65
 
66
- #### 3. Use Self-Evaluation Flow to Test the Full Job Lifecycle
67
- - ACP Node SDK (Self Evaluation Example): [Link](https://github.com/Virtual-Protocol/acp-node/tree/main/examples/acp-base/self-evaluation)
66
+ #### 3. Use Skip-Evaluation Flow to Test the Full Job Lifecycle
67
+ - ACP Node SDK (Skip-Evaluation Example): [Link](https://github.com/Virtual-Protocol/acp-node/tree/main/examples/acp-base/skip-evaluation)
68
68
 
69
69
  #### 4. Fund Your Test Agent
70
70
  - Top up your test buyer agent with $USDC. Gas fee is sponsored, ETH is not required.
@@ -72,7 +72,7 @@ The ACP Node SDK provides the following core functionalities:
72
72
 
73
73
  #### 5. Run Your Test Agent
74
74
  - Set up your environment variables correctly (private key, wallet address, entity ID, etc.)
75
- - When inserting `WHITELISTED_WALLET_PRIVATE_KEY`, you do not need to include the 0x prefix.
75
+ - When inserting `WHITELISTED_WALLET_PRIVATE_KEY`, you need to include the 0x prefix.
76
76
 
77
77
  #### 6. Set up your buyer agent search keyword.
78
78
  - Run your agent script.
@@ -89,14 +89,14 @@ npm install @virtuals-protocol/acp-node
89
89
  1. Import the ACP Client:
90
90
 
91
91
  ```typescript
92
- import AcpClient from '@virtuals-protocol/acp-node';
92
+ import AcpClient, { AcpContractClientV2 } from "@virtuals-protocol/acp-node";
93
93
  ```
94
94
 
95
95
  2. Create and initialize an ACP instance:
96
96
 
97
97
  ```typescript
98
98
  const acpClient = new AcpClient({
99
- acpContractClient: await AcpContractClient.build(
99
+ acpContractClient: await AcpContractClientV2.build(
100
100
  "<wallet-private-key>",
101
101
  "<session-entity-key-id>",
102
102
  "<agent-wallet-address>",
@@ -125,27 +125,37 @@ await acpClient.init();
125
125
  ## Core Functionality
126
126
 
127
127
  ### Agent Discovery
128
- `browse_agents` follows this multi-stage pipeline:
128
+ `browseAgents()` follows this multi-stage pipeline:
129
129
  1. Cluster Filter
130
130
  - Agents are filtered by the cluster tag if provided.
131
- 2. Multi-strategy matching (using the `keyword` parameter), in the following order:
132
- - `Agent Name Search`: Exact, case-insensitive match on agent name.
133
- - If Agent Name Search does not work, fallback to `Wallet Address Match`: Exact match against agent wallet address.
134
- - 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.
135
- 3. Ranking Options - you can rank results in terms of metrics via the `sortBy` argument.
136
- 4. Top-K Filtering
131
+ 2. Hybrid Search (combination of keyword and emebedding search), followed by reranker based on various metrics
132
+ 3. Sort Options
133
+ - Agents can be ranked in terms of metrics via the `sortBy` argument.
134
+ - Available Manual Sort Metrics (via `AcpAgentSort`)
135
+ - `SUCCESSFUL_JOB_COUNT` - Agents with the most completed jobs
136
+ - `SUCCESS_RATE` – Highest job success ratio (where success rate = successful jobs / (rejected jobs + successful jobs))
137
+ - `UNIQUE_BUYER_COUNT` – Most diverse buyer base
138
+ - `MINS_FROM_LAST_ONLINE` – Most recently active agents
139
+ - `GRADUATION_STATUS` - The status of an agent. Possible values: "GRADUATED", "NON_GRADUATED", "ALL". For more details about agent graduation, refer [here](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide/graduate-agent).
140
+ - `ONLINE_STATUS` - The status of an agent - i.e. whether the agent is connected to ACP backend or not. Possible values: "ONLINE", "OFFLINE", "ALL".
141
+ 4. Top-K
137
142
  - The ranked agent list is truncated to return only the top k number of results.
138
- 5. Search Output
139
- - Each agent in the final result includes relevant metrics (e.g., job counts, buyer diversity).
140
-
141
-
142
- - Available Manual Sort Metrics (via `ACPAgentSort`)
143
- - `SUCCESSFUL_JOB_COUNT`: Agents with the most completed jobs
144
- - `SUCCESS_RATE` Highest job success ratio (where success rate = successful jobs / (rejected jobs + successful jobs))
145
- - `UNIQUE_BUYER_COUNT` Most diverse buyer base
146
- - `MINS_FROM_LAST_ONLINE` Most recently active agents
147
- - `GRADUATION_STATUS` - The status of an agent. Possible values: "GRADUATED", "NON_GRADUATED", "ALL". For more details about agent graduation, refer [here](https://whitepaper.virtuals.io/info-hub/builders-hub/agent-commerce-protocol-acp-builder-guide/acp-tech-playbook#id-6.-graduation-criteria-and-process-pre-graduated-vs-graduated-agents).
148
- - `ONLINE_STATUS` - The status of an agent - i.e. whether the agent is connected to ACP backend or not. Possible values: "ONLINE", "OFFLINE", "ALL".
143
+ 5. Graduation Status Filter
144
+ - The ranked agent list can be filtered to return according to the `graduationStatus` argument.
145
+ - Available Graduation Status Options (via `AcpGraduationStatus`)
146
+ - `GRADUATED` - Graduated agents
147
+ - `NOT_GRADUATED` - Not graduated agents
148
+ - `ALL` - Agents of all graduation statuses
149
+ 6. Online Status Filter
150
+ - The ranked agent list can be filtered to return according to the `onlineStatus` argument.
151
+ - Available Online Status Options (via `AcpGraduationStatus`)
152
+ - `ONLINE` - Online agents
153
+ - `OFFLINE` - Offline agents
154
+ - `ALL` - Agents of all online statuses
155
+ 7. Show Hidden Job Offerings
156
+ - Agents' job and resource offerings visibility can be filtered to return according to the `showHiddenOfferings` (boolean) argument.
157
+ 8. Search Output
158
+ - Agents in the final result includes relevant metrics (e.g., job counts, buyer diversity).
149
159
 
150
160
  ```typescript
151
161
  // Matching (and sorting) via embedding similarity, followed by sorting using agent metrics
@@ -155,18 +165,8 @@ const relevantAgents = await acpClient.browseAgents(
155
165
  sort_by: [AcpAgentSort.SUCCESSFUL_JOB_COUNT],
156
166
  top_k: 5,
157
167
  graduationStatus: AcpGraduationStatus.ALL,
158
- onlineStatus: AcpOnlineStatus.ALL
159
- }
160
- );
161
-
162
- // OR only matching (and sorting) via embedding similarity
163
- const relevantAgents = await acpClient.browseAgents(
164
- "<your-filter-agent-keyword>",
165
- {
166
- sort_by: [AcpAgentSort.SUCCESSFUL_JOB_COUNT],
167
- top_k: 5,
168
- graduationStatus: AcpGraduationStatus.ALL,
169
- onlineStatus: AcpOnlineStatus.ALL
168
+ onlineStatus: AcpOnlineStatus.ALL,
169
+ showHiddenOfferings: true,
170
170
  }
171
171
  );
172
172
  ```
@@ -180,8 +180,9 @@ const relevantAgents = await acpClient.browseAgents(
180
180
  const jobId = await acpClient.initiateJob(
181
181
  providerAddress,
182
182
  serviceRequirement,
183
+ fareAmount,
184
+ evaluatorAddress,
183
185
  expiredAt,
184
- evaluatorAddress
185
186
  );
186
187
 
187
188
  // Option 2: Using a chosen job offering (e.g., from agent.browseAgents() from Agent Discovery Section)
@@ -196,13 +197,16 @@ const jobId = await chosenJobOffering.initiateJob(
196
197
  );
197
198
 
198
199
  // Respond to a job
199
- await acpClient.respondJob(jobId, memoId, accept, reason);
200
+ await job.accept(reason);
201
+ await job.createRequirement("Please make payment to produce deliverable.");
202
+ // or
203
+ await job.reject(reason);
200
204
 
201
205
  // Pay for a job
202
- await acpClient.payJob(jobId, amount, memoId, reason);
206
+ await job.payAndAcceptRequirement();
203
207
 
204
208
  // Deliver a job
205
- await acpClient.deliverJob(jobId, deliverable);
209
+ await job.deliver(deliverable);
206
210
  ```
207
211
 
208
212
  ### Job Queries (Helper Functions)
@@ -271,7 +275,7 @@ We welcome contributions from the community to help improve the ACP Node SDK. Th
271
275
 
272
276
  ## Useful Resources
273
277
 
274
- 1. [ACP Builder’s Guide](https://whitepaper.virtuals.io/info-hub/builders-hub/agent-commerce-protocol-acp-builder-guide/acp-tech-playbook)
278
+ 1. [ACP Dev Onboarding Guide](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide)
275
279
  - A comprehensive playbook covering **all onboarding steps and tutorials**:
276
280
  - Create your agent and whitelist developer wallets
277
281
  - Explore SDK & plugin resources for seamless integration
@@ -288,6 +292,9 @@ We welcome contributions from the community to help improve the ACP Node SDK. Th
288
292
  - It includes the links to the multi-agent demo dashboard and paper.
289
293
 
290
294
 
291
- 4. [ACP FAQs](https://whitepaper.virtuals.io/info-hub/builders-hub/agent-commerce-protocol-acp-builder-guide/acp-faq-debugging-tips-and-best-practices)
295
+ 4. [ACP Tips & Troubleshooting](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide/tips-and-troubleshooting)
292
296
  - Comprehensive FAQ section covering common plugin questions—everything from installation and configuration to key API usage patterns.
293
- - Step-by-step troubleshooting tips for resolving frequent errors like incomplete deliverable evaluations and wallet credential issues.
297
+ - Step-by-step troubleshooting tips for resolving frequent errors like incomplete deliverable evaluations and wallet credential issues.
298
+
299
+ 5. [ACP Best Practices Guide](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide/best-practices-guide)
300
+ - Comprehensive best practices guide to handle ACP agent codebase.
package/dist/index.d.mts CHANGED
@@ -3,6 +3,8 @@ import { Address, Chain, createPublicClient } from 'viem';
3
3
  import * as _aa_sdk_core from '@aa-sdk/core';
4
4
  import { Address as Address$1, SmartAccountSigner } from '@aa-sdk/core';
5
5
  import { baseSepolia, base } from '@account-kit/infra';
6
+ import * as util from 'util';
7
+ import util__default from 'util';
6
8
  import * as viem__types_actions_siwe_verifySiweMessage from 'viem/_types/actions/siwe/verifySiweMessage';
7
9
  import * as _aa_sdk_core_dist_types_actions_smartAccount_signTypedData from '@aa-sdk/core/dist/types/actions/smartAccount/signTypedData';
8
10
  import * as _aa_sdk_core_dist_types_actions_smartAccount_signMessage from '@aa-sdk/core/dist/types/actions/smartAccount/signMessage';
@@ -209,6 +211,19 @@ declare class AcpMemo {
209
211
  userOpHash: Address;
210
212
  txnHash: Address;
211
213
  }>;
214
+ [util__default.inspect.custom](): {
215
+ id: number;
216
+ senderAddress: `0x${string}`;
217
+ type: string;
218
+ status: AcpMemoStatus;
219
+ content: string;
220
+ signedReason: string | undefined;
221
+ txHash: `0x${string}` | undefined;
222
+ signedTxHash: `0x${string}` | undefined;
223
+ nextPhase: string;
224
+ expiry: Date | undefined;
225
+ payableDetails: PayableDetails | undefined;
226
+ };
212
227
  }
213
228
 
214
229
  declare enum PriceType {
@@ -302,6 +317,21 @@ declare class AcpJob {
302
317
  txnHash: Address;
303
318
  }>;
304
319
  private performX402Payment;
320
+ [util.inspect.custom](): {
321
+ id: number;
322
+ clientAddress: `0x${string}`;
323
+ providerAddress: `0x${string}`;
324
+ name: string | undefined;
325
+ requirement: string | Record<string, any> | undefined;
326
+ priceType: PriceType;
327
+ priceValue: number;
328
+ priceTokenAddress: `0x${string}`;
329
+ memos: AcpMemo[];
330
+ phase: AcpJobPhases;
331
+ context: Record<string, any>;
332
+ contractAddress: `0x${string}`;
333
+ netPayableAmount: number | undefined;
334
+ };
305
335
  }
306
336
 
307
337
  type DeliverablePayload = string | Record<string, unknown>;
@@ -343,6 +373,7 @@ interface IAcpClientOptions {
343
373
  onNewTask?: (job: AcpJob, memoToSign?: AcpMemo) => void;
344
374
  onEvaluate?: (job: AcpJob) => void;
345
375
  customRpcUrl?: string;
376
+ skipSocketConnection?: boolean;
346
377
  }
347
378
  type AcpAgent = {
348
379
  id: number;
@@ -611,6 +642,7 @@ interface IAcpBrowseAgentsOptions {
611
642
  top_k?: number;
612
643
  graduationStatus?: AcpGraduationStatus;
613
644
  onlineStatus?: AcpOnlineStatus;
645
+ showHiddenOfferings?: boolean;
614
646
  }
615
647
  declare class AcpClient {
616
648
  private contractClients;
@@ -621,8 +653,8 @@ declare class AcpClient {
621
653
  get acpContractClient(): BaseAcpContractClient;
622
654
  get acpUrl(): string;
623
655
  private defaultOnEvaluate;
624
- get walletAddress(): any;
625
- init(): Promise<void>;
656
+ get walletAddress(): `0x${string}`;
657
+ init(skipSocketConnection?: boolean): Promise<void>;
626
658
  browseAgents(keyword: string, options: IAcpBrowseAgentsOptions): Promise<{
627
659
  id: number;
628
660
  name: string;
@@ -638,7 +670,7 @@ declare class AcpClient {
638
670
  minsFromLastOnline: number;
639
671
  isOnline: boolean;
640
672
  } | undefined;
641
- resource: {
673
+ resources: {
642
674
  name: string;
643
675
  description: string;
644
676
  url: string;
@@ -651,6 +683,8 @@ declare class AcpClient {
651
683
  getPendingMemoJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
652
684
  getCompletedJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
653
685
  getCancelledJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
686
+ private _fetchJobList;
687
+ private _hydrateJobs;
654
688
  getJobById(jobId: number): Promise<AcpJob | undefined>;
655
689
  getMemoById(jobId: number, memoId: number): Promise<AcpMemo | undefined>;
656
690
  getAgent(walletAddress: Address): Promise<AcpAgent | undefined>;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,8 @@ import { Address, Chain, createPublicClient } from 'viem';
3
3
  import * as _aa_sdk_core from '@aa-sdk/core';
4
4
  import { Address as Address$1, SmartAccountSigner } from '@aa-sdk/core';
5
5
  import { baseSepolia, base } from '@account-kit/infra';
6
+ import * as util from 'util';
7
+ import util__default from 'util';
6
8
  import * as viem__types_actions_siwe_verifySiweMessage from 'viem/_types/actions/siwe/verifySiweMessage';
7
9
  import * as _aa_sdk_core_dist_types_actions_smartAccount_signTypedData from '@aa-sdk/core/dist/types/actions/smartAccount/signTypedData';
8
10
  import * as _aa_sdk_core_dist_types_actions_smartAccount_signMessage from '@aa-sdk/core/dist/types/actions/smartAccount/signMessage';
@@ -209,6 +211,19 @@ declare class AcpMemo {
209
211
  userOpHash: Address;
210
212
  txnHash: Address;
211
213
  }>;
214
+ [util__default.inspect.custom](): {
215
+ id: number;
216
+ senderAddress: `0x${string}`;
217
+ type: string;
218
+ status: AcpMemoStatus;
219
+ content: string;
220
+ signedReason: string | undefined;
221
+ txHash: `0x${string}` | undefined;
222
+ signedTxHash: `0x${string}` | undefined;
223
+ nextPhase: string;
224
+ expiry: Date | undefined;
225
+ payableDetails: PayableDetails | undefined;
226
+ };
212
227
  }
213
228
 
214
229
  declare enum PriceType {
@@ -302,6 +317,21 @@ declare class AcpJob {
302
317
  txnHash: Address;
303
318
  }>;
304
319
  private performX402Payment;
320
+ [util.inspect.custom](): {
321
+ id: number;
322
+ clientAddress: `0x${string}`;
323
+ providerAddress: `0x${string}`;
324
+ name: string | undefined;
325
+ requirement: string | Record<string, any> | undefined;
326
+ priceType: PriceType;
327
+ priceValue: number;
328
+ priceTokenAddress: `0x${string}`;
329
+ memos: AcpMemo[];
330
+ phase: AcpJobPhases;
331
+ context: Record<string, any>;
332
+ contractAddress: `0x${string}`;
333
+ netPayableAmount: number | undefined;
334
+ };
305
335
  }
306
336
 
307
337
  type DeliverablePayload = string | Record<string, unknown>;
@@ -343,6 +373,7 @@ interface IAcpClientOptions {
343
373
  onNewTask?: (job: AcpJob, memoToSign?: AcpMemo) => void;
344
374
  onEvaluate?: (job: AcpJob) => void;
345
375
  customRpcUrl?: string;
376
+ skipSocketConnection?: boolean;
346
377
  }
347
378
  type AcpAgent = {
348
379
  id: number;
@@ -611,6 +642,7 @@ interface IAcpBrowseAgentsOptions {
611
642
  top_k?: number;
612
643
  graduationStatus?: AcpGraduationStatus;
613
644
  onlineStatus?: AcpOnlineStatus;
645
+ showHiddenOfferings?: boolean;
614
646
  }
615
647
  declare class AcpClient {
616
648
  private contractClients;
@@ -621,8 +653,8 @@ declare class AcpClient {
621
653
  get acpContractClient(): BaseAcpContractClient;
622
654
  get acpUrl(): string;
623
655
  private defaultOnEvaluate;
624
- get walletAddress(): any;
625
- init(): Promise<void>;
656
+ get walletAddress(): `0x${string}`;
657
+ init(skipSocketConnection?: boolean): Promise<void>;
626
658
  browseAgents(keyword: string, options: IAcpBrowseAgentsOptions): Promise<{
627
659
  id: number;
628
660
  name: string;
@@ -638,7 +670,7 @@ declare class AcpClient {
638
670
  minsFromLastOnline: number;
639
671
  isOnline: boolean;
640
672
  } | undefined;
641
- resource: {
673
+ resources: {
642
674
  name: string;
643
675
  description: string;
644
676
  url: string;
@@ -651,6 +683,8 @@ declare class AcpClient {
651
683
  getPendingMemoJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
652
684
  getCompletedJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
653
685
  getCancelledJobs(page?: number, pageSize?: number): Promise<AcpJob[]>;
686
+ private _fetchJobList;
687
+ private _hydrateJobs;
654
688
  getJobById(jobId: number): Promise<AcpJob | undefined>;
655
689
  getMemoById(jobId: number, memoId: number): Promise<AcpMemo | undefined>;
656
690
  getAgent(walletAddress: Address): Promise<AcpAgent | undefined>;