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 | |
) | |