agent0-sdk 0.2.1__py3-none-any.whl → 0.3rc1__py3-none-any.whl
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/__init__.py +1 -1
- agent0_sdk/core/contracts.py +7 -0
- agent0_sdk/core/endpoint_crawler.py +79 -19
- agent0_sdk/core/feedback_manager.py +101 -1
- agent0_sdk/core/indexer.py +750 -12
- agent0_sdk/core/ipfs_client.py +1 -1
- agent0_sdk/core/models.py +3 -2
- agent0_sdk/core/sdk.py +207 -4
- agent0_sdk/core/subgraph_client.py +23 -3
- {agent0_sdk-0.2.1.dist-info → agent0_sdk-0.3rc1.dist-info}/METADATA +3 -5
- agent0_sdk-0.3rc1.dist-info/RECORD +29 -0
- tests/discover_test_data.py +445 -0
- tests/test_multi_chain.py +588 -0
- tests/test_search.py +145 -1
- agent0_sdk-0.2.1.dist-info/RECORD +0 -27
- {agent0_sdk-0.2.1.dist-info → agent0_sdk-0.3rc1.dist-info}/WHEEL +0 -0
- {agent0_sdk-0.2.1.dist-info → agent0_sdk-0.3rc1.dist-info}/licenses/LICENSE +0 -0
- {agent0_sdk-0.2.1.dist-info → agent0_sdk-0.3rc1.dist-info}/top_level.txt +0 -0
tests/test_search.py
CHANGED
|
@@ -15,6 +15,13 @@ Flow:
|
|
|
15
15
|
10. Search agents by reputation with capability filtering
|
|
16
16
|
11. Advanced: Find top-rated agents with specific skills
|
|
17
17
|
12. Advanced: Find agents with multiple requirements
|
|
18
|
+
13. Pagination test
|
|
19
|
+
14. Sort by activity test
|
|
20
|
+
15. Search agents by single owner address
|
|
21
|
+
16. Search agents by multiple owner addresses
|
|
22
|
+
17. Search agents by operator addresses
|
|
23
|
+
18. Combined search: owner + active status
|
|
24
|
+
19. Combined search: owner + name filter
|
|
18
25
|
"""
|
|
19
26
|
|
|
20
27
|
import logging
|
|
@@ -261,7 +268,144 @@ def main():
|
|
|
261
268
|
print(f" {i}. ID {agent_id}: {agent['name']}")
|
|
262
269
|
except Exception as e:
|
|
263
270
|
print(f"❌ Failed activity sort: {e}")
|
|
264
|
-
|
|
271
|
+
|
|
272
|
+
print(f"\n📍 Step 15: Search Agents by Single Owner Address")
|
|
273
|
+
print("-" * 60)
|
|
274
|
+
try:
|
|
275
|
+
# First, get an agent to extract its owner address for testing
|
|
276
|
+
test_agent = sdk.getAgent(AGENT_ID)
|
|
277
|
+
if hasattr(test_agent, 'owner') and test_agent.owner:
|
|
278
|
+
owner_address = test_agent.owner
|
|
279
|
+
print(f" Testing with owner address: {owner_address}")
|
|
280
|
+
|
|
281
|
+
results = sdk.searchAgents(owners=[owner_address])
|
|
282
|
+
agents = results.get('items', [])
|
|
283
|
+
print(f"✅ Found {len(agents)} agent(s) owned by {owner_address[:10]}...{owner_address[-8:]}")
|
|
284
|
+
|
|
285
|
+
for i, agent in enumerate(agents[:3], 1):
|
|
286
|
+
agent_id = agent.get('agentId', agent.get('id', 'N/A'))
|
|
287
|
+
agent_owner = agent.get('owner', 'N/A')
|
|
288
|
+
print(f" {i}. {agent['name']} (ID: {agent_id})")
|
|
289
|
+
print(f" Owner: {agent_owner[:10]}...{agent_owner[-8:] if len(agent_owner) > 18 else agent_owner}")
|
|
290
|
+
else:
|
|
291
|
+
print("⚠️ Test agent doesn't have owner information")
|
|
292
|
+
except Exception as e:
|
|
293
|
+
print(f"❌ Failed to search by single owner: {e}")
|
|
294
|
+
|
|
295
|
+
print(f"\n📍 Step 16: Search Agents by Multiple Owner Addresses")
|
|
296
|
+
print("-" * 60)
|
|
297
|
+
try:
|
|
298
|
+
# Get multiple agents to collect different owner addresses
|
|
299
|
+
results = sdk.searchAgents(page_size=5)
|
|
300
|
+
agents = results.get('items', [])
|
|
301
|
+
owner_addresses = []
|
|
302
|
+
|
|
303
|
+
for agent in agents:
|
|
304
|
+
if agent.get('owner') and agent['owner'] not in owner_addresses:
|
|
305
|
+
owner_addresses.append(agent['owner'])
|
|
306
|
+
if len(owner_addresses) >= 2:
|
|
307
|
+
break
|
|
308
|
+
|
|
309
|
+
if len(owner_addresses) >= 2:
|
|
310
|
+
print(f" Testing with {len(owner_addresses)} owner addresses")
|
|
311
|
+
results = sdk.searchAgents(owners=owner_addresses)
|
|
312
|
+
agents = results.get('items', [])
|
|
313
|
+
print(f"✅ Found {len(agents)} agent(s) owned by multiple addresses")
|
|
314
|
+
|
|
315
|
+
for i, agent in enumerate(agents[:5], 1):
|
|
316
|
+
agent_id = agent.get('agentId', agent.get('id', 'N/A'))
|
|
317
|
+
agent_owner = agent.get('owner', 'N/A')
|
|
318
|
+
print(f" {i}. {agent['name']} (Owner: {agent_owner[:10]}...{agent_owner[-8:] if len(agent_owner) > 18 else agent_owner})")
|
|
319
|
+
else:
|
|
320
|
+
print("⚠️ Not enough different owners found for multi-owner test")
|
|
321
|
+
except Exception as e:
|
|
322
|
+
print(f"❌ Failed to search by multiple owners: {e}")
|
|
323
|
+
|
|
324
|
+
print(f"\n📍 Step 17: Search Agents by Operator Addresses")
|
|
325
|
+
print("-" * 60)
|
|
326
|
+
try:
|
|
327
|
+
# First check if any agents have operators defined
|
|
328
|
+
results = sdk.searchAgents(page_size=10)
|
|
329
|
+
agents = results.get('items', [])
|
|
330
|
+
test_operators = []
|
|
331
|
+
|
|
332
|
+
for agent in agents:
|
|
333
|
+
if agent.get('operators') and len(agent['operators']) > 0:
|
|
334
|
+
test_operators = agent['operators'][:1] # Use first operator
|
|
335
|
+
print(f" Testing with operator: {test_operators[0][:10]}...{test_operators[0][-8:]}")
|
|
336
|
+
break
|
|
337
|
+
|
|
338
|
+
if test_operators:
|
|
339
|
+
results = sdk.searchAgents(operators=test_operators)
|
|
340
|
+
found_agents = results.get('items', [])
|
|
341
|
+
print(f"✅ Found {len(found_agents)} agent(s) with specified operator")
|
|
342
|
+
|
|
343
|
+
for i, agent in enumerate(found_agents[:3], 1):
|
|
344
|
+
agent_id = agent.get('agentId', agent.get('id', 'N/A'))
|
|
345
|
+
agent_operators = agent.get('operators', [])
|
|
346
|
+
print(f" {i}. {agent['name']} (ID: {agent_id})")
|
|
347
|
+
if agent_operators:
|
|
348
|
+
print(f" Operators: {len(agent_operators)} total")
|
|
349
|
+
else:
|
|
350
|
+
print("⚠️ No agents with operators found for testing")
|
|
351
|
+
except Exception as e:
|
|
352
|
+
print(f"❌ Failed to search by operators: {e}")
|
|
353
|
+
|
|
354
|
+
print(f"\n📍 Step 18: Combined Search - Owner + Active Status")
|
|
355
|
+
print("-" * 60)
|
|
356
|
+
try:
|
|
357
|
+
# Get an owner address from an active agent
|
|
358
|
+
results = sdk.searchAgents(active=True, page_size=5)
|
|
359
|
+
agents = results.get('items', [])
|
|
360
|
+
|
|
361
|
+
if agents and agents[0].get('owner'):
|
|
362
|
+
test_owner = agents[0]['owner']
|
|
363
|
+
print(f" Testing owner {test_owner[:10]}...{test_owner[-8:]} + active=True")
|
|
364
|
+
|
|
365
|
+
results = sdk.searchAgents(owners=[test_owner], active=True)
|
|
366
|
+
found_agents = results.get('items', [])
|
|
367
|
+
print(f"✅ Found {len(found_agents)} active agent(s) owned by specified address")
|
|
368
|
+
|
|
369
|
+
for i, agent in enumerate(found_agents[:3], 1):
|
|
370
|
+
agent_id = agent.get('agentId', agent.get('id', 'N/A'))
|
|
371
|
+
print(f" {i}. {agent['name']} (ID: {agent_id})")
|
|
372
|
+
print(f" Active: {agent.get('active', False)}, Owner: {agent.get('owner', 'N/A')[:10]}...")
|
|
373
|
+
else:
|
|
374
|
+
print("⚠️ No active agents with owner information found")
|
|
375
|
+
except Exception as e:
|
|
376
|
+
print(f"❌ Failed combined owner + active search: {e}")
|
|
377
|
+
|
|
378
|
+
print(f"\n📍 Step 19: Combined Search - Owner + Name Filter")
|
|
379
|
+
print("-" * 60)
|
|
380
|
+
try:
|
|
381
|
+
# Get agents and find one with both name and owner
|
|
382
|
+
results = sdk.searchAgents(page_size=10)
|
|
383
|
+
agents = results.get('items', [])
|
|
384
|
+
|
|
385
|
+
test_agent = None
|
|
386
|
+
for agent in agents:
|
|
387
|
+
if agent.get('owner') and agent.get('name'):
|
|
388
|
+
test_agent = agent
|
|
389
|
+
break
|
|
390
|
+
|
|
391
|
+
if test_agent:
|
|
392
|
+
test_owner = test_agent['owner']
|
|
393
|
+
# Use partial name for search
|
|
394
|
+
name_part = test_agent['name'][:4] if len(test_agent['name']) > 4 else test_agent['name']
|
|
395
|
+
print(f" Testing owner filter + name contains '{name_part}'")
|
|
396
|
+
|
|
397
|
+
results = sdk.searchAgents(owners=[test_owner], name=name_part)
|
|
398
|
+
found_agents = results.get('items', [])
|
|
399
|
+
print(f"✅ Found {len(found_agents)} agent(s) matching both criteria")
|
|
400
|
+
|
|
401
|
+
for i, agent in enumerate(found_agents[:3], 1):
|
|
402
|
+
agent_id = agent.get('agentId', agent.get('id', 'N/A'))
|
|
403
|
+
print(f" {i}. {agent['name']} (ID: {agent_id})")
|
|
404
|
+
else:
|
|
405
|
+
print("⚠️ No suitable test agent found")
|
|
406
|
+
except Exception as e:
|
|
407
|
+
print(f"❌ Failed combined owner + name search: {e}")
|
|
408
|
+
|
|
265
409
|
print("\n" + "=" * 60)
|
|
266
410
|
print("✅ Search Tests Completed!")
|
|
267
411
|
print("=" * 60)
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
agent0_sdk/__init__.py,sha256=-OXCylWFuiIbSCs9CHqmWoc8mVDRUhIlHyATUJkRBwo,919
|
|
2
|
-
agent0_sdk/core/agent.py,sha256=RQND8F3Hmmpnt-PqCXBP7T8KfrjTXo0_X2nZoMJh01w,33343
|
|
3
|
-
agent0_sdk/core/contracts.py,sha256=mER1pSae4-fiGBwaVTi7oqJ_QYaDnrtyIF7g6dkdE-0,19889
|
|
4
|
-
agent0_sdk/core/endpoint_crawler.py,sha256=JFLW4-SoQlpyXsUDWeOb6h-u1ilEKNVQF0r6LI-3k68,11026
|
|
5
|
-
agent0_sdk/core/feedback_manager.py,sha256=wkV-P5wgDwOLwhaf22qOl-3S2F_PNI7oCHBBZMAxugI,36017
|
|
6
|
-
agent0_sdk/core/indexer.py,sha256=XIW0WN9PlcDn-2p_W1y9OviYH6fCGHCSrdtGEaP02xo,40328
|
|
7
|
-
agent0_sdk/core/ipfs_client.py,sha256=YHZRsgHlxl3bpkaHORunBtVMNEPWKfn_xx92Yi6l1Fk,13907
|
|
8
|
-
agent0_sdk/core/models.py,sha256=bQARVmKETiVL5uJpHxXGN2wY2GFrdzxhPHqjzL8TBlQ,12373
|
|
9
|
-
agent0_sdk/core/sdk.py,sha256=stOurnsSoedUFKaHKhrjaM1sghBzjighizV6AaZD7-U,31560
|
|
10
|
-
agent0_sdk/core/subgraph_client.py,sha256=XXFVFAoHcgEfqxc2w2OksSp8vtbKMtsNIuNbNcNQOzE,27280
|
|
11
|
-
agent0_sdk/core/web3_client.py,sha256=859ntu5dAmNlcJ3YM1w_VV2gI3mpCC9QEr-GN1236zU,6850
|
|
12
|
-
agent0_sdk-0.2.1.dist-info/licenses/LICENSE,sha256=rhZZbZm_Ovz4Oa9LNQ-ms8a1tA36wWh90ZkC0OR7WMw,1072
|
|
13
|
-
tests/__init__.py,sha256=60ffheccPhuMCtwiiKP1X-CJJXKpxJ_Ywa0aXGHR9bY,23
|
|
14
|
-
tests/config.py,sha256=1uePvkLBNubOQsvYkQSno0m007PMD1VACgm33fCYY6s,1429
|
|
15
|
-
tests/conftest.py,sha256=P-HCtVVYwSvscuaJqhrgZcv39XXNnr932ekEamzIqis,589
|
|
16
|
-
tests/test_feedback.py,sha256=7lszWYSmseJE0I4BhKzZdBiIzf2bgpPqZTZvhRrCTjY,14638
|
|
17
|
-
tests/test_models.py,sha256=kCZdoPasIIcOjEw7ToPldqARdbGVK8v8byOhFwVo7OI,7115
|
|
18
|
-
tests/test_real_public_servers.py,sha256=pCo4aLSCG9qv4D6T7jbyVmP1gt3r1jWxdes6z5XSNhU,3433
|
|
19
|
-
tests/test_registration.py,sha256=pYanDPLAFETIfabBUvO34ZDmyD0Rbcv8vecSfgSrQ70,9542
|
|
20
|
-
tests/test_registrationIpfs.py,sha256=9O3IBiN2CVMKzB19bqb-jN-nhqsN22kQINMpe9THqiI,8400
|
|
21
|
-
tests/test_sdk.py,sha256=dALLFm_A6aXx0ec-CNOLGQoadaSPZ08EEeCS6Tgnm0M,9362
|
|
22
|
-
tests/test_search.py,sha256=YC5Zd0c99JhFoy7POwrUkb36I1Q3S9hJPIQrIZIJCwI,11850
|
|
23
|
-
tests/test_transfer.py,sha256=zRBllpoMs6NhagAmaZWmD4ckbYjSvsSUerBK4oS-HlA,9258
|
|
24
|
-
agent0_sdk-0.2.1.dist-info/METADATA,sha256=hoLm4OlzGmLq62SnlDAm09-izRz2YsadSaODGa2bOxs,11424
|
|
25
|
-
agent0_sdk-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
-
agent0_sdk-0.2.1.dist-info/top_level.txt,sha256=rgGBfOJlLi1zInQ85jBL2MpDu_ZJNbPjIGz-3Vn5rZs,17
|
|
27
|
-
agent0_sdk-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|