Skip to content

Commit e299291

Browse files
committed
docs: update main README
1 parent b1ea5e0 commit e299291

1 file changed

Lines changed: 54 additions & 221 deletions

File tree

README.md

Lines changed: 54 additions & 221 deletions
Original file line numberDiff line numberDiff line change
@@ -8,75 +8,34 @@ The Agent Commerce Protocol (ACP) Node SDK is a modular, agentic-framework-agnos
88
- [ACP Node SDK](#acp-node-sdk)
99
- [Features](#features)
1010
- [Prerequisites](#prerequisites)
11-
- [Testing Flow](#testing-flow)
12-
- [1. Register a New Agent](#1-register-a-new-agent)
13-
- [2. Create Smart Wallet and Whitelist Dev Wallet](#2-create-smart-wallet-and-whitelist-dev-wallet)
14-
- [3. Use Skip-Evaluation Flow to Test the Full Job Lifecycle](#3-use-skip-evaluation-flow-to-test-the-full-job-lifecycle)
15-
- [4. Fund Your Test Agent](#4-fund-your-test-agent)
16-
- [5. Run Your Test Agent](#5-run-your-test-agent)
17-
- [6. Set up your buyer agent search keyword.](#6-set-up-your-buyer-agent-search-keyword)
1811
- [Installation](#installation)
1912
- [Usage](#usage)
2013
- [Core Functionality](#core-functionality)
2114
- [Agent Discovery](#agent-discovery)
2215
- [Job Management](#job-management)
23-
- [Job Queries (Helper Functions)](#job-queries-helper-functions)
16+
- [Job Queries](#job-queries)
2417
- [Examples](#examples)
2518
- [Contributing](#contributing)
26-
- [How to Contribute](#how-to-contribute)
27-
- [Development Guidelines](#development-guidelines)
28-
- [Community](#community)
2919
- [Useful Resources](#useful-resources)
3020

3121
</details>
3222

3323
---
3424

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">
25+
<img src="https://github.com/Virtual-Protocol/acp-node/raw/main/docs/imgs/acp-banner.jpeg" width="100%" height="auto" alt="acp-banner">
3626

3727
---
3828

3929
## Features
4030

41-
The ACP Node SDK provides the following core functionalities:
42-
43-
1. **Agent Discovery and Service Registry**
44-
- Find sellers when you need to buy something
45-
- Handle incoming purchase requests when others want to buy from you
46-
47-
2. **Job Management**
48-
- Process purchase requests (accept or reject jobs)
49-
- Handle payments
50-
- Manage and deliver services and goods
51-
- Built-in abstractions for wallet and smart contract integrations
31+
- **Agent Discovery and Service Registry** — Find sellers when you need to buy; handle incoming purchase requests when others want to buy from you.
32+
- **Job Management** — Process purchase requests (accept or reject), handle payments, manage and deliver services and goods, with built-in wallet and smart contract abstractions.
5233

5334
## Prerequisites
5435

55-
⚠️ **Important**: Before testing your agent's services with a counterpart agent, you must register your agent with the [Service Registry](https://app.virtuals.io/acp/join). This step is critical as without registration, other agents will not be able to discover or interact with your agent.
56-
57-
### Testing Flow
58-
#### 1. Register a New 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-
- 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-
- The seller agent should be your actual agent, the one you intend to make live on the ACP platform.
62-
63-
#### 2. Create Smart Wallet and Whitelist Dev Wallet
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-
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)
36+
Before testing with another agent, register your agent with the [Service Registry](https://app.virtuals.io/acp/join). Without registration, other agents cannot discover or interact with yours.
6837

69-
#### 4. Fund Your Test Agent
70-
- Top up your test buyer agent with $USDC. Gas fee is sponsored, ETH is not required.
71-
- It is recommended to set the service price of the seller agent to $0.01 for testing purposes.
72-
73-
#### 5. Run Your Test Agent
74-
- Set up your environment variables correctly (private key, wallet address, entity ID, etc.)
75-
- When inserting `WHITELISTED_WALLET_PRIVATE_KEY`, you need to include the 0x prefix.
76-
77-
#### 6. Set up your buyer agent search keyword.
78-
- Run your agent script.
79-
- Note: Your agent will only appear in the sandbox after it has initiated at least 1 job request.
38+
For a step-by-step testing flow (register agent, create smart wallet, whitelist dev wallet, fund agent, run buyer/seller), see the [acp-base examples](./examples/acp-base/README.md#testing-flow).
8039

8140
## Installation
8241

@@ -86,215 +45,89 @@ npm install @virtuals-protocol/acp-node
8645

8746
## Usage
8847

89-
1. Import the ACP Client:
48+
Import the client, build the contract client, and create an `AcpClient`:
9049

9150
```typescript
9251
import AcpClient, { AcpContractClientV2 } from "@virtuals-protocol/acp-node";
93-
```
9452

95-
2. Create and initialize an ACP instance:
96-
97-
```typescript
9853
const acpClient = new AcpClient({
9954
acpContractClient: await AcpContractClientV2.build(
100-
"<wallet-private-key>",
101-
"<session-entity-key-id>",
102-
"<agent-wallet-address>",
103-
"<custom-rpc-url>", // Optional custom RPC for gas fee estimates
104-
"<config>" // Optional chain config
55+
"<wallet-private-key>",
56+
"<session-entity-key-id>",
57+
"<agent-wallet-address>",
58+
"<custom-rpc-url>", // optional – avoids rate limits and improves gas estimates
59+
"<config>" // optional – chain config; default is Base mainnet
10560
),
106-
onNewTask: (job: AcpJob) => void, // Optional callback for new tasks
107-
onEvaluate: (job: AcpJob) => void // Optional callback for job evaluation
61+
onNewTask: (job: AcpJob) => void, // optional
62+
onEvaluate: (job: AcpJob) => void // optional
10863
});
109-
```
110-
- Note on `<custom-rpc-url>`
111-
- The RPC url helps avoid rate limits and ensures accurate gas estimates during high-volume activity.
112-
- 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](https://viem.sh/docs/clients/transports/http.html#usage)
113-
- For popular agents with a high volume of job requests, we recommend passing in a custom RPC endpoint to prevent any rate-limit throttling.
114-
115-
- Note on `<config>`
116-
- This refers to the config used for ACP
117-
- Default would be the Base mainnet production config
118-
119-
3. Initialize the client:
12064

121-
```typescript
12265
await acpClient.init();
12366
```
12467

68+
For full setup, environment variables, and runnable code, see [examples/acp-base](./examples/acp-base).
69+
12570
## Core Functionality
12671

12772
### Agent Discovery
128-
`browseAgents()` follows this multi-stage pipeline:
129-
1. Cluster Filter
130-
- Agents are filtered by the cluster tag if provided.
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
142-
- The ranked agent list is truncated to return only the top k number of results.
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).
15973

160-
```typescript
161-
// Matching (and sorting) via embedding similarity, followed by sorting using agent metrics
162-
const relevantAgents = await acpClient.browseAgents(
163-
"<your-filter-agent-keyword>",
164-
{
165-
sortBy: [AcpAgentSort.SUCCESSFUL_JOB_COUNT],
166-
topK: 5,
167-
graduationStatus: AcpGraduationStatus.ALL,
168-
onlineStatus: AcpOnlineStatus.ALL,
169-
showHiddenOfferings: true,
170-
}
171-
);
172-
```
74+
`browseAgents()` uses a multi-stage pipeline:
17375

174-
### Job Management
76+
1. **Cluster filter** — Filter by cluster tag if provided.
77+
2. **Hybrid search** — Keyword and embedding search, then reranker.
78+
3. **Sort options** (`sortBy`) — e.g. `SUCCESSFUL_JOB_COUNT`, `SUCCESS_RATE`, `UNIQUE_BUYER_COUNT`, `MINS_FROM_LAST_ONLINE`, `GRADUATION_STATUS`, `ONLINE_STATUS`.
79+
4. **Top-K** — Return only the top k results.
80+
5. **Filters**`graduationStatus` (e.g. `GRADUATED`, `NOT_GRADUATED`, `ALL`), `onlineStatus` (`ONLINE`, `OFFLINE`, `ALL`), `showHiddenOfferings` (boolean).
17581

176-
```typescript
177-
// Initiate a new job
178-
179-
// Option 1: Using ACP client directly
180-
const jobId = await acpClient.initiateJob(
181-
providerAddress,
182-
serviceRequirement,
183-
fareAmount,
184-
evaluatorAddress,
185-
expiredAt,
186-
);
187-
188-
// Option 2: Using a chosen job offering (e.g., from agent.browseAgents() from Agent Discovery Section)
189-
// Pick one of the agents based on your criteria (in this example we just pick the second one)
190-
const chosenAgent = relevantAgents[1];
191-
// Pick one of the service offerings based on your criteria (in this example we just pick the first one)
192-
const chosenJobOffering = chosenAgent.offerings[0]
193-
const jobId = await chosenJobOffering.initiateJob(
194-
serviceRequirement,
195-
evaluatorAddress,
196-
expiredAt,
197-
);
198-
199-
// Respond to a job
200-
await job.accept(reason);
201-
await job.createRequirement("Please make payment to produce deliverable.");
202-
// or
203-
await job.reject(reason);
204-
205-
// Pay for a job
206-
await job.payAndAcceptRequirement();
207-
208-
// Deliver a job
209-
await job.deliver(deliverable);
210-
```
82+
See [Agent Discovery](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide) for graduation and online status. For code, see [examples/acp-base](./examples/acp-base) (e.g. skip-evaluation buyer).
21183

212-
### Job Queries (Helper Functions)
84+
### Job Management
21385

214-
```typescript
215-
// Get active jobs
216-
const activeJobs = await acpClient.getActiveJobs(page, pageSize);
86+
- **Initiate jobs** — Via `acpClient.initiateJob(...)` or a chosen job offering’s `initiateJob(...)`.
87+
- **Respond**`job.accept(reason)`, `job.createRequirement(...)`, or `job.reject(reason)`.
88+
- **Pay**`job.payAndAcceptRequirement()`.
89+
- **Deliver**`job.deliver(deliverable)`.
21790

218-
// Get completed jobs
219-
const completedJobs = await acpClient.getCompletedJobs(page, pageSize);
91+
For full flows (skip-evaluation, external evaluation, polling, funds), see [examples/acp-base](./examples/acp-base).
22092

221-
// Get cancelled jobs
222-
const cancelledJobs = await acpClient.getCancelledJobs(page, pageSize);
93+
### Job Queries
22394

224-
// Get specific job
225-
const job = await acpClient.getJobById(jobId);
95+
- `acpClient.getActiveJobs(page, pageSize)`
96+
- `acpClient.getCompletedJobs(page, pageSize)`
97+
- `acpClient.getCancelledJobs(page, pageSize)`
98+
- `acpClient.getJobById(jobId)`
99+
- `acpClient.getMemoById(jobId, memoId)`
226100

227-
// Get memo by ID
228-
const memo = await acpClient.getMemoById(jobId, memoId);
229-
```
101+
For usage examples, see [examples/acp-base/helpers](./examples/acp-base/helpers/).
230102

231103
## Examples
232104

233-
For detailed usage examples, please refer to the [`examples`](./examples/) directory in this repository.
234-
235-
Refer to each example folder for more details.
236-
237-
## Contributing
238-
239-
We welcome contributions from the community to help improve the ACP Node SDK. This project follows standard GitHub workflows for contributions.
240-
241-
### How to Contribute
105+
All runnable code examples live under **[`examples/acp-base`](./examples/acp-base)**:
242106

243-
1. **Issues**
244-
- Use GitHub Issues to report bugs
245-
- Request new features
246-
- Ask questions or discuss improvements
247-
- Please follow the issue template and provide as much detail as possible
107+
| Example | Description |
108+
|--------|-------------|
109+
| [skip-evaluation](./examples/acp-base/skip-evaluation) | Full job lifecycle without an evaluator (buyer + seller). |
110+
| [external-evaluation](./examples/acp-base/external-evaluation) | Buyer, seller, and external evaluator. |
111+
| [polling-mode](./examples/acp-base/polling-mode) | Polling instead of callbacks for new tasks. |
112+
| [funds](./examples/acp-base/funds) | Trading, prediction market, and related fund flows. |
113+
| [helpers](./examples/acp-base/helpers) | Shared utilities for ACP operations. |
114+
| [cross-chain-transfer-service](./examples/acp-base/cross-chain-transfer-service) | Cross-chain transfer service pattern. |
248115

249-
2. **Framework Integration Examples**<br>
250-
We're particularly interested in contributions that demonstrate:
251-
- Integration patterns with different agentic frameworks
252-
- Best practices for specific frameworks
253-
- Real-world use cases and implementations
116+
See [examples/acp-base/README.md](./examples/acp-base/README.md) for setup, env vars, and running each example.
254117

255-
3. **Pull Requests**
256-
- Fork the repository
257-
- Open a Pull Request
258-
- Ensure your PR description clearly describes the changes and their purpose
259-
260-
### Development Guidelines
261-
262-
1. **Code Style**
263-
- Follow TypeScript best practices
264-
- Maintain consistent code formatting
265-
- Include appropriate comments and documentation
118+
## Contributing
266119

267-
2. **Documentation**
268-
- Update README.md if needed
269-
- Include usage examples
120+
We welcome contributions. Please use GitHub Issues for bugs and feature requests, and open Pull Requests with clear descriptions. We’re especially interested in framework integration examples and best practices.
270121

271-
### Community
122+
- **Code style** — TypeScript best practices, consistent formatting, clear comments.
123+
- **Docs** — Update README and add examples where relevant.
272124

273-
- Join our [Discord](https://discord.gg/virtualsio) and [Telegram](https://t.me/virtuals) for discussions
274-
- Follow us on [X (formerly known as Twitter)](https://x.com/virtuals_io) for updates
125+
**Community:** [Discord](https://discord.gg/virtualsio) · [Telegram](https://t.me/virtuals) · [X (Twitter)](https://x.com/virtuals_io)
275126

276127
## Useful Resources
277128

278-
1. [ACP Dev Onboarding Guide](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide)
279-
- A comprehensive playbook covering **all onboarding steps and tutorials**:
280-
- Create your agent and whitelist developer wallets
281-
- Explore SDK & plugin resources for seamless integration
282-
- Understand ACP job lifecycle and best prompting practices
283-
- Learn the difference between graduated and pre-graduated agents
284-
- Review SLA, status indicators, and supporting articles
285-
- Designed to help builders have their agent **ready for test interactions** on the ACP platform.
286-
129+
1. [ACP Dev Onboarding Guide](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide) — Agent setup, wallet whitelist, job lifecycle, graduation, SLA.
287130
2. [Agent Registry](https://app.virtuals.io/acp/join)
288-
289-
290-
3. [Agent Commerce Protocol (ACP) research page](https://app.virtuals.io/research/agent-commerce-protocol)
291-
- This webpage introduces the Agent Commerce Protocol - A Standard for Permissionless AI Agent Commerce, a piece of research done by the Virtuals Protocol team
292-
- It includes the links to the multi-agent demo dashboard and paper.
293-
294-
295-
4. [ACP Tips & Troubleshooting](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide/tips-and-troubleshooting)
296-
- Comprehensive FAQ section covering common plugin questions—everything from installation and configuration to key API usage patterns.
297-
- Step-by-step troubleshooting tips for resolving frequent errors like incomplete deliverable evaluations and wallet credential issues.
298-
131+
3. [Agent Commerce Protocol (ACP) research](https://app.virtuals.io/research/agent-commerce-protocol) — Protocol overview and multi-agent demo.
132+
4. [ACP Tips & Troubleshooting](https://whitepaper.virtuals.io/acp-product-resources/acp-dev-onboarding-guide/tips-and-troubleshooting) — FAQ and common errors.
299133
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.

0 commit comments

Comments
 (0)