mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-30 14:52:36 +00:00
style: apply ruff format to modified files
Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -1091,7 +1091,9 @@ class Agent(BaseAgent):
|
||||
)
|
||||
)
|
||||
|
||||
def get_delegation_tools(self, agents: Sequence[BaseAgent], task: Task | None = None) -> list[BaseTool]:
|
||||
def get_delegation_tools(
|
||||
self, agents: Sequence[BaseAgent], task: Task | None = None
|
||||
) -> list[BaseTool]:
|
||||
agent_tools = AgentTools(agents=agents, task=task)
|
||||
return agent_tools.tools()
|
||||
|
||||
|
||||
@@ -274,7 +274,9 @@ class LangGraphAgentAdapter(BaseAgentAdapter):
|
||||
available_tools: list[Any] = self._tool_adapter.tools()
|
||||
self._graph.tools = available_tools
|
||||
|
||||
def get_delegation_tools(self, agents: Sequence[BaseAgent], task: Any | None = None) -> list[BaseTool]:
|
||||
def get_delegation_tools(
|
||||
self, agents: Sequence[BaseAgent], task: Any | None = None
|
||||
) -> list[BaseTool]:
|
||||
"""Implement delegation tools support for LangGraph.
|
||||
|
||||
Creates delegation tools that allow this agent to delegate tasks to other agents.
|
||||
|
||||
@@ -223,7 +223,9 @@ class OpenAIAgentAdapter(BaseAgentAdapter):
|
||||
"""
|
||||
return self._converter_adapter.post_process_result(result.final_output)
|
||||
|
||||
def get_delegation_tools(self, agents: Sequence[BaseAgent], task: Any | None = None) -> list[BaseTool]:
|
||||
def get_delegation_tools(
|
||||
self, agents: Sequence[BaseAgent], task: Any | None = None
|
||||
) -> list[BaseTool]:
|
||||
"""Implement delegation tools support.
|
||||
|
||||
Creates delegation tools that allow this agent to delegate tasks to other agents.
|
||||
|
||||
@@ -1724,7 +1724,9 @@ class Crew(FlowTrackable, BaseModel):
|
||||
) -> list[BaseTool]:
|
||||
if self.manager_agent:
|
||||
if task.agent:
|
||||
tools = self._inject_delegation_tools(tools, task.agent, [task.agent], task=task)
|
||||
tools = self._inject_delegation_tools(
|
||||
tools, task.agent, [task.agent], task=task
|
||||
)
|
||||
else:
|
||||
tools = self._inject_delegation_tools(
|
||||
tools, self.manager_agent, self.agents, task=task
|
||||
|
||||
@@ -909,8 +909,9 @@ class Task(BaseModel):
|
||||
tasks_slices = [description]
|
||||
|
||||
if self.constraints:
|
||||
constraints_text = "\n\nTask Constraints (MUST be respected):\n" + "\n".join(
|
||||
f"- {constraint}" for constraint in self.constraints
|
||||
constraints_text = (
|
||||
"\n\nTask Constraints (MUST be respected):\n"
|
||||
+ "\n".join(f"- {constraint}" for constraint in self.constraints)
|
||||
)
|
||||
tasks_slices.append(constraints_text)
|
||||
|
||||
|
||||
@@ -16,7 +16,10 @@ class BaseAgentTool(BaseTool):
|
||||
"""Base class for agent-related tools"""
|
||||
|
||||
agents: list[BaseAgent] = Field(description="List of available agents")
|
||||
original_task: Task | None = Field(default=None, description="The original task being delegated, used to propagate constraints")
|
||||
original_task: Task | None = Field(
|
||||
default=None,
|
||||
description="The original task being delegated, used to propagate constraints",
|
||||
)
|
||||
|
||||
def sanitize_agent_name(self, name: str) -> str:
|
||||
"""
|
||||
@@ -130,8 +133,9 @@ class BaseAgentTool(BaseTool):
|
||||
constraints,
|
||||
)
|
||||
# Append constraints to context so the worker agent sees them
|
||||
constraints_text = "\n\nTask Constraints (MUST be respected):\n" + "\n".join(
|
||||
f"- {c}" for c in constraints
|
||||
constraints_text = (
|
||||
"\n\nTask Constraints (MUST be respected):\n"
|
||||
+ "\n".join(f"- {c}" for c in constraints)
|
||||
)
|
||||
if context:
|
||||
context = context + constraints_text
|
||||
|
||||
Reference in New Issue
Block a user