Files
aiagent/scripts/check_agents.py

22 lines
693 B
Python
Raw Normal View History

import json, subprocess, sys
# Login
r = subprocess.run([
'curl', '-s', '-X', 'POST',
'http://localhost:8037/api/v1/auth/login',
'-H', 'Content-Type: application/x-www-form-urlencoded',
'-d', 'username=admin&password=123456'
], capture_output=True, text=True)
token = json.loads(r.stdout)['access_token']
# Get agents
r = subprocess.run([
'curl', '-s', 'http://localhost:8037/api/v1/agents?skip=0&limit=50',
'-H', f'Authorization: Bearer {token}'
], capture_output=True, text=True)
agents = json.loads(r.stdout)
print(f'Agent数: {len(agents)}')
for a in agents:
print(f' {a["name"][:25]:25s} cat={str(a.get("category","N/A")):15s} pub={a.get("is_public",0)}')