chore: update file permissions to executable across repository
- Change file mode from 644 to 755 for all project files - Add chain_id parameter to get_balance RPC endpoint with default "ait-devnet" - Rename Miner.extra_meta_data to extra_metadata for consistency
This commit is contained in:
73
cli/aitbc_cli/commands/global_ai_agents.py
Normal file
73
cli/aitbc_cli/commands/global_ai_agents.py
Normal file
@@ -0,0 +1,73 @@
|
||||
"""
|
||||
Global AI Agents CLI Commands for AITBC
|
||||
Commands for managing global AI agent communication and collaboration
|
||||
"""
|
||||
|
||||
import click
|
||||
import json
|
||||
import requests
|
||||
from datetime import datetime
|
||||
from typing import Dict, Any, List, Optional
|
||||
|
||||
@click.group()
|
||||
def global_ai_agents():
|
||||
"""Global AI agents management commands"""
|
||||
pass
|
||||
|
||||
@global_ai_agents.command()
|
||||
@click.option('--agent-id', help='Specific agent ID')
|
||||
@click.option('--test-mode', is_flag=True, help='Run in test mode')
|
||||
def status(agent_id, test_mode):
|
||||
"""Get AI agent network status"""
|
||||
try:
|
||||
if test_mode:
|
||||
click.echo("🤖 AI Agent Network Status (test mode)")
|
||||
click.echo("📊 Total Agents: 125")
|
||||
click.echo("✅ Active Agents: 118")
|
||||
click.echo("🌍 Regions: 3")
|
||||
click.echo("⚡ Avg Response Time: 45ms")
|
||||
return
|
||||
|
||||
# Get status from service
|
||||
config = get_config()
|
||||
params = {}
|
||||
if agent_id:
|
||||
params["agent_id"] = agent_id
|
||||
|
||||
response = requests.get(
|
||||
f"{config.coordinator_url}/api/v1/network/status",
|
||||
params=params,
|
||||
headers={"Authorization": f"Bearer {config.api_key}"},
|
||||
timeout=30
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
status = response.json()
|
||||
dashboard = status['dashboard']
|
||||
click.echo("🤖 AI Agent Network Status")
|
||||
click.echo(f"📊 Total Agents: {dashboard.get('total_agents', 0)}")
|
||||
click.echo(f"✅ Active Agents: {dashboard.get('active_agents', 0)}")
|
||||
click.echo(f"🌍 Regions: {dashboard.get('regions', 0)}")
|
||||
click.echo(f"⚡ Avg Response Time: {dashboard.get('avg_response_time', 0)}ms")
|
||||
else:
|
||||
click.echo(f"❌ Failed to get status: {response.text}", err=True)
|
||||
|
||||
except Exception as e:
|
||||
click.echo(f"❌ Error getting status: {str(e)}", err=True)
|
||||
|
||||
# Helper function to get config
|
||||
def get_config():
|
||||
"""Get CLI configuration"""
|
||||
try:
|
||||
from .config import get_config
|
||||
return get_config()
|
||||
except ImportError:
|
||||
# Fallback for testing
|
||||
from types import SimpleNamespace
|
||||
return SimpleNamespace(
|
||||
coordinator_url="http://localhost:8018",
|
||||
api_key="test-api-key"
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
global_ai_agents()
|
||||
Reference in New Issue
Block a user