@virtuals-protocol/acp-node 0.3.0-beta.2 → 0.3.0-beta.21
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 +53 -46
- package/dist/index.d.mts +451 -275
- package/dist/index.d.ts +451 -275
- package/dist/index.js +4872 -3168
- package/dist/index.mjs +4895 -3173
- package/package.json +19 -5
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
|
|
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/
|
|
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/
|
|
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
|
|
67
|
-
- ACP Node SDK (
|
|
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
|
|
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
|
|
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
|
|
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
|
-
`
|
|
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.
|
|
132
|
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
|
|
136
|
-
|
|
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.
|
|
139
|
-
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
|
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
|
|
206
|
+
await job.payAndAcceptRequirement();
|
|
203
207
|
|
|
204
208
|
// Deliver a job
|
|
205
|
-
await
|
|
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
|
|
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
|
|
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.
|