Spaces:
Sleeping
Sleeping
refactor: Reduce verbosity in agent outputs and enhance message formatting in chat interface
b58981e
| # src/agents/manager_agent.py | |
| from smolagents import CodeAgent, InferenceClientModel | |
| from dotenv import load_dotenv | |
| import os | |
| # Import tools directly - simpler approach following smolagents best practices | |
| from src.agents.web_agents import web_agent | |
| from src.agents.gmail_agent import gmail_agent | |
| from src.agents.bookmarks_agent import bookmarks_agent | |
| from src.agents.categoriser_agent import categoriser_agent | |
| load_dotenv() | |
| # Create a single focused agent instead of complex multi-agent system | |
| # This follows the smolagents principle: "The best agentic systems are the simplest" | |
| manager_agent = CodeAgent( | |
| model=InferenceClientModel( | |
| provider="nebius", | |
| token=os.environ["HF_TOKEN"], | |
| ), | |
| managed_agents=[web_agent, gmail_agent, bookmarks_agent, categoriser_agent], | |
| name="digital_assistant", | |
| tools=[], | |
| description=( | |
| "I'm a comprehensive digital assistant that helps you with multiple tasks:\n\n" | |
| "📧 **Email Management:**\n" | |
| "• Get recent emails from trusted senders (habib.adoum01@gmail.com and news@alphasignal.ai)\n" | |
| "• Search emails by keywords\n" | |
| "• Read full email content\n\n" | |
| "🔍 **Web Search:**\n" | |
| "• Perform web searches to find current information\n" | |
| "• Research topics and gather up-to-date data\n\n" | |
| "🔖 **Chrome Bookmarks Management:**\n" | |
| "• Search and filter AI resources bookmarks\n" | |
| "• Get bookmark statistics and information\n" | |
| "• Filter bookmarks by domain\n" | |
| "• Cache and manage Chrome bookmarks data\n\n" | |
| "🏷️ **AI News Categorization:**\n" | |
| "• Categorize AI bookmarks into 10 predefined categories\n" | |
| "• Get categorization statistics and insights\n" | |
| "• Search bookmarks by category\n" | |
| "• Manually recategorize bookmarks when needed\n\n" | |
| "I combine these capabilities to help you with research, information gathering, and digital organization tasks." | |
| ), | |
| max_steps=10, # Reduced to prevent token overflow | |
| additional_authorized_imports=["json"], | |
| # Add planning to help with complex queries | |
| planning_interval=3, # Plan every 3 steps to maintain focus | |
| # Reduce verbosity - disable streaming outputs and minimize console display | |
| stream_outputs=False, # Disable live streaming of thoughts to terminal | |
| max_print_outputs_length=500, # Limit output length to reduce terminal noise | |
| ) | |