Spaces:
Build error
Build error
Download tools/agent_visual_manager.py from sp103107/agent-system: direct link, hf CLI and curl.
- Browser
- Download file 3.74 kB
-
https://huggingface.co/spaces/sp103107/agent-system/resolve/main/tools/agent_visual_manager.py
- Command line
-
hf download hf://spaces/sp103107/agent-system/tools/agent_visual_manager.py
-
curl -L -o agent_visual_manager.py https://huggingface.co/spaces/sp103107/agent-system/resolve/main/tools/agent_visual_manager.py
3.74 kB
| 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}""") |