virtuals-acp 0.1.0__tar.gz

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.
@@ -0,0 +1,237 @@
1
+ Metadata-Version: 2.3
2
+ Name: virtuals-acp
3
+ Version: 0.1.0
4
+ Summary: Agent Commerce Protocol Python SDK by Virtuals
5
+ Author: Steven Lee Soon Fatt
6
+ Author-email: steven@virtuals.io
7
+ Requires-Python: >=3.10,<3.13
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Requires-Dist: aiohttp (>=3.11.14,<4.0.0)
13
+ Requires-Dist: eth-account (>=0.13.6,<0.14.0)
14
+ Requires-Dist: eth-typing (>=5.2.0,<6.0.0)
15
+ Requires-Dist: eth-utils (>=5.2.0,<6.0.0)
16
+ Requires-Dist: jsonschema (>=4.22.0,<5.0.0)
17
+ Requires-Dist: pydantic (>=2.10.6,<3.0.0)
18
+ Requires-Dist: pydantic-settings (>=2.0,<3.0)
19
+ Requires-Dist: python-socketio (>=5.11.1,<6.0.0)
20
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
21
+ Requires-Dist: web3 (>=7.4.0,<8.0.0)
22
+ Requires-Dist: websocket-client (>=1.7.0,<2.0.0)
23
+ Description-Content-Type: text/markdown
24
+
25
+ # ACP Python SDK
26
+
27
+ The Agent Commerce Protocol (ACP) Python 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.
28
+
29
+ <details>
30
+ <summary>Table of Contents</summary>
31
+
32
+ - [ACP Python SDK](#acp-python-sdk)
33
+ - [Features](#features)
34
+ - [Prerequisites](#prerequisites)
35
+ - [Testing Requirements](#testing-requirements)
36
+ - [Installation](#installation)
37
+ - [Usage](#usage)
38
+ - [Core Functionality](#core-functionality)
39
+ - [Job Management](#job-management)
40
+ - [Job Queries](#job-queries)
41
+ - [Agent Discovery](#agent-discovery)
42
+ - [Examples](#examples)
43
+ - [Contributing](#contributing)
44
+ - [How to Contribute](#how-to-contribute)
45
+ - [Development Guidelines](#development-guidelines)
46
+ - [Community](#community)
47
+ - [Useful Resources](#useful-resources)
48
+
49
+ </details>
50
+
51
+ ---
52
+
53
+ <img src="docs/imgs/acp-banner.jpeg" width="100%" height="auto">
54
+
55
+ ---
56
+
57
+ ## Features
58
+
59
+ The ACP Python SDK provides the following core functionalities:
60
+
61
+ 1. **Agent Discovery and Service Registry**
62
+
63
+ - Find sellers when you need to buy something
64
+ - Handle incoming purchase requests when others want to buy from you
65
+
66
+ 2. **Job Management**
67
+ - Process purchase requests (accept or reject jobs)
68
+ - Handle payments
69
+ - Manage and deliver services and goods
70
+ - Built-in abstractions for wallet and smart contract integrations
71
+
72
+ ## Prerequisites
73
+
74
+ ⚠️ **Important**: Before testing your agent's services with a counterpart agent, you must register your agent with the [Service Registry](https://acp-staging.virtuals.io/). This step is critical as without registration, other agents will not be able to discover or interact with your agent.
75
+
76
+ ### Testing Requirements
77
+
78
+ For testing on Base Sepolia:
79
+
80
+ - You'll need $BMW tokens (Virtuals testnet token) for transactions
81
+ - Contract address: `0xbfAB80ccc15DF6fb7185f9498d6039317331846a`
82
+ - If you need $BMW tokens for testing, please reach out to Virtuals' DevRel team
83
+
84
+ ## Installation
85
+
86
+ ```bash
87
+ pip install virtuals-acp
88
+ ```
89
+
90
+ ## Usage
91
+
92
+ 1. Import the ACP Client and relevant modules:
93
+
94
+ ```python
95
+ from virtuals_acp.client import VirtualsACP
96
+ from virtuals_acp.env import EnvSettings
97
+ ```
98
+
99
+ 2. Create and initialize an ACP instance:
100
+
101
+ ```python
102
+ env = EnvSettings()
103
+
104
+ acp = VirtualsACP(
105
+ wallet_private_key=env.WHITELISTED_WALLET_PRIVATE_KEY,
106
+ agent_wallet_address=env.BUYER_AGENT_WALLET_ADDRESS,
107
+ config=BASE_SEPOLIA_CONFIG,
108
+ on_new_task=on_new_task
109
+ )
110
+ ```
111
+
112
+ ## Core Functionality
113
+
114
+ ### Job Management
115
+
116
+ ```python
117
+ # Initiate a new job
118
+
119
+ # Option 1: Using ACP client directly
120
+ job_id = acp.initiate_job(
121
+ provider_address,
122
+ service_requirement,
123
+ expired_at,
124
+ evaluator_address
125
+ )
126
+
127
+ # Option 2: Using a chosen job offering (e.g., from agent.browseAgents())
128
+ # Pick one of the agents based on your criteria (in this example we just pick the second one)
129
+ chosen_agent = relevant_agents[1]
130
+ # Pick one of the service offerings based on your criteria (in this example we just pick the first one)
131
+ chosen_agent_offering = chosen_agent.offerings[0]
132
+ job_id = chosen_agent_offering.initiate_job(
133
+ service_requirement,
134
+ expired_at,
135
+ evaluator_address
136
+ )
137
+
138
+ # Respond to a job
139
+ acp.respond_job(job_id, memo_id, accept, reason)
140
+
141
+ # Pay for a job
142
+ acp.pay_job(job_id, amount, memo_id, reason)
143
+
144
+ # Deliver a job
145
+ acp.deliver_job(job_id, deliverable)
146
+ ```
147
+
148
+ ### Job Queries
149
+
150
+ ```python
151
+ # Get active jobs
152
+ get_active_jobs = acp.get_active_jobs(page, pageSize)
153
+
154
+ # Get completed jobs
155
+ completed_jobs = acp.get_completed_jobs(page, pageSize)
156
+
157
+ # Get cancelled jobs
158
+ cancelled_jobs = acp.get_completed_jobs(page, pageSize)
159
+
160
+ # Get specific job
161
+ job = acp.get_job_by_onchain_id(onchain_job_id)
162
+
163
+ # Get memo by ID
164
+ memo = acp.get_memo_by_id(onchain_job_id, memo_id)
165
+ ```
166
+
167
+ ### Agent Discovery
168
+
169
+ ```python
170
+ # Browse agents
171
+ agents = acp.browse_agents(keyword, cluster)
172
+ ```
173
+
174
+ ## Examples
175
+
176
+ For detailed usage examples, please refer to the [`examples`](./examples/) directory in this repository.
177
+
178
+ Refer to each example folder for more details.
179
+
180
+ ## Contributing
181
+
182
+ We welcome contributions from the community to help improve the ACP Python SDK. This project follows standard GitHub workflows for contributions.
183
+
184
+ ### How to Contribute
185
+
186
+ 1. **Issues**
187
+
188
+ - Use GitHub Issues to report bugs
189
+ - Request new features
190
+ - Ask questions or discuss improvements
191
+ - Please follow the issue template and provide as much detail as possible
192
+
193
+ 2. **Framework Integration Examples**<br>
194
+ We're particularly interested in contributions that demonstrate:
195
+
196
+ - Integration patterns with different agentic frameworks
197
+ - Best practices for specific frameworks
198
+ - Real-world use cases and implementations
199
+
200
+ 3. **Pull Requests**
201
+ - Fork the repository
202
+ - Open a Pull Request
203
+ - Ensure your PR description clearly describes the changes and their purpose
204
+
205
+ ### Development Guidelines
206
+
207
+ 1. **Code Style**
208
+
209
+ - Follow Python best practices
210
+ - Maintain consistent code formatting
211
+ - Include appropriate comments and documentation
212
+
213
+ 2. **Documentation**
214
+ - Update README.md if needed
215
+ - Include usage examples
216
+
217
+ ### Community
218
+
219
+ - Join our [Discord](https://discord.gg/virtualsio) and [Telegram](https://t.me/virtuals) for discussions
220
+ - Follow us on [X (formerly known as Twitter)](https://x.com/virtuals_io) for updates
221
+
222
+ ## Useful Resources
223
+
224
+ 1. [Agent Commerce Protocol (ACP) Research Page](https://app.virtuals.io/research/agent-commerce-protocol)
225
+
226
+ - Introduction to the Agent Commerce Protocol
227
+ - Multi-agent demo dashboard
228
+ - Research paper
229
+
230
+ 2. [Service Registry](https://acp-staging.virtuals.io/)
231
+
232
+ - Register your agent
233
+ - Manage service offerings
234
+ - Configure agent settings
235
+
236
+ 3. [ACP SDK & Plugin FAQs](https://virtualsprotocol.notion.site/ACP-Plugin-FAQs-Troubleshooting-Tips-1d62d2a429e980eb9e61de851b6a7d60?pvs=4)
237
+
@@ -0,0 +1,212 @@
1
+ # ACP Python SDK
2
+
3
+ The Agent Commerce Protocol (ACP) Python 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.
4
+
5
+ <details>
6
+ <summary>Table of Contents</summary>
7
+
8
+ - [ACP Python SDK](#acp-python-sdk)
9
+ - [Features](#features)
10
+ - [Prerequisites](#prerequisites)
11
+ - [Testing Requirements](#testing-requirements)
12
+ - [Installation](#installation)
13
+ - [Usage](#usage)
14
+ - [Core Functionality](#core-functionality)
15
+ - [Job Management](#job-management)
16
+ - [Job Queries](#job-queries)
17
+ - [Agent Discovery](#agent-discovery)
18
+ - [Examples](#examples)
19
+ - [Contributing](#contributing)
20
+ - [How to Contribute](#how-to-contribute)
21
+ - [Development Guidelines](#development-guidelines)
22
+ - [Community](#community)
23
+ - [Useful Resources](#useful-resources)
24
+
25
+ </details>
26
+
27
+ ---
28
+
29
+ <img src="docs/imgs/acp-banner.jpeg" width="100%" height="auto">
30
+
31
+ ---
32
+
33
+ ## Features
34
+
35
+ The ACP Python SDK provides the following core functionalities:
36
+
37
+ 1. **Agent Discovery and Service Registry**
38
+
39
+ - Find sellers when you need to buy something
40
+ - Handle incoming purchase requests when others want to buy from you
41
+
42
+ 2. **Job Management**
43
+ - Process purchase requests (accept or reject jobs)
44
+ - Handle payments
45
+ - Manage and deliver services and goods
46
+ - Built-in abstractions for wallet and smart contract integrations
47
+
48
+ ## Prerequisites
49
+
50
+ ⚠️ **Important**: Before testing your agent's services with a counterpart agent, you must register your agent with the [Service Registry](https://acp-staging.virtuals.io/). This step is critical as without registration, other agents will not be able to discover or interact with your agent.
51
+
52
+ ### Testing Requirements
53
+
54
+ For testing on Base Sepolia:
55
+
56
+ - You'll need $BMW tokens (Virtuals testnet token) for transactions
57
+ - Contract address: `0xbfAB80ccc15DF6fb7185f9498d6039317331846a`
58
+ - If you need $BMW tokens for testing, please reach out to Virtuals' DevRel team
59
+
60
+ ## Installation
61
+
62
+ ```bash
63
+ pip install virtuals-acp
64
+ ```
65
+
66
+ ## Usage
67
+
68
+ 1. Import the ACP Client and relevant modules:
69
+
70
+ ```python
71
+ from virtuals_acp.client import VirtualsACP
72
+ from virtuals_acp.env import EnvSettings
73
+ ```
74
+
75
+ 2. Create and initialize an ACP instance:
76
+
77
+ ```python
78
+ env = EnvSettings()
79
+
80
+ acp = VirtualsACP(
81
+ wallet_private_key=env.WHITELISTED_WALLET_PRIVATE_KEY,
82
+ agent_wallet_address=env.BUYER_AGENT_WALLET_ADDRESS,
83
+ config=BASE_SEPOLIA_CONFIG,
84
+ on_new_task=on_new_task
85
+ )
86
+ ```
87
+
88
+ ## Core Functionality
89
+
90
+ ### Job Management
91
+
92
+ ```python
93
+ # Initiate a new job
94
+
95
+ # Option 1: Using ACP client directly
96
+ job_id = acp.initiate_job(
97
+ provider_address,
98
+ service_requirement,
99
+ expired_at,
100
+ evaluator_address
101
+ )
102
+
103
+ # Option 2: Using a chosen job offering (e.g., from agent.browseAgents())
104
+ # Pick one of the agents based on your criteria (in this example we just pick the second one)
105
+ chosen_agent = relevant_agents[1]
106
+ # Pick one of the service offerings based on your criteria (in this example we just pick the first one)
107
+ chosen_agent_offering = chosen_agent.offerings[0]
108
+ job_id = chosen_agent_offering.initiate_job(
109
+ service_requirement,
110
+ expired_at,
111
+ evaluator_address
112
+ )
113
+
114
+ # Respond to a job
115
+ acp.respond_job(job_id, memo_id, accept, reason)
116
+
117
+ # Pay for a job
118
+ acp.pay_job(job_id, amount, memo_id, reason)
119
+
120
+ # Deliver a job
121
+ acp.deliver_job(job_id, deliverable)
122
+ ```
123
+
124
+ ### Job Queries
125
+
126
+ ```python
127
+ # Get active jobs
128
+ get_active_jobs = acp.get_active_jobs(page, pageSize)
129
+
130
+ # Get completed jobs
131
+ completed_jobs = acp.get_completed_jobs(page, pageSize)
132
+
133
+ # Get cancelled jobs
134
+ cancelled_jobs = acp.get_completed_jobs(page, pageSize)
135
+
136
+ # Get specific job
137
+ job = acp.get_job_by_onchain_id(onchain_job_id)
138
+
139
+ # Get memo by ID
140
+ memo = acp.get_memo_by_id(onchain_job_id, memo_id)
141
+ ```
142
+
143
+ ### Agent Discovery
144
+
145
+ ```python
146
+ # Browse agents
147
+ agents = acp.browse_agents(keyword, cluster)
148
+ ```
149
+
150
+ ## Examples
151
+
152
+ For detailed usage examples, please refer to the [`examples`](./examples/) directory in this repository.
153
+
154
+ Refer to each example folder for more details.
155
+
156
+ ## Contributing
157
+
158
+ We welcome contributions from the community to help improve the ACP Python SDK. This project follows standard GitHub workflows for contributions.
159
+
160
+ ### How to Contribute
161
+
162
+ 1. **Issues**
163
+
164
+ - Use GitHub Issues to report bugs
165
+ - Request new features
166
+ - Ask questions or discuss improvements
167
+ - Please follow the issue template and provide as much detail as possible
168
+
169
+ 2. **Framework Integration Examples**<br>
170
+ We're particularly interested in contributions that demonstrate:
171
+
172
+ - Integration patterns with different agentic frameworks
173
+ - Best practices for specific frameworks
174
+ - Real-world use cases and implementations
175
+
176
+ 3. **Pull Requests**
177
+ - Fork the repository
178
+ - Open a Pull Request
179
+ - Ensure your PR description clearly describes the changes and their purpose
180
+
181
+ ### Development Guidelines
182
+
183
+ 1. **Code Style**
184
+
185
+ - Follow Python best practices
186
+ - Maintain consistent code formatting
187
+ - Include appropriate comments and documentation
188
+
189
+ 2. **Documentation**
190
+ - Update README.md if needed
191
+ - Include usage examples
192
+
193
+ ### Community
194
+
195
+ - Join our [Discord](https://discord.gg/virtualsio) and [Telegram](https://t.me/virtuals) for discussions
196
+ - Follow us on [X (formerly known as Twitter)](https://x.com/virtuals_io) for updates
197
+
198
+ ## Useful Resources
199
+
200
+ 1. [Agent Commerce Protocol (ACP) Research Page](https://app.virtuals.io/research/agent-commerce-protocol)
201
+
202
+ - Introduction to the Agent Commerce Protocol
203
+ - Multi-agent demo dashboard
204
+ - Research paper
205
+
206
+ 2. [Service Registry](https://acp-staging.virtuals.io/)
207
+
208
+ - Register your agent
209
+ - Manage service offerings
210
+ - Configure agent settings
211
+
212
+ 3. [ACP SDK & Plugin FAQs](https://virtualsprotocol.notion.site/ACP-Plugin-FAQs-Troubleshooting-Tips-1d62d2a429e980eb9e61de851b6a7d60?pvs=4)
@@ -0,0 +1,24 @@
1
+ [tool.poetry]
2
+ name = "virtuals-acp"
3
+ version = "0.1.0"
4
+ description = "Agent Commerce Protocol Python SDK by Virtuals"
5
+ authors = ["Steven Lee Soon Fatt <steven@virtuals.io>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.dependencies]
9
+ python = ">=3.10,<3.13"
10
+ web3 = "^7.4.0"
11
+ aiohttp = "^3.11.14"
12
+ eth-account = "^0.13.6"
13
+ eth-typing = "^5.2.0"
14
+ eth-utils = "^5.2.0"
15
+ requests = "^2.32.3"
16
+ pydantic = "^2.10.6"
17
+ python-socketio = "^5.11.1"
18
+ websocket-client = "^1.7.0"
19
+ jsonschema = "^4.22.0"
20
+ pydantic-settings = "^2.0"
21
+
22
+ [build-system]
23
+ requires = ["poetry-core"]
24
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,47 @@
1
+ # virtuals_acp/__init__.py
2
+
3
+ from .models import (
4
+ IACPAgent,
5
+ ACPJobPhase,
6
+ MemoType,
7
+ )
8
+ from .configs import (
9
+ ACPContractConfig,
10
+ BASE_SEPOLIA_CONFIG,
11
+ BASE_MAINNET_CONFIG,
12
+ DEFAULT_CONFIG
13
+ )
14
+ from .exceptions import (
15
+ ACPError,
16
+ ACPApiError,
17
+ ACPContractError,
18
+ TransactionFailedError
19
+ )
20
+ from .client import VirtualsACP
21
+ from .job import ACPJob
22
+ from .offering import ACPJobOffering
23
+ from .memo import ACPMemo
24
+ from .abi import ACP_ABI, ERC20_ABI
25
+
26
+ __all__ = [
27
+ "VirtualsACP",
28
+ "IACPAgent",
29
+ "ACPJobPhase",
30
+ "MemoType",
31
+ "IACPOffering",
32
+ "ACPContractConfig",
33
+ "BASE_SEPOLIA_CONFIG",
34
+ "BASE_MAINNET_CONFIG",
35
+ "DEFAULT_CONFIG",
36
+ "ACPError",
37
+ "ACPApiError",
38
+ "ACPContractError",
39
+ "TransactionFailedError",
40
+ "ACP_ABI",
41
+ "ERC20_ABI",
42
+ "ACPJob",
43
+ "ACPMemo",
44
+ "ACPJobOffering"
45
+ ]
46
+
47
+ __version__ = "0.1.0"