Spaces:
Sleeping
Sleeping
File size: 1,404 Bytes
ce0ec3b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
"""
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
|