diff --git a/src/crewai/tools/agent_tools.py b/src/crewai/tools/agent_tools.py index fd489db73..43796fd64 100644 --- a/src/crewai/tools/agent_tools.py +++ b/src/crewai/tools/agent_tools.py @@ -15,22 +15,23 @@ class AgentTools(BaseModel): i18n: I18N = Field(default=I18N(), description="Internationalization settings.") def tools(self): - return [ + tools = [ StructuredTool.from_function( func=self.delegate_work, name="Delegate work to co-worker", description=self.i18n.tools("delegate_work").format( - coworkers=[f"{agent.role}" for agent in self.agents] + coworkers=f"[{', '.join([f'{agent.role}' for agent in self.agents])}]" ), ), StructuredTool.from_function( func=self.ask_question, name="Ask question to co-worker", description=self.i18n.tools("ask_question").format( - coworkers=[f"{agent.role}" for agent in self.agents] + coworkers=f"[{', '.join([f'{agent.role}' for agent in self.agents])}]" ), ), ] + return tools def delegate_work(self, coworker: str, task: str, context: str): """Useful to delegate a specific task to a coworker passing all necessary context and names."""