import logging from art import text2art from colorama import init, Fore, Style from datetime import datetime # Initialize colorama init() logger = logging.getLogger(__name__) class AgentVisualManager: """Provides visual feedback for agent operations""" def show_agent_status(self, agent_name: str, status: str): """Display agent status with visual feedback""" colors = { "initializing": Fore.YELLOW, "processing": Fore.BLUE, "completed": Fore.GREEN, "error": Fore.RED, "waiting": Fore.CYAN } stages = { "initializing": f""" {colors["initializing"]}┌────────────────────┐ │ Agent Init │ │ {agent_name:<14} │ └────────────────────┘{Style.RESET_ALL} """, "processing": f""" {colors["processing"]}┌────────────────────┐ │ Processing │ ⚙️ │ {agent_name:<14} │ └────────────────────┘{Style.RESET_ALL} """, "completed": f""" {colors["completed"]}┌────────────────────┐ │ Completed! │ ✅ │ {agent_name:<14} │ └────────────────────┘{Style.RESET_ALL} """, "error": f""" {colors["error"]}┌────────────────────┐ │ Error! │ ❌ │ {agent_name:<14} │ └────────────────────┘{Style.RESET_ALL} """, "waiting": f""" {colors["waiting"]}┌────────────────────┐ │ Waiting │ ⏳ │ {agent_name:<14} │ └────────────────────┘{Style.RESET_ALL} """ } print(f"\n{datetime.now().strftime('%H:%M:%S')} - ", end="") print(stages.get(status, "")) def show_agent_communication(self, from_agent: str, to_agent: str, message_type: str = "request"): """Display agent communication flow""" arrow = "──→" if message_type == "request" else "←──" color = Fore.BLUE if message_type == "request" else Fore.GREEN print(f""" {color}┌─────────────┐ {arrow} ┌─────────────┐ │ {from_agent:<11}│ │ {to_agent:<11}│ └─────────────┘ └─────────────┘{Style.RESET_ALL} """) def show_team_formation(self, team_leader: str, team_members: list): """Display team structure""" print(Fore.CYAN + text2art("Team Formation") + Style.RESET_ALL) print(f""" {Fore.YELLOW}┌─────────────┐ │ LEADER │ │ {team_leader:<11}│ └─────────────┘{Style.RESET_ALL} │ """) for member in team_members: if member != team_leader: print(f""" {Fore.BLUE} ↓ ┌─────────────┐ │ {member:<11}│ └─────────────┘{Style.RESET_ALL}""")