mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
Feature: Log files (#423)
* log_file feature: added a new parameter for crew that creates a txt file to log agent execution * unit tests and documentation unit test if file is created but not what is inside the file
This commit is contained in:
@@ -894,3 +894,21 @@ def test_disabled_memory_using_contextual_memory():
|
||||
with patch.object(ContextualMemory, "build_context_for_task") as contextual_mem:
|
||||
crew.kickoff()
|
||||
contextual_mem.assert_not_called()
|
||||
|
||||
|
||||
@pytest.mark.vcr(filter_headers=["authorization"])
|
||||
def test_crew_log_file_output(tmp_path):
|
||||
test_file = tmp_path / "logs.txt"
|
||||
tasks = [
|
||||
Task(
|
||||
description="Say Hi",
|
||||
expected_output="The word: Hi",
|
||||
agent=researcher,
|
||||
)
|
||||
]
|
||||
|
||||
test_message = {"agent": "Researcher", "task": "Say Hi"}
|
||||
|
||||
crew = Crew(agents=[researcher], tasks=tasks, output_log_file=str(test_file))
|
||||
crew.kickoff()
|
||||
assert test_file.exists()
|
||||
|
||||
Reference in New Issue
Block a user