mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-27 09:08:14 +00:00
Merge branch 'main' into bugfix/kickoff-for-each-usage-metrics
This commit is contained in:
@@ -77,6 +77,9 @@ class Agent(BaseAgent):
|
|||||||
default=None, description="Response format for the agent."
|
default=None, description="Response format for the agent."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
allow_code_execution: Optional[bool] = Field(
|
||||||
|
default=False, description="Enable code execution for the agent."
|
||||||
|
)
|
||||||
allow_code_execution: Optional[bool] = Field(
|
allow_code_execution: Optional[bool] = Field(
|
||||||
default=False, description="Enable code execution for the agent."
|
default=False, description="Enable code execution for the agent."
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,15 +5,15 @@ from typing import Any, Dict, List, Optional, Union
|
|||||||
|
|
||||||
from langchain_core.callbacks import BaseCallbackHandler
|
from langchain_core.callbacks import BaseCallbackHandler
|
||||||
from pydantic import (
|
from pydantic import (
|
||||||
UUID4,
|
UUID4,
|
||||||
BaseModel,
|
BaseModel,
|
||||||
ConfigDict,
|
ConfigDict,
|
||||||
Field,
|
Field,
|
||||||
InstanceOf,
|
InstanceOf,
|
||||||
Json,
|
Json,
|
||||||
PrivateAttr,
|
PrivateAttr,
|
||||||
field_validator,
|
field_validator,
|
||||||
model_validator,
|
model_validator,
|
||||||
)
|
)
|
||||||
from pydantic_core import PydanticCustomError
|
from pydantic_core import PydanticCustomError
|
||||||
|
|
||||||
@@ -404,6 +404,7 @@ class Crew(BaseModel):
|
|||||||
]
|
]
|
||||||
if len(self.agents) > 1 and len(agents_for_delegation) > 0:
|
if len(self.agents) > 1 and len(agents_for_delegation) > 0:
|
||||||
task.tools += task.agent.get_delegation_tools(agents_for_delegation)
|
task.tools += task.agent.get_delegation_tools(agents_for_delegation)
|
||||||
|
task.tools += task.agent.get_delegation_tools(agents_for_delegation)
|
||||||
|
|
||||||
role = task.agent.role if task.agent is not None else "None"
|
role = task.agent.role if task.agent is not None else "None"
|
||||||
self._logger.log("debug", f"== Working Agent: {role}", color="bold_purple")
|
self._logger.log("debug", f"== Working Agent: {role}", color="bold_purple")
|
||||||
@@ -586,9 +587,3 @@ class Crew(BaseModel):
|
|||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"Crew(id={self.id}, process={self.process}, number_of_agents={len(self.agents)}, number_of_tasks={len(self.tasks)})"
|
return f"Crew(id={self.id}, process={self.process}, number_of_agents={len(self.agents)}, number_of_tasks={len(self.tasks)})"
|
||||||
|
|
||||||
def aggregate_token_usage(self, token_usage_list: List[Dict[str, Any]]):
|
|
||||||
return {
|
|
||||||
key: sum([m[key] for m in token_usage_list if m is not None])
|
|
||||||
for key in token_usage_list[0]
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ from pydantic_core import PydanticCustomError
|
|||||||
from crewai.agents.agent_builder.base_agent import BaseAgent
|
from crewai.agents.agent_builder.base_agent import BaseAgent
|
||||||
from crewai.tasks.task_output import TaskOutput
|
from crewai.tasks.task_output import TaskOutput
|
||||||
from crewai.telemetry.telemetry import Telemetry
|
from crewai.telemetry.telemetry import Telemetry
|
||||||
from crewai.utilities import I18N, ConverterError, Printer
|
from crewai.utilities.converter import ConverterError
|
||||||
|
from crewai.utilities.i18n import I18N
|
||||||
|
from crewai.utilities.printer import Printer
|
||||||
from crewai.utilities.pydantic_schema_parser import PydanticSchemaParser
|
from crewai.utilities.pydantic_schema_parser import PydanticSchemaParser
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|||||||
Reference in New Issue
Block a user