agent0-sdk 0.2.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.
- agent0_sdk-0.2.0/LICENSE +22 -0
- agent0_sdk-0.2.0/PKG-INFO +308 -0
- agent0_sdk-0.2.0/README.md +237 -0
- agent0_sdk-0.2.0/agent0_sdk/__init__.py +52 -0
- agent0_sdk-0.2.0/agent0_sdk/core/agent.py +860 -0
- agent0_sdk-0.2.0/agent0_sdk/core/contracts.py +490 -0
- agent0_sdk-0.2.0/agent0_sdk/core/endpoint_crawler.py +270 -0
- agent0_sdk-0.2.0/agent0_sdk/core/feedback_manager.py +923 -0
- agent0_sdk-0.2.0/agent0_sdk/core/indexer.py +1016 -0
- agent0_sdk-0.2.0/agent0_sdk/core/ipfs_client.py +355 -0
- agent0_sdk-0.2.0/agent0_sdk/core/models.py +311 -0
- agent0_sdk-0.2.0/agent0_sdk/core/sdk.py +842 -0
- agent0_sdk-0.2.0/agent0_sdk/core/subgraph_client.py +813 -0
- agent0_sdk-0.2.0/agent0_sdk/core/web3_client.py +192 -0
- agent0_sdk-0.2.0/agent0_sdk.egg-info/PKG-INFO +308 -0
- agent0_sdk-0.2.0/agent0_sdk.egg-info/SOURCES.txt +30 -0
- agent0_sdk-0.2.0/agent0_sdk.egg-info/dependency_links.txt +1 -0
- agent0_sdk-0.2.0/agent0_sdk.egg-info/requires.txt +27 -0
- agent0_sdk-0.2.0/agent0_sdk.egg-info/top_level.txt +4 -0
- agent0_sdk-0.2.0/pyproject.toml +86 -0
- agent0_sdk-0.2.0/setup.cfg +4 -0
- agent0_sdk-0.2.0/tests/__init__.py +1 -0
- agent0_sdk-0.2.0/tests/config.py +46 -0
- agent0_sdk-0.2.0/tests/conftest.py +22 -0
- agent0_sdk-0.2.0/tests/test_feedback.py +417 -0
- agent0_sdk-0.2.0/tests/test_models.py +224 -0
- agent0_sdk-0.2.0/tests/test_real_public_servers.py +103 -0
- agent0_sdk-0.2.0/tests/test_registration.py +267 -0
- agent0_sdk-0.2.0/tests/test_registrationIpfs.py +227 -0
- agent0_sdk-0.2.0/tests/test_sdk.py +238 -0
- agent0_sdk-0.2.0/tests/test_search.py +271 -0
- agent0_sdk-0.2.0/tests/test_transfer.py +255 -0
agent0_sdk-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Marco De Rossi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent0-sdk
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Python SDK for agent portability, discovery and trust based on ERC-8004
|
|
5
|
+
Author-email: Marco De Rossi <marco.derossi@consensys.net>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Marco De Rossi
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://sdk.ag0.xyz
|
|
30
|
+
Project-URL: Repository, https://github.com/agent0lab/agent0-py
|
|
31
|
+
Project-URL: Documentation, https://sdk.ag0.xyz
|
|
32
|
+
Project-URL: Source Code, https://github.com/agent0lab/agent0-py
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
42
|
+
Requires-Python: >=3.8
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
License-File: LICENSE
|
|
45
|
+
Requires-Dist: web3>=6.0.0
|
|
46
|
+
Requires-Dist: eth-account>=0.8.0
|
|
47
|
+
Requires-Dist: requests>=2.28.0
|
|
48
|
+
Requires-Dist: pydantic>=2.0.0
|
|
49
|
+
Requires-Dist: ipfshttpclient>=0.8.0a2
|
|
50
|
+
Requires-Dist: numpy>=1.21.0
|
|
51
|
+
Requires-Dist: scikit-learn>=1.0.0
|
|
52
|
+
Requires-Dist: sentence-transformers>=2.2.0
|
|
53
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
54
|
+
Requires-Dist: asyncio-throttle>=1.0.0
|
|
55
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
56
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
57
|
+
Provides-Extra: dev
|
|
58
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
59
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
60
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
61
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
62
|
+
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
63
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
64
|
+
Requires-Dist: flake8>=5.0.0; extra == "dev"
|
|
65
|
+
Provides-Extra: test
|
|
66
|
+
Requires-Dist: pytest>=7.0.0; extra == "test"
|
|
67
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
|
|
68
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
|
|
69
|
+
Requires-Dist: pytest-mock>=3.10.0; extra == "test"
|
|
70
|
+
Dynamic: license-file
|
|
71
|
+
|
|
72
|
+
# Agent0 SDK
|
|
73
|
+
|
|
74
|
+
Python SDK for agent portability, discovery and trust based on ERC-8004.
|
|
75
|
+
|
|
76
|
+
Agent0 is the SDK for agentic economies. It enables agents to register, advertise their capabilities and how to communicate with them, and give each other feedback and reputation signals. All this using blockchain infrastructure (ERC-8004) and decentralized storage, enabling permissionless discovery without relying on proprietary catalogues or intermediaries.
|
|
77
|
+
|
|
78
|
+
## What Does Agent0 SDK Do?
|
|
79
|
+
|
|
80
|
+
Agent0 SDK v0.2 enables you to:
|
|
81
|
+
|
|
82
|
+
- **Create and manage agent identities** - Register your AI agent on-chain with a unique identity, configure presentation fields (name, description, image), set wallet addresses, and manage trust models with x402 support
|
|
83
|
+
- **Advertise agent capabilities** - Publish MCP and A2A endpoints, with automated extraction of MCP tools and A2A skills from endpoints
|
|
84
|
+
- **Enable permissionless discovery** - Make your agent discoverable by other agents and platforms using rich search by attributes, capabilities, skills, tools, tasks, and x402 support
|
|
85
|
+
- **Build reputation** - Give and receive feedback, retrieve feedback history, and search agents by reputation with cryptographic authentication
|
|
86
|
+
- **Cross-chain registration** - One-line registration with IPFS nodes, Pinata, Filecoin, or HTTP URIs
|
|
87
|
+
- **Public indexing** - Subgraph indexing both on-chain and IPFS data for fast search and retrieval
|
|
88
|
+
|
|
89
|
+
## ⚠️ Alpha Release
|
|
90
|
+
|
|
91
|
+
Agent0 SDK v0.2 is in **alpha** with bugs and is not production ready. We're actively testing and improving it.
|
|
92
|
+
|
|
93
|
+
**Bug reports & feedback:** GitHub: [Report issues](https://github.com/agent0lab/agent0-py/issues) | Telegram: [@marcoderossi](https://t.me/marcoderossi) | Email: marco.derossi@consensys.net
|
|
94
|
+
|
|
95
|
+
## Installation
|
|
96
|
+
|
|
97
|
+
### Prerequisites
|
|
98
|
+
|
|
99
|
+
- Python 3.8 or higher
|
|
100
|
+
- pip package manager
|
|
101
|
+
- Private key for signing transactions (or run in read-only mode)
|
|
102
|
+
- Access to an Ethereum RPC endpoint (e.g., Alchemy, Infura)
|
|
103
|
+
- (Optional) IPFS provider account (Pinata, Filecoin, or local IPFS node)
|
|
104
|
+
|
|
105
|
+
### Install from PyPI
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pip install agent0-sdk
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Install from Source
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git clone https://github.com/agent0lab/agent0-py.git
|
|
115
|
+
cd agent0-py
|
|
116
|
+
pip install -e .
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Quick Start
|
|
120
|
+
|
|
121
|
+
### 1. Initialize SDK
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from agent0_sdk import SDK
|
|
125
|
+
import os
|
|
126
|
+
|
|
127
|
+
# Initialize SDK with IPFS and subgraph
|
|
128
|
+
sdk = SDK(
|
|
129
|
+
chainId=11155111, # Ethereum Sepolia testnet
|
|
130
|
+
rpcUrl=os.getenv("RPC_URL"),
|
|
131
|
+
signer=os.getenv("PRIVATE_KEY"),
|
|
132
|
+
ipfs="pinata", # Options: "pinata", "filecoinPin", "node"
|
|
133
|
+
pinataJwt=os.getenv("PINATA_JWT") # For Pinata
|
|
134
|
+
# Subgraph URL auto-defaults from DEFAULT_SUBGRAPH_URLS
|
|
135
|
+
)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 2. Create and Register Agent
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
# Create agent
|
|
142
|
+
agent = sdk.createAgent(
|
|
143
|
+
name="My AI Agent",
|
|
144
|
+
description="An intelligent assistant for various tasks. Skills: data analysis, code generation.",
|
|
145
|
+
image="https://example.com/agent-image.png"
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
# Configure endpoints (automatically extracts capabilities)
|
|
149
|
+
agent.setMCP("https://mcp.example.com/") # Extracts tools, prompts, resources
|
|
150
|
+
agent.setA2A("https://a2a.example.com/agent-card.json") # Extracts skills
|
|
151
|
+
agent.setENS("myagent.eth")
|
|
152
|
+
|
|
153
|
+
# Configure wallet and trust
|
|
154
|
+
agent.setAgentWallet("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", chainId=11155111)
|
|
155
|
+
agent.setTrust(reputation=True, cryptoEconomic=True)
|
|
156
|
+
|
|
157
|
+
# Add metadata and set status
|
|
158
|
+
agent.setMetadata({"version": "1.0.0", "category": "ai-assistant"})
|
|
159
|
+
agent.setActive(True)
|
|
160
|
+
|
|
161
|
+
# Register on-chain with IPFS
|
|
162
|
+
agent.registerIPFS()
|
|
163
|
+
print(f"Agent registered: {agent.agentId}") # e.g., "11155111:123"
|
|
164
|
+
print(f"Agent URI: {agent.agentURI}") # e.g., "ipfs://Qm..."
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 3. Load and Edit Agent
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
# Load existing agent for editing
|
|
171
|
+
agent = sdk.loadAgent("11155111:123") # Format: "chainId:agentId"
|
|
172
|
+
|
|
173
|
+
# Edit agent properties
|
|
174
|
+
agent.updateInfo(description="Updated description with new capabilities")
|
|
175
|
+
agent.setMCP("https://new-mcp.example.com/")
|
|
176
|
+
|
|
177
|
+
# Re-register to update on-chain
|
|
178
|
+
agent.registerIPFS()
|
|
179
|
+
print(f"Updated: {agent.agentURI}")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 4. Search Agents
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
# Search by name, capabilities, or attributes
|
|
186
|
+
results = sdk.searchAgents(
|
|
187
|
+
name="AI", # Substring search
|
|
188
|
+
mcpTools=["code_generation"], # Specific MCP tools
|
|
189
|
+
a2aSkills=["python"], # Specific A2A skills
|
|
190
|
+
active=True, # Only active agents
|
|
191
|
+
x402support=True # Payment support
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
for agent in results['items']:
|
|
195
|
+
print(f"{agent.name}: {agent.description}")
|
|
196
|
+
print(f" Tools: {agent.mcpTools}")
|
|
197
|
+
print(f" Skills: {agent.a2aSkills}")
|
|
198
|
+
|
|
199
|
+
# Get single agent (read-only, faster)
|
|
200
|
+
agent_summary = sdk.getAgent("11155111:123")
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 5. Give and Retrieve Feedback
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
# Prepare feedback (only score is mandatory)
|
|
207
|
+
feedback_file = sdk.prepareFeedback(
|
|
208
|
+
agentId="11155111:123",
|
|
209
|
+
score=85, # 0-100 (mandatory)
|
|
210
|
+
tags=["data_analyst", "finance"], # Optional
|
|
211
|
+
capability="tools", # Optional: MCP capability
|
|
212
|
+
name="code_generation", # Optional: MCP tool name
|
|
213
|
+
skill="python" # Optional: A2A skill
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
# Give feedback
|
|
217
|
+
feedback = sdk.giveFeedback(agentId="11155111:123", feedbackFile=feedback_file)
|
|
218
|
+
|
|
219
|
+
# Search feedback
|
|
220
|
+
results = sdk.searchFeedback(
|
|
221
|
+
agentId="11155111:123",
|
|
222
|
+
capabilities=["tools"],
|
|
223
|
+
minScore=80,
|
|
224
|
+
maxScore=100
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
# Get reputation summary
|
|
228
|
+
summary = sdk.getReputationSummary("11155111:123")
|
|
229
|
+
print(f"Average score: {summary['averageScore']}")
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## IPFS Configuration Options
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
# Option 1: Filecoin Pin (free for ERC-8004 agents)
|
|
236
|
+
sdk = SDK(
|
|
237
|
+
chainId=11155111,
|
|
238
|
+
rpcUrl="...",
|
|
239
|
+
signer=private_key,
|
|
240
|
+
ipfs="filecoinPin",
|
|
241
|
+
filecoinPrivateKey="your-filecoin-private-key"
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
# Option 2: IPFS Node
|
|
245
|
+
sdk = SDK(
|
|
246
|
+
chainId=11155111,
|
|
247
|
+
rpcUrl="...",
|
|
248
|
+
signer=private_key,
|
|
249
|
+
ipfs="node",
|
|
250
|
+
ipfsNodeUrl="https://ipfs.infura.io:5001"
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
# Option 3: Pinata (free for ERC-8004 agents)
|
|
254
|
+
sdk = SDK(
|
|
255
|
+
chainId=11155111,
|
|
256
|
+
rpcUrl="...",
|
|
257
|
+
signer=private_key,
|
|
258
|
+
ipfs="pinata",
|
|
259
|
+
pinataJwt="your-pinata-jwt-token"
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
# Option 4: HTTP registration (no IPFS)
|
|
263
|
+
sdk = SDK(chainId=11155111, rpcUrl="...", signer=private_key)
|
|
264
|
+
agent.register("https://example.com/agent-registration.json")
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Use Cases
|
|
268
|
+
|
|
269
|
+
- **Building agent marketplaces** - Create platforms where developers can discover, evaluate, and integrate agents based on their capabilities and reputation
|
|
270
|
+
- **Agent interoperability** - Discover agents by specific capabilities (skills, tools, tasks), evaluate them through reputation signals, and integrate them via standard protocols (MCP/A2A)
|
|
271
|
+
- **Managing agent reputation** - Track agent performance, collect feedback from users and other agents, and build trust signals for your agent ecosystem
|
|
272
|
+
- **Cross-chain agent operations** - Deploy and manage agents across multiple blockchain networks with consistent identity and reputation
|
|
273
|
+
|
|
274
|
+
## 🚀 Coming Soon
|
|
275
|
+
|
|
276
|
+
- More chains (currently Ethereum Sepolia only)
|
|
277
|
+
- Support for validations
|
|
278
|
+
- Multi-chain agents search
|
|
279
|
+
- Enhanced x402 payments
|
|
280
|
+
- Semantic/Vectorial search
|
|
281
|
+
- Advanced reputation aggregation
|
|
282
|
+
- Import/Export to centralized catalogues
|
|
283
|
+
|
|
284
|
+
## Tests
|
|
285
|
+
|
|
286
|
+
Complete working examples are available in the `tests/` directory:
|
|
287
|
+
|
|
288
|
+
- `test_registration.py` - Agent registration with HTTP URI
|
|
289
|
+
- `test_registrationIpfs.py` - Agent registration with IPFS
|
|
290
|
+
- `test_feedback.py` - Complete feedback flow with IPFS storage
|
|
291
|
+
- `test_search.py` - Agent search and discovery
|
|
292
|
+
- `test_transfer.py` - Agent ownership transfer
|
|
293
|
+
|
|
294
|
+
## Documentation
|
|
295
|
+
|
|
296
|
+
Full documentation is available at [sdk.ag0.xyz](https://sdk.ag0.xyz), including:
|
|
297
|
+
|
|
298
|
+
- [Installation Guide](https://sdk.ag0.xyz/2-usage/2-1-install/)
|
|
299
|
+
- [Agent Configuration](https://sdk.ag0.xyz/2-usage/2-2-configure-agents/)
|
|
300
|
+
- [Registration](https://sdk.ag0.xyz/2-usage/2-3-registration-ipfs/)
|
|
301
|
+
- [Search](https://sdk.ag0.xyz/2-usage/2-5-search/)
|
|
302
|
+
- [Feedback](https://sdk.ag0.xyz/2-usage/2-6-use-feedback/)
|
|
303
|
+
- [Key Concepts](https://sdk.ag0.xyz/1-welcome/1-2-key-concepts/)
|
|
304
|
+
- [API Reference](https://sdk.ag0.xyz/5-reference/5-1-sdk/)
|
|
305
|
+
|
|
306
|
+
## License
|
|
307
|
+
|
|
308
|
+
MIT License - see LICENSE file for details.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Agent0 SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for agent portability, discovery and trust based on ERC-8004.
|
|
4
|
+
|
|
5
|
+
Agent0 is the SDK for agentic economies. It enables agents to register, advertise their capabilities and how to communicate with them, and give each other feedback and reputation signals. All this using blockchain infrastructure (ERC-8004) and decentralized storage, enabling permissionless discovery without relying on proprietary catalogues or intermediaries.
|
|
6
|
+
|
|
7
|
+
## What Does Agent0 SDK Do?
|
|
8
|
+
|
|
9
|
+
Agent0 SDK v0.2 enables you to:
|
|
10
|
+
|
|
11
|
+
- **Create and manage agent identities** - Register your AI agent on-chain with a unique identity, configure presentation fields (name, description, image), set wallet addresses, and manage trust models with x402 support
|
|
12
|
+
- **Advertise agent capabilities** - Publish MCP and A2A endpoints, with automated extraction of MCP tools and A2A skills from endpoints
|
|
13
|
+
- **Enable permissionless discovery** - Make your agent discoverable by other agents and platforms using rich search by attributes, capabilities, skills, tools, tasks, and x402 support
|
|
14
|
+
- **Build reputation** - Give and receive feedback, retrieve feedback history, and search agents by reputation with cryptographic authentication
|
|
15
|
+
- **Cross-chain registration** - One-line registration with IPFS nodes, Pinata, Filecoin, or HTTP URIs
|
|
16
|
+
- **Public indexing** - Subgraph indexing both on-chain and IPFS data for fast search and retrieval
|
|
17
|
+
|
|
18
|
+
## ⚠️ Alpha Release
|
|
19
|
+
|
|
20
|
+
Agent0 SDK v0.2 is in **alpha** with bugs and is not production ready. We're actively testing and improving it.
|
|
21
|
+
|
|
22
|
+
**Bug reports & feedback:** GitHub: [Report issues](https://github.com/agent0lab/agent0-py/issues) | Telegram: [@marcoderossi](https://t.me/marcoderossi) | Email: marco.derossi@consensys.net
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
### Prerequisites
|
|
27
|
+
|
|
28
|
+
- Python 3.8 or higher
|
|
29
|
+
- pip package manager
|
|
30
|
+
- Private key for signing transactions (or run in read-only mode)
|
|
31
|
+
- Access to an Ethereum RPC endpoint (e.g., Alchemy, Infura)
|
|
32
|
+
- (Optional) IPFS provider account (Pinata, Filecoin, or local IPFS node)
|
|
33
|
+
|
|
34
|
+
### Install from PyPI
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install agent0-sdk
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Install from Source
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
git clone https://github.com/agent0lab/agent0-py.git
|
|
44
|
+
cd agent0-py
|
|
45
|
+
pip install -e .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
### 1. Initialize SDK
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from agent0_sdk import SDK
|
|
54
|
+
import os
|
|
55
|
+
|
|
56
|
+
# Initialize SDK with IPFS and subgraph
|
|
57
|
+
sdk = SDK(
|
|
58
|
+
chainId=11155111, # Ethereum Sepolia testnet
|
|
59
|
+
rpcUrl=os.getenv("RPC_URL"),
|
|
60
|
+
signer=os.getenv("PRIVATE_KEY"),
|
|
61
|
+
ipfs="pinata", # Options: "pinata", "filecoinPin", "node"
|
|
62
|
+
pinataJwt=os.getenv("PINATA_JWT") # For Pinata
|
|
63
|
+
# Subgraph URL auto-defaults from DEFAULT_SUBGRAPH_URLS
|
|
64
|
+
)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Create and Register Agent
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
# Create agent
|
|
71
|
+
agent = sdk.createAgent(
|
|
72
|
+
name="My AI Agent",
|
|
73
|
+
description="An intelligent assistant for various tasks. Skills: data analysis, code generation.",
|
|
74
|
+
image="https://example.com/agent-image.png"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Configure endpoints (automatically extracts capabilities)
|
|
78
|
+
agent.setMCP("https://mcp.example.com/") # Extracts tools, prompts, resources
|
|
79
|
+
agent.setA2A("https://a2a.example.com/agent-card.json") # Extracts skills
|
|
80
|
+
agent.setENS("myagent.eth")
|
|
81
|
+
|
|
82
|
+
# Configure wallet and trust
|
|
83
|
+
agent.setAgentWallet("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", chainId=11155111)
|
|
84
|
+
agent.setTrust(reputation=True, cryptoEconomic=True)
|
|
85
|
+
|
|
86
|
+
# Add metadata and set status
|
|
87
|
+
agent.setMetadata({"version": "1.0.0", "category": "ai-assistant"})
|
|
88
|
+
agent.setActive(True)
|
|
89
|
+
|
|
90
|
+
# Register on-chain with IPFS
|
|
91
|
+
agent.registerIPFS()
|
|
92
|
+
print(f"Agent registered: {agent.agentId}") # e.g., "11155111:123"
|
|
93
|
+
print(f"Agent URI: {agent.agentURI}") # e.g., "ipfs://Qm..."
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 3. Load and Edit Agent
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
# Load existing agent for editing
|
|
100
|
+
agent = sdk.loadAgent("11155111:123") # Format: "chainId:agentId"
|
|
101
|
+
|
|
102
|
+
# Edit agent properties
|
|
103
|
+
agent.updateInfo(description="Updated description with new capabilities")
|
|
104
|
+
agent.setMCP("https://new-mcp.example.com/")
|
|
105
|
+
|
|
106
|
+
# Re-register to update on-chain
|
|
107
|
+
agent.registerIPFS()
|
|
108
|
+
print(f"Updated: {agent.agentURI}")
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 4. Search Agents
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
# Search by name, capabilities, or attributes
|
|
115
|
+
results = sdk.searchAgents(
|
|
116
|
+
name="AI", # Substring search
|
|
117
|
+
mcpTools=["code_generation"], # Specific MCP tools
|
|
118
|
+
a2aSkills=["python"], # Specific A2A skills
|
|
119
|
+
active=True, # Only active agents
|
|
120
|
+
x402support=True # Payment support
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
for agent in results['items']:
|
|
124
|
+
print(f"{agent.name}: {agent.description}")
|
|
125
|
+
print(f" Tools: {agent.mcpTools}")
|
|
126
|
+
print(f" Skills: {agent.a2aSkills}")
|
|
127
|
+
|
|
128
|
+
# Get single agent (read-only, faster)
|
|
129
|
+
agent_summary = sdk.getAgent("11155111:123")
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 5. Give and Retrieve Feedback
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
# Prepare feedback (only score is mandatory)
|
|
136
|
+
feedback_file = sdk.prepareFeedback(
|
|
137
|
+
agentId="11155111:123",
|
|
138
|
+
score=85, # 0-100 (mandatory)
|
|
139
|
+
tags=["data_analyst", "finance"], # Optional
|
|
140
|
+
capability="tools", # Optional: MCP capability
|
|
141
|
+
name="code_generation", # Optional: MCP tool name
|
|
142
|
+
skill="python" # Optional: A2A skill
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
# Give feedback
|
|
146
|
+
feedback = sdk.giveFeedback(agentId="11155111:123", feedbackFile=feedback_file)
|
|
147
|
+
|
|
148
|
+
# Search feedback
|
|
149
|
+
results = sdk.searchFeedback(
|
|
150
|
+
agentId="11155111:123",
|
|
151
|
+
capabilities=["tools"],
|
|
152
|
+
minScore=80,
|
|
153
|
+
maxScore=100
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
# Get reputation summary
|
|
157
|
+
summary = sdk.getReputationSummary("11155111:123")
|
|
158
|
+
print(f"Average score: {summary['averageScore']}")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## IPFS Configuration Options
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
# Option 1: Filecoin Pin (free for ERC-8004 agents)
|
|
165
|
+
sdk = SDK(
|
|
166
|
+
chainId=11155111,
|
|
167
|
+
rpcUrl="...",
|
|
168
|
+
signer=private_key,
|
|
169
|
+
ipfs="filecoinPin",
|
|
170
|
+
filecoinPrivateKey="your-filecoin-private-key"
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
# Option 2: IPFS Node
|
|
174
|
+
sdk = SDK(
|
|
175
|
+
chainId=11155111,
|
|
176
|
+
rpcUrl="...",
|
|
177
|
+
signer=private_key,
|
|
178
|
+
ipfs="node",
|
|
179
|
+
ipfsNodeUrl="https://ipfs.infura.io:5001"
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
# Option 3: Pinata (free for ERC-8004 agents)
|
|
183
|
+
sdk = SDK(
|
|
184
|
+
chainId=11155111,
|
|
185
|
+
rpcUrl="...",
|
|
186
|
+
signer=private_key,
|
|
187
|
+
ipfs="pinata",
|
|
188
|
+
pinataJwt="your-pinata-jwt-token"
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
# Option 4: HTTP registration (no IPFS)
|
|
192
|
+
sdk = SDK(chainId=11155111, rpcUrl="...", signer=private_key)
|
|
193
|
+
agent.register("https://example.com/agent-registration.json")
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Use Cases
|
|
197
|
+
|
|
198
|
+
- **Building agent marketplaces** - Create platforms where developers can discover, evaluate, and integrate agents based on their capabilities and reputation
|
|
199
|
+
- **Agent interoperability** - Discover agents by specific capabilities (skills, tools, tasks), evaluate them through reputation signals, and integrate them via standard protocols (MCP/A2A)
|
|
200
|
+
- **Managing agent reputation** - Track agent performance, collect feedback from users and other agents, and build trust signals for your agent ecosystem
|
|
201
|
+
- **Cross-chain agent operations** - Deploy and manage agents across multiple blockchain networks with consistent identity and reputation
|
|
202
|
+
|
|
203
|
+
## 🚀 Coming Soon
|
|
204
|
+
|
|
205
|
+
- More chains (currently Ethereum Sepolia only)
|
|
206
|
+
- Support for validations
|
|
207
|
+
- Multi-chain agents search
|
|
208
|
+
- Enhanced x402 payments
|
|
209
|
+
- Semantic/Vectorial search
|
|
210
|
+
- Advanced reputation aggregation
|
|
211
|
+
- Import/Export to centralized catalogues
|
|
212
|
+
|
|
213
|
+
## Tests
|
|
214
|
+
|
|
215
|
+
Complete working examples are available in the `tests/` directory:
|
|
216
|
+
|
|
217
|
+
- `test_registration.py` - Agent registration with HTTP URI
|
|
218
|
+
- `test_registrationIpfs.py` - Agent registration with IPFS
|
|
219
|
+
- `test_feedback.py` - Complete feedback flow with IPFS storage
|
|
220
|
+
- `test_search.py` - Agent search and discovery
|
|
221
|
+
- `test_transfer.py` - Agent ownership transfer
|
|
222
|
+
|
|
223
|
+
## Documentation
|
|
224
|
+
|
|
225
|
+
Full documentation is available at [sdk.ag0.xyz](https://sdk.ag0.xyz), including:
|
|
226
|
+
|
|
227
|
+
- [Installation Guide](https://sdk.ag0.xyz/2-usage/2-1-install/)
|
|
228
|
+
- [Agent Configuration](https://sdk.ag0.xyz/2-usage/2-2-configure-agents/)
|
|
229
|
+
- [Registration](https://sdk.ag0.xyz/2-usage/2-3-registration-ipfs/)
|
|
230
|
+
- [Search](https://sdk.ag0.xyz/2-usage/2-5-search/)
|
|
231
|
+
- [Feedback](https://sdk.ag0.xyz/2-usage/2-6-use-feedback/)
|
|
232
|
+
- [Key Concepts](https://sdk.ag0.xyz/1-welcome/1-2-key-concepts/)
|
|
233
|
+
- [API Reference](https://sdk.ag0.xyz/5-reference/5-1-sdk/)
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
MIT License - see LICENSE file for details.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent0 SDK - Python SDK for agent portability, discovery and trust based on ERC-8004.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .core.models import (
|
|
6
|
+
AgentId,
|
|
7
|
+
ChainId,
|
|
8
|
+
Address,
|
|
9
|
+
URI,
|
|
10
|
+
CID,
|
|
11
|
+
Timestamp,
|
|
12
|
+
IdemKey,
|
|
13
|
+
EndpointType,
|
|
14
|
+
TrustModel,
|
|
15
|
+
Endpoint,
|
|
16
|
+
RegistrationFile,
|
|
17
|
+
AgentSummary,
|
|
18
|
+
Feedback,
|
|
19
|
+
SearchParams,
|
|
20
|
+
SearchFeedbackParams,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Try to import SDK and Agent (may fail if web3 is not installed)
|
|
24
|
+
try:
|
|
25
|
+
from .core.sdk import SDK
|
|
26
|
+
from .core.agent import Agent
|
|
27
|
+
_sdk_available = True
|
|
28
|
+
except ImportError:
|
|
29
|
+
SDK = None
|
|
30
|
+
Agent = None
|
|
31
|
+
_sdk_available = False
|
|
32
|
+
|
|
33
|
+
__version__ = "0.2.0"
|
|
34
|
+
__all__ = [
|
|
35
|
+
"SDK",
|
|
36
|
+
"Agent",
|
|
37
|
+
"AgentId",
|
|
38
|
+
"ChainId",
|
|
39
|
+
"Address",
|
|
40
|
+
"URI",
|
|
41
|
+
"CID",
|
|
42
|
+
"Timestamp",
|
|
43
|
+
"IdemKey",
|
|
44
|
+
"EndpointType",
|
|
45
|
+
"TrustModel",
|
|
46
|
+
"Endpoint",
|
|
47
|
+
"RegistrationFile",
|
|
48
|
+
"AgentSummary",
|
|
49
|
+
"Feedback",
|
|
50
|
+
"SearchParams",
|
|
51
|
+
"SearchFeedbackParams",
|
|
52
|
+
]
|