Improving agent logging

This commit is contained in:
João Moura
2024-03-11 17:05:54 -03:00
parent 1f95d7b982
commit cb5a528550
3 changed files with 13 additions and 6 deletions

View File

@@ -3,7 +3,6 @@ import uuid
from typing import Any, Dict, List, Optional, Union
from langchain_core.callbacks import BaseCallbackHandler
from pydantic import (
UUID4,
BaseModel,
@@ -68,7 +67,8 @@ class Crew(BaseModel):
description="Language model that will run the agent.", default=None
)
manager_callbacks: Optional[List[InstanceOf[BaseCallbackHandler]]] = Field(
default=None, description="A list of callback handlers to be executed by the manager agent when hierarchical process is used"
default=None,
description="A list of callback handlers to be executed by the manager agent when hierarchical process is used",
)
function_calling_llm: Optional[Any] = Field(
description="Language model that will run the agent.", default=None
@@ -232,8 +232,10 @@ class Crew(BaseModel):
task.tools += AgentTools(agents=agents_for_delegation).tools()
role = task.agent.role if task.agent is not None else "None"
self._logger.log("debug", f"Working Agent: {role}")
self._logger.log("info", f"Starting Task: {task.description}")
self._logger.log("debug", f" == Working Agent: {role}", color="bold_yellow")
self._logger.log(
"info", f" == Starting Task: {task.description}", color="bold_yellow"
)
output = task.execute(context=task_output)
if not task.async_execution: