Files
aitbc/scripts/agent/list-agents.sh
aitbc 29b066a5dd
Some checks failed
Coverage Phase 1 (70% Target) / test-coverage-70 (push) Waiting to run
Coverage Phase 2 (85% Target) / test-coverage-85 (push) Waiting to run
Python Tests / test-python (push) Waiting to run
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled
Integration Tests / test-service-integration (push) Has been cancelled
Update data directory paths from /opt/aitbc/data to /var/lib/aitbc/data across all components
2026-05-27 12:45:18 +02:00

57 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# AITBC Mesh Network - List Agents Script
# ============================================================================
set -e
# Colors for output
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
AITBC_ROOT="${AITBC_ROOT:-/opt/aitbc}"
VENV_DIR="$AITBC_ROOT/venv"
PYTHON_CMD="$VENV_DIR/bin/python"
echo -e "${BLUE}🤖 AITBC Agent Registry${NC}"
echo "======================"
cd "$AITBC_ROOT"
"$PYTHON_CMD" -c "
import sys
import json
import time
# Load agent registry
with open('/var/lib/aitbc/data/agent_registry.json', 'r') as f:
registry = json.load(f)
print(f'Total Agents: {registry[\"total_agents\"]}')
print(f'Active Agents: {registry[\"active_agents\"]}')
print(f'Last Updated: {time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(registry[\"last_updated\"]))}')
print()
if registry['agents']:
print('Agent Details:')
print('=' * 80)
for i, (address, agent) in enumerate(registry['agents'].items(), 1):
print(f'{i}. {agent[\"name\"]}')
print(f' Address: {address}')
print(f' Capability: {agent[\"capabilities\"]}')
print(f' Reputation: {agent[\"reputation\"]}/5.0')
print(f' Jobs Completed: {agent[\"jobs_completed\"]}')
print(f' Total Earnings: {agent[\"total_earnings\"]:.2f} AITBC')
print(f' Stake: {agent[\"stake\"]:.2f} AITBC')
print(f' Status: {agent[\"status\"]}')
print(f' Created: {time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime(agent[\"created_at\"]))}')
print()
else:
print('No agents registered yet.')
print('Use: ./scripts/add-agent.sh <name> <capability> to add agents')
"