Spaces:
Sleeping
Sleeping
""" | |
Manager agent for coordinating the lyrics search and analysis process. | |
""" | |
from smolagents import CodeAgent, FinalAnswerTool | |
from loguru import logger | |
from config import AGENT_CONFIG, load_prompt_templates | |
from agents.web_agent import create_web_agent | |
from agents.analysis_agent import create_analysis_agent | |
def create_manager_agent(model): | |
""" | |
Create a manager agent that coordinates the web and analysis agents. | |
Args: | |
model: The LLM model to use with this agent | |
Returns: | |
A configured CodeAgent manager for coordinating other agents | |
""" | |
# Get configuration values | |
config = AGENT_CONFIG['manager_agent'] | |
prompt_templates = load_prompt_templates() | |
# Create sub-agents | |
web_agent = create_web_agent(model) | |
analysis_agent = create_analysis_agent(model) | |
# Create and return the manager agent | |
agent = CodeAgent( | |
model=model, | |
tools=[FinalAnswerTool()], | |
name="manager_agent", | |
description=config['description'], | |
managed_agents=[web_agent, analysis_agent], | |
additional_authorized_imports=["json"], | |
planning_interval=config['planning_interval'], | |
verbosity_level=config['verbosity_level'], | |
max_steps=config['max_steps'], | |
prompt_templates=prompt_templates | |
) | |
logger.info("Manager agent created successfully") | |
return agent | |