agent0-sdk 0.3rc1__tar.gz → 0.31__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.3rc1 → agent0_sdk-0.31}/PKG-INFO +62 -3
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/README.md +61 -2
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/__init__.py +1 -1
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/agent.py +132 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/models.py +1 -0
- agent0_sdk-0.31/agent0_sdk/core/oasf_validator.py +98 -0
- agent0_sdk-0.31/agent0_sdk/taxonomies/all_domains.json +1565 -0
- agent0_sdk-0.31/agent0_sdk/taxonomies/all_skills.json +1030 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk.egg-info/PKG-INFO +62 -3
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk.egg-info/SOURCES.txt +4 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/pyproject.toml +4 -1
- agent0_sdk-0.31/tests/test_oasf_management.py +404 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/LICENSE +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/contracts.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/endpoint_crawler.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/feedback_manager.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/indexer.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/ipfs_client.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/sdk.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/subgraph_client.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk/core/web3_client.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk.egg-info/dependency_links.txt +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk.egg-info/requires.txt +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/agent0_sdk.egg-info/top_level.txt +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/setup.cfg +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/__init__.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/config.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/conftest.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/discover_test_data.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/test_feedback.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/test_models.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/test_multi_chain.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/test_real_public_servers.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/test_registration.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/test_registrationIpfs.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/test_sdk.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/test_search.py +0 -0
- {agent0_sdk-0.3rc1 → agent0_sdk-0.31}/tests/test_transfer.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent0-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.31
|
|
4
4
|
Summary: Python SDK for agent portability, discovery and trust based on ERC-8004
|
|
5
5
|
Author-email: Marco De Rossi <marco.derossi@consensys.net>
|
|
6
6
|
License: MIT License
|
|
@@ -76,10 +76,11 @@ Agent0 is the SDK for agentic economies. It enables agents to register, advertis
|
|
|
76
76
|
|
|
77
77
|
## What Does Agent0 SDK Do?
|
|
78
78
|
|
|
79
|
-
Agent0 SDK v0.
|
|
79
|
+
Agent0 SDK v0.31 enables you to:
|
|
80
80
|
|
|
81
81
|
- **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
|
|
82
82
|
- **Advertise agent capabilities** - Publish MCP and A2A endpoints, with automated extraction of MCP tools and A2A skills from endpoints
|
|
83
|
+
- **OASF taxonomies** - Advertise standardized skills and domains using the Open Agentic Schema Framework (OASF) taxonomies for better discovery and interoperability
|
|
83
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
|
|
84
85
|
- **Build reputation** - Give and receive feedback, retrieve feedback history, and search agents by reputation with cryptographic authentication
|
|
85
86
|
- **Cross-chain registration** - One-line registration with IPFS nodes, Pinata, Filecoin, or HTTP URIs
|
|
@@ -87,7 +88,7 @@ Agent0 SDK v0.2 enables you to:
|
|
|
87
88
|
|
|
88
89
|
## ⚠️ Alpha Release
|
|
89
90
|
|
|
90
|
-
Agent0 SDK v0.
|
|
91
|
+
Agent0 SDK v0.31 is in **alpha** with bugs and is not production ready. We're actively testing and improving it.
|
|
91
92
|
|
|
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
|
|
93
94
|
|
|
@@ -149,6 +150,12 @@ agent.setMCP("https://mcp.example.com/") # Extracts tools, prompts, resources
|
|
|
149
150
|
agent.setA2A("https://a2a.example.com/agent-card.json") # Extracts skills
|
|
150
151
|
agent.setENS("myagent.eth")
|
|
151
152
|
|
|
153
|
+
# Add OASF skills and domains (standardized taxonomies)
|
|
154
|
+
agent.addSkill("data_engineering/data_transformation_pipeline", validate_oasf=True)
|
|
155
|
+
agent.addSkill("natural_language_processing/summarization", validate_oasf=True)
|
|
156
|
+
agent.addDomain("finance_and_business/investment_services", validate_oasf=True)
|
|
157
|
+
agent.addDomain("technology/data_science", validate_oasf=True)
|
|
158
|
+
|
|
152
159
|
# Configure wallet and trust
|
|
153
160
|
agent.setAgentWallet("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", chainId=11155111)
|
|
154
161
|
agent.setTrust(reputation=True, cryptoEconomic=True)
|
|
@@ -263,6 +270,58 @@ sdk = SDK(chainId=11155111, rpcUrl="...", signer=private_key)
|
|
|
263
270
|
agent.register("https://example.com/agent-registration.json")
|
|
264
271
|
```
|
|
265
272
|
|
|
273
|
+
## OASF Taxonomies
|
|
274
|
+
|
|
275
|
+
The SDK includes support for the **Open Agentic Schema Framework (OASF)** taxonomies, enabling agents to advertise standardized skills and domains. This improves discoverability and interoperability across agent platforms.
|
|
276
|
+
|
|
277
|
+
### Adding Skills and Domains
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
# Add OASF skills (with optional validation)
|
|
281
|
+
agent.addSkill("advanced_reasoning_planning/strategic_planning", validate_oasf=True)
|
|
282
|
+
agent.addSkill("data_engineering/data_transformation_pipeline", validate_oasf=True)
|
|
283
|
+
|
|
284
|
+
# Add OASF domains (with optional validation)
|
|
285
|
+
agent.addDomain("finance_and_business/investment_services", validate_oasf=True)
|
|
286
|
+
agent.addDomain("technology/data_science/data_visualization", validate_oasf=True)
|
|
287
|
+
|
|
288
|
+
# Remove skills/domains
|
|
289
|
+
agent.removeSkill("old_skill")
|
|
290
|
+
agent.removeDomain("old_domain")
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### OASF in Registration Files
|
|
294
|
+
|
|
295
|
+
OASF skills and domains appear in your agent's registration file:
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"endpoints": [
|
|
300
|
+
{
|
|
301
|
+
"name": "OASF",
|
|
302
|
+
"endpoint": "https://github.com/agntcy/oasf/",
|
|
303
|
+
"version": "v0.8.0",
|
|
304
|
+
"skills": [
|
|
305
|
+
"advanced_reasoning_planning/strategic_planning",
|
|
306
|
+
"data_engineering/data_transformation_pipeline"
|
|
307
|
+
],
|
|
308
|
+
"domains": [
|
|
309
|
+
"finance_and_business/investment_services",
|
|
310
|
+
"technology/data_science"
|
|
311
|
+
]
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Taxonomy Files
|
|
318
|
+
|
|
319
|
+
The SDK includes complete OASF v0.8.0 taxonomy files:
|
|
320
|
+
- **Skills**: `agent0_sdk/taxonomies/all_skills.json` (136 skills)
|
|
321
|
+
- **Domains**: `agent0_sdk/taxonomies/all_domains.json` (204 domains)
|
|
322
|
+
|
|
323
|
+
Browse these files to find appropriate skill and domain slugs. For more information, see the [OASF specification](https://github.com/agntcy/oasf) and [Release Notes v0.31](RELEASE_NOTES_0.31.md).
|
|
324
|
+
|
|
266
325
|
## Use Cases
|
|
267
326
|
|
|
268
327
|
- **Building agent marketplaces** - Create platforms where developers can discover, evaluate, and integrate agents based on their capabilities and reputation
|
|
@@ -6,10 +6,11 @@ Agent0 is the SDK for agentic economies. It enables agents to register, advertis
|
|
|
6
6
|
|
|
7
7
|
## What Does Agent0 SDK Do?
|
|
8
8
|
|
|
9
|
-
Agent0 SDK v0.
|
|
9
|
+
Agent0 SDK v0.31 enables you to:
|
|
10
10
|
|
|
11
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
12
|
- **Advertise agent capabilities** - Publish MCP and A2A endpoints, with automated extraction of MCP tools and A2A skills from endpoints
|
|
13
|
+
- **OASF taxonomies** - Advertise standardized skills and domains using the Open Agentic Schema Framework (OASF) taxonomies for better discovery and interoperability
|
|
13
14
|
- **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
15
|
- **Build reputation** - Give and receive feedback, retrieve feedback history, and search agents by reputation with cryptographic authentication
|
|
15
16
|
- **Cross-chain registration** - One-line registration with IPFS nodes, Pinata, Filecoin, or HTTP URIs
|
|
@@ -17,7 +18,7 @@ Agent0 SDK v0.2 enables you to:
|
|
|
17
18
|
|
|
18
19
|
## ⚠️ Alpha Release
|
|
19
20
|
|
|
20
|
-
Agent0 SDK v0.
|
|
21
|
+
Agent0 SDK v0.31 is in **alpha** with bugs and is not production ready. We're actively testing and improving it.
|
|
21
22
|
|
|
22
23
|
**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
|
|
|
@@ -79,6 +80,12 @@ agent.setMCP("https://mcp.example.com/") # Extracts tools, prompts, resources
|
|
|
79
80
|
agent.setA2A("https://a2a.example.com/agent-card.json") # Extracts skills
|
|
80
81
|
agent.setENS("myagent.eth")
|
|
81
82
|
|
|
83
|
+
# Add OASF skills and domains (standardized taxonomies)
|
|
84
|
+
agent.addSkill("data_engineering/data_transformation_pipeline", validate_oasf=True)
|
|
85
|
+
agent.addSkill("natural_language_processing/summarization", validate_oasf=True)
|
|
86
|
+
agent.addDomain("finance_and_business/investment_services", validate_oasf=True)
|
|
87
|
+
agent.addDomain("technology/data_science", validate_oasf=True)
|
|
88
|
+
|
|
82
89
|
# Configure wallet and trust
|
|
83
90
|
agent.setAgentWallet("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb", chainId=11155111)
|
|
84
91
|
agent.setTrust(reputation=True, cryptoEconomic=True)
|
|
@@ -193,6 +200,58 @@ sdk = SDK(chainId=11155111, rpcUrl="...", signer=private_key)
|
|
|
193
200
|
agent.register("https://example.com/agent-registration.json")
|
|
194
201
|
```
|
|
195
202
|
|
|
203
|
+
## OASF Taxonomies
|
|
204
|
+
|
|
205
|
+
The SDK includes support for the **Open Agentic Schema Framework (OASF)** taxonomies, enabling agents to advertise standardized skills and domains. This improves discoverability and interoperability across agent platforms.
|
|
206
|
+
|
|
207
|
+
### Adding Skills and Domains
|
|
208
|
+
|
|
209
|
+
```python
|
|
210
|
+
# Add OASF skills (with optional validation)
|
|
211
|
+
agent.addSkill("advanced_reasoning_planning/strategic_planning", validate_oasf=True)
|
|
212
|
+
agent.addSkill("data_engineering/data_transformation_pipeline", validate_oasf=True)
|
|
213
|
+
|
|
214
|
+
# Add OASF domains (with optional validation)
|
|
215
|
+
agent.addDomain("finance_and_business/investment_services", validate_oasf=True)
|
|
216
|
+
agent.addDomain("technology/data_science/data_visualization", validate_oasf=True)
|
|
217
|
+
|
|
218
|
+
# Remove skills/domains
|
|
219
|
+
agent.removeSkill("old_skill")
|
|
220
|
+
agent.removeDomain("old_domain")
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### OASF in Registration Files
|
|
224
|
+
|
|
225
|
+
OASF skills and domains appear in your agent's registration file:
|
|
226
|
+
|
|
227
|
+
```json
|
|
228
|
+
{
|
|
229
|
+
"endpoints": [
|
|
230
|
+
{
|
|
231
|
+
"name": "OASF",
|
|
232
|
+
"endpoint": "https://github.com/agntcy/oasf/",
|
|
233
|
+
"version": "v0.8.0",
|
|
234
|
+
"skills": [
|
|
235
|
+
"advanced_reasoning_planning/strategic_planning",
|
|
236
|
+
"data_engineering/data_transformation_pipeline"
|
|
237
|
+
],
|
|
238
|
+
"domains": [
|
|
239
|
+
"finance_and_business/investment_services",
|
|
240
|
+
"technology/data_science"
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Taxonomy Files
|
|
248
|
+
|
|
249
|
+
The SDK includes complete OASF v0.8.0 taxonomy files:
|
|
250
|
+
- **Skills**: `agent0_sdk/taxonomies/all_skills.json` (136 skills)
|
|
251
|
+
- **Domains**: `agent0_sdk/taxonomies/all_domains.json` (204 domains)
|
|
252
|
+
|
|
253
|
+
Browse these files to find appropriate skill and domain slugs. For more information, see the [OASF specification](https://github.com/agntcy/oasf) and [Release Notes v0.31](RELEASE_NOTES_0.31.md).
|
|
254
|
+
|
|
196
255
|
## Use Cases
|
|
197
256
|
|
|
198
257
|
- **Building agent marketplaces** - Create platforms where developers can discover, evaluate, and integrate agents based on their capabilities and reputation
|
|
@@ -16,6 +16,7 @@ from .models import (
|
|
|
16
16
|
)
|
|
17
17
|
from .web3_client import Web3Client
|
|
18
18
|
from .endpoint_crawler import EndpointCrawler
|
|
19
|
+
from .oasf_validator import validate_skill, validate_domain
|
|
19
20
|
|
|
20
21
|
if TYPE_CHECKING:
|
|
21
22
|
from .sdk import SDK
|
|
@@ -316,6 +317,137 @@ class Agent:
|
|
|
316
317
|
"""Remove all endpoints."""
|
|
317
318
|
return self.removeEndpoint()
|
|
318
319
|
|
|
320
|
+
# OASF endpoint management
|
|
321
|
+
def _get_or_create_oasf_endpoint(self) -> Endpoint:
|
|
322
|
+
"""Get existing OASF endpoint or create a new one with default values."""
|
|
323
|
+
# Find existing OASF endpoint
|
|
324
|
+
for ep in self.registration_file.endpoints:
|
|
325
|
+
if ep.type == EndpointType.OASF:
|
|
326
|
+
return ep
|
|
327
|
+
|
|
328
|
+
# Create new OASF endpoint with default values
|
|
329
|
+
oasf_endpoint = Endpoint(
|
|
330
|
+
type=EndpointType.OASF,
|
|
331
|
+
value="https://github.com/agntcy/oasf/",
|
|
332
|
+
meta={"version": "v0.8.0", "skills": [], "domains": []}
|
|
333
|
+
)
|
|
334
|
+
self.registration_file.endpoints.append(oasf_endpoint)
|
|
335
|
+
return oasf_endpoint
|
|
336
|
+
|
|
337
|
+
def addSkill(self, slug: str, validate_oasf: bool = False) -> 'Agent':
|
|
338
|
+
"""
|
|
339
|
+
Add a skill to the OASF endpoint.
|
|
340
|
+
|
|
341
|
+
Args:
|
|
342
|
+
slug: The skill slug to add (e.g., "natural_language_processing/summarization")
|
|
343
|
+
validate_oasf: If True, validate the slug against the OASF taxonomy (default: False)
|
|
344
|
+
|
|
345
|
+
Returns:
|
|
346
|
+
self for method chaining
|
|
347
|
+
|
|
348
|
+
Raises:
|
|
349
|
+
ValueError: If validate_oasf=True and the slug is not valid
|
|
350
|
+
"""
|
|
351
|
+
if validate_oasf:
|
|
352
|
+
if not validate_skill(slug):
|
|
353
|
+
raise ValueError(
|
|
354
|
+
f"Invalid OASF skill slug: {slug}. "
|
|
355
|
+
"Use validate_oasf=False to skip validation."
|
|
356
|
+
)
|
|
357
|
+
|
|
358
|
+
oasf_endpoint = self._get_or_create_oasf_endpoint()
|
|
359
|
+
|
|
360
|
+
# Initialize skills array if missing
|
|
361
|
+
if "skills" not in oasf_endpoint.meta:
|
|
362
|
+
oasf_endpoint.meta["skills"] = []
|
|
363
|
+
|
|
364
|
+
# Add slug if not already present (avoid duplicates)
|
|
365
|
+
skills = oasf_endpoint.meta["skills"]
|
|
366
|
+
if slug not in skills:
|
|
367
|
+
skills.append(slug)
|
|
368
|
+
|
|
369
|
+
self.registration_file.updatedAt = int(time.time())
|
|
370
|
+
return self
|
|
371
|
+
|
|
372
|
+
def removeSkill(self, slug: str) -> 'Agent':
|
|
373
|
+
"""
|
|
374
|
+
Remove a skill from the OASF endpoint.
|
|
375
|
+
|
|
376
|
+
Args:
|
|
377
|
+
slug: The skill slug to remove
|
|
378
|
+
|
|
379
|
+
Returns:
|
|
380
|
+
self for method chaining
|
|
381
|
+
"""
|
|
382
|
+
# Find OASF endpoint
|
|
383
|
+
for ep in self.registration_file.endpoints:
|
|
384
|
+
if ep.type == EndpointType.OASF:
|
|
385
|
+
if "skills" in ep.meta and isinstance(ep.meta["skills"], list):
|
|
386
|
+
skills = ep.meta["skills"]
|
|
387
|
+
if slug in skills:
|
|
388
|
+
skills.remove(slug)
|
|
389
|
+
self.registration_file.updatedAt = int(time.time())
|
|
390
|
+
break
|
|
391
|
+
|
|
392
|
+
return self
|
|
393
|
+
|
|
394
|
+
def addDomain(self, slug: str, validate_oasf: bool = False) -> 'Agent':
|
|
395
|
+
"""
|
|
396
|
+
Add a domain to the OASF endpoint.
|
|
397
|
+
|
|
398
|
+
Args:
|
|
399
|
+
slug: The domain slug to add (e.g., "finance_and_business/investment_services")
|
|
400
|
+
validate_oasf: If True, validate the slug against the OASF taxonomy (default: False)
|
|
401
|
+
|
|
402
|
+
Returns:
|
|
403
|
+
self for method chaining
|
|
404
|
+
|
|
405
|
+
Raises:
|
|
406
|
+
ValueError: If validate_oasf=True and the slug is not valid
|
|
407
|
+
"""
|
|
408
|
+
if validate_oasf:
|
|
409
|
+
if not validate_domain(slug):
|
|
410
|
+
raise ValueError(
|
|
411
|
+
f"Invalid OASF domain slug: {slug}. "
|
|
412
|
+
"Use validate_oasf=False to skip validation."
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
oasf_endpoint = self._get_or_create_oasf_endpoint()
|
|
416
|
+
|
|
417
|
+
# Initialize domains array if missing
|
|
418
|
+
if "domains" not in oasf_endpoint.meta:
|
|
419
|
+
oasf_endpoint.meta["domains"] = []
|
|
420
|
+
|
|
421
|
+
# Add slug if not already present (avoid duplicates)
|
|
422
|
+
domains = oasf_endpoint.meta["domains"]
|
|
423
|
+
if slug not in domains:
|
|
424
|
+
domains.append(slug)
|
|
425
|
+
|
|
426
|
+
self.registration_file.updatedAt = int(time.time())
|
|
427
|
+
return self
|
|
428
|
+
|
|
429
|
+
def removeDomain(self, slug: str) -> 'Agent':
|
|
430
|
+
"""
|
|
431
|
+
Remove a domain from the OASF endpoint.
|
|
432
|
+
|
|
433
|
+
Args:
|
|
434
|
+
slug: The domain slug to remove
|
|
435
|
+
|
|
436
|
+
Returns:
|
|
437
|
+
self for method chaining
|
|
438
|
+
"""
|
|
439
|
+
# Find OASF endpoint
|
|
440
|
+
for ep in self.registration_file.endpoints:
|
|
441
|
+
if ep.type == EndpointType.OASF:
|
|
442
|
+
if "domains" in ep.meta and isinstance(ep.meta["domains"], list):
|
|
443
|
+
domains = ep.meta["domains"]
|
|
444
|
+
if slug in domains:
|
|
445
|
+
domains.remove(slug)
|
|
446
|
+
self.registration_file.updatedAt = int(time.time())
|
|
447
|
+
break
|
|
448
|
+
|
|
449
|
+
return self
|
|
450
|
+
|
|
319
451
|
# Trust models
|
|
320
452
|
def setTrust(
|
|
321
453
|
self,
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OASF taxonomy validation utilities.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
# Cache for loaded taxonomy data
|
|
11
|
+
_skills_cache: Optional[dict] = None
|
|
12
|
+
_domains_cache: Optional[dict] = None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_taxonomy_path(filename: str) -> Path:
|
|
16
|
+
"""Get the path to a taxonomy file."""
|
|
17
|
+
# Get the directory where this file is located
|
|
18
|
+
current_dir = Path(__file__).parent
|
|
19
|
+
# Go up one level to agent0_sdk, then into taxonomies
|
|
20
|
+
taxonomy_dir = current_dir.parent / "taxonomies"
|
|
21
|
+
return taxonomy_dir / filename
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _load_skills() -> dict:
|
|
25
|
+
"""Load skills taxonomy file with caching."""
|
|
26
|
+
global _skills_cache
|
|
27
|
+
if _skills_cache is None:
|
|
28
|
+
skills_path = _get_taxonomy_path("all_skills.json")
|
|
29
|
+
try:
|
|
30
|
+
with open(skills_path, "r", encoding="utf-8") as f:
|
|
31
|
+
_skills_cache = json.load(f)
|
|
32
|
+
except FileNotFoundError:
|
|
33
|
+
raise FileNotFoundError(
|
|
34
|
+
f"Skills taxonomy file not found: {skills_path}"
|
|
35
|
+
)
|
|
36
|
+
except json.JSONDecodeError as e:
|
|
37
|
+
raise ValueError(
|
|
38
|
+
f"Invalid JSON in skills taxonomy file: {e}"
|
|
39
|
+
)
|
|
40
|
+
return _skills_cache
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _load_domains() -> dict:
|
|
44
|
+
"""Load domains taxonomy file with caching."""
|
|
45
|
+
global _domains_cache
|
|
46
|
+
if _domains_cache is None:
|
|
47
|
+
domains_path = _get_taxonomy_path("all_domains.json")
|
|
48
|
+
try:
|
|
49
|
+
with open(domains_path, "r", encoding="utf-8") as f:
|
|
50
|
+
_domains_cache = json.load(f)
|
|
51
|
+
except FileNotFoundError:
|
|
52
|
+
raise FileNotFoundError(
|
|
53
|
+
f"Domains taxonomy file not found: {domains_path}"
|
|
54
|
+
)
|
|
55
|
+
except json.JSONDecodeError as e:
|
|
56
|
+
raise ValueError(
|
|
57
|
+
f"Invalid JSON in domains taxonomy file: {e}"
|
|
58
|
+
)
|
|
59
|
+
return _domains_cache
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def validate_skill(slug: str) -> bool:
|
|
63
|
+
"""
|
|
64
|
+
Validate if a skill slug exists in the OASF taxonomy.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
slug: The skill slug to validate (e.g., "natural_language_processing/summarization")
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
True if the skill exists in the taxonomy, False otherwise
|
|
71
|
+
|
|
72
|
+
Raises:
|
|
73
|
+
FileNotFoundError: If the taxonomy file cannot be found
|
|
74
|
+
ValueError: If the taxonomy file is invalid JSON
|
|
75
|
+
"""
|
|
76
|
+
skills_data = _load_skills()
|
|
77
|
+
skills = skills_data.get("skills", {})
|
|
78
|
+
return slug in skills
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def validate_domain(slug: str) -> bool:
|
|
82
|
+
"""
|
|
83
|
+
Validate if a domain slug exists in the OASF taxonomy.
|
|
84
|
+
|
|
85
|
+
Args:
|
|
86
|
+
slug: The domain slug to validate (e.g., "finance_and_business/investment_services")
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
True if the domain exists in the taxonomy, False otherwise
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
FileNotFoundError: If the taxonomy file cannot be found
|
|
93
|
+
ValueError: If the taxonomy file is invalid JSON
|
|
94
|
+
"""
|
|
95
|
+
domains_data = _load_domains()
|
|
96
|
+
domains = domains_data.get("domains", {})
|
|
97
|
+
return slug in domains
|
|
98
|
+
|