added to docs and fixed tests

This commit is contained in:
Lorenze Jay
2024-07-15 08:24:34 -07:00
parent d28ae857b7
commit 6bb909d77a
4 changed files with 14 additions and 8 deletions

View File

@@ -170,6 +170,13 @@ To use the replay feature, follow these steps:
2. Navigate to the directory where your CrewAI project is located. 2. Navigate to the directory where your CrewAI project is located.
3. Run the following command: 3. Run the following command:
To view latest kickoff task_ids use:
```shell
crewai log-tasks-outputs
```
```shell ```shell
crewai replay -t <task_id> crewai replay -t <task_id>
``` ```

View File

@@ -5,7 +5,6 @@ from typing import Any, List, Optional, Tuple
from langchain.agents.agent import RunnableAgent from langchain.agents.agent import RunnableAgent
from langchain.agents.tools import BaseTool from langchain.agents.tools import BaseTool
from langchain.agents.tools import tool as LangChainTool from langchain.agents.tools import tool as LangChainTool
from langchain.tools.base import StructuredTool
from langchain_core.agents import AgentAction from langchain_core.agents import AgentAction
from langchain_core.callbacks import BaseCallbackHandler from langchain_core.callbacks import BaseCallbackHandler
from langchain_openai import ChatOpenAI from langchain_openai import ChatOpenAI
@@ -299,7 +298,7 @@ class Agent(BaseAgent):
agent=RunnableAgent(runnable=inner_agent), **executor_args agent=RunnableAgent(runnable=inner_agent), **executor_args
) )
def get_delegation_tools(self, agents: List[BaseAgent]) -> List[StructuredTool]: def get_delegation_tools(self, agents: List[BaseAgent]):
agent_tools = AgentTools(agents=agents) agent_tools = AgentTools(agents=agents)
tools = agent_tools.tools() tools = agent_tools.tools()
return tools return tools

View File

@@ -14,7 +14,7 @@ class KickoffTaskOutputsSQLiteStorage:
""" """
def __init__( def __init__(
self, db_path: str = f"{db_storage_path()}/kickoff_task_outputs.db" self, db_path: str = f"{db_storage_path()}/long_term_memory_storage.dbs"
) -> None: ) -> None:
self.db_path = db_path self.db_path = db_path
self._printer: Printer = Printer() self._printer: Printer = Printer()
@@ -126,7 +126,7 @@ class KickoffTaskOutputsSQLiteStorage:
with sqlite3.connect(self.db_path) as conn: with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute(""" cursor.execute("""
SELECT task_id, expected_output, output, task_index, inputs, was_replayed, timestamp SELECT *
FROM latest_kickoff_task_outputs FROM latest_kickoff_task_outputs
ORDER BY task_index ORDER BY task_index
""") """)

View File

@@ -1236,10 +1236,10 @@ def test_agent_usage_metrics_are_captured_for_hierarchical_process():
print(crew.usage_metrics) print(crew.usage_metrics)
assert crew.usage_metrics == { assert crew.usage_metrics == {
"total_tokens": 2217, "total_tokens": 311,
"prompt_tokens": 1847, "prompt_tokens": 224,
"completion_tokens": 370, "completion_tokens": 87,
"successful_requests": 4, "successful_requests": 1,
} }