From 123f302744845bf5847c69575e455dd7258cdb74 Mon Sep 17 00:00:00 2001 From: nikolaidk <59203257+nikolaidk@users.noreply.github.com> Date: Tue, 25 Feb 2025 18:12:27 +0100 Subject: [PATCH 1/3] Update kickoff-async.mdx (#2138) Missing mandatory field expected_output on task in example Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> --- docs/how-to/kickoff-async.mdx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/how-to/kickoff-async.mdx b/docs/how-to/kickoff-async.mdx index 099c7ebc6..81300b19b 100644 --- a/docs/how-to/kickoff-async.mdx +++ b/docs/how-to/kickoff-async.mdx @@ -54,7 +54,8 @@ coding_agent = Agent( # Create a task that requires code execution data_analysis_task = Task( description="Analyze the given dataset and calculate the average age of participants. Ages: {ages}", - agent=coding_agent + agent=coding_agent, + expected_output="The average age of the participants." ) # Create a crew and add the task @@ -116,4 +117,4 @@ async def async_multiple_crews(): # Run the async function asyncio.run(async_multiple_crews()) -``` \ No newline at end of file +``` From 3d4a1e4b182174265c3580f951a169cef1e21d5f Mon Sep 17 00:00:00 2001 From: Victor Degliame <1413803+RealVidy@users.noreply.github.com> Date: Tue, 25 Feb 2025 18:16:04 +0100 Subject: [PATCH 2/3] fix: typo in 'delegate_work' and 'ask_question' promps (#2144) Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> --- src/crewai/translations/en.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crewai/translations/en.json b/src/crewai/translations/en.json index 4c28fc5d5..8a9dc6800 100644 --- a/src/crewai/translations/en.json +++ b/src/crewai/translations/en.json @@ -39,8 +39,8 @@ "validation_error": "### Previous attempt failed validation: {guardrail_result_error}\n\n\n### Previous result:\n{task_output}\n\n\nTry again, making sure to address the validation error." }, "tools": { - "delegate_work": "Delegate a specific task to one of the following coworkers: {coworkers}\nThe input to this tool should be the coworker, the task you want them to do, and ALL necessary context to execute the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them.", - "ask_question": "Ask a specific question to one of the following coworkers: {coworkers}\nThe input to this tool should be the coworker, the question you have for them, and ALL necessary context to ask the question properly, they know nothing about the question, so share absolute everything you know, don't reference things but instead explain them.", + "delegate_work": "Delegate a specific task to one of the following coworkers: {coworkers}\nThe input to this tool should be the coworker, the task you want them to do, and ALL necessary context to execute the task, they know nothing about the task, so share absolutely everything you know, don't reference things but instead explain them.", + "ask_question": "Ask a specific question to one of the following coworkers: {coworkers}\nThe input to this tool should be the coworker, the question you have for them, and ALL necessary context to ask the question properly, they know nothing about the question, so share absolutely everything you know, don't reference things but instead explain them.", "add_image": { "name": "Add image to content", "description": "See image to understand its content, you can optionally ask a question about the image", From ac9f8b9d5a0d54a39cbd65e42a2a7fc39d522981 Mon Sep 17 00:00:00 2001 From: Vidit Ostwal <110953813+Vidit-Ostwal@users.noreply.github.com> Date: Tue, 25 Feb 2025 22:59:33 +0530 Subject: [PATCH 3/3] Fixed the issue 2123 around memory command with CLI (#2155) * Fixed the issue 2123 around memory command with CLI * Fixed typo, added the recommendations * Fixed Typo * Fixed lint issue * Fixed the print statement to include path as well --------- Co-authored-by: Brandon Hancock (bhancock_ai) <109994880+bhancockio@users.noreply.github.com> --- docs/concepts/memory.mdx | 40 +++++++++++++++++++++++++++++++++++++++- src/crewai/cli/utils.py | 14 ++++++++------ 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/docs/concepts/memory.mdx b/docs/concepts/memory.mdx index ae65db290..298e8814c 100644 --- a/docs/concepts/memory.mdx +++ b/docs/concepts/memory.mdx @@ -506,7 +506,7 @@ my_crew = Crew( ) ``` -### Resetting Memory +### Resetting Memory via cli ```shell crewai reset-memories [OPTIONS] @@ -520,8 +520,46 @@ crewai reset-memories [OPTIONS] | `-s`, `--short` | Reset SHORT TERM memory. | Flag (boolean) | False | | `-e`, `--entities` | Reset ENTITIES memory. | Flag (boolean) | False | | `-k`, `--kickoff-outputs` | Reset LATEST KICKOFF TASK OUTPUTS. | Flag (boolean) | False | +| `-kn`, `--knowledge` | Reset KNOWLEDEGE storage | Flag (boolean) | False | | `-a`, `--all` | Reset ALL memories. | Flag (boolean) | False | +Note: To use the cli command you need to have your crew in a file called crew.py in the same directory. + + + + +### Resetting Memory via crew object + +```python + +my_crew = Crew( + agents=[...], + tasks=[...], + process=Process.sequential, + memory=True, + verbose=True, + embedder={ + "provider": "custom", + "config": { + "embedder": CustomEmbedder() + } + } +) + +my_crew.reset_memories(command_type = 'all') # Resets all the memory +``` + +#### Resetting Memory Options + +| Command Type | Description | +| :----------------- | :------------------------------- | +| `long` | Reset LONG TERM memory. | +| `short` | Reset SHORT TERM memory. | +| `entities` | Reset ENTITIES memory. | +| `kickoff_outputs` | Reset LATEST KICKOFF TASK OUTPUTS. | +| `knowledge` | Reset KNOWLEDGE memory. | +| `all` | Reset ALL memories. | + ## Benefits of Using CrewAI's Memory System diff --git a/src/crewai/cli/utils.py b/src/crewai/cli/utils.py index 60eb2488a..8912036db 100644 --- a/src/crewai/cli/utils.py +++ b/src/crewai/cli/utils.py @@ -257,11 +257,11 @@ def get_crew(crew_path: str = "crew.py", require: bool = False) -> Crew | None: import os for root, _, files in os.walk("."): - if "crew.py" in files: - crew_path = os.path.join(root, "crew.py") + if crew_path in files: + crew_os_path = os.path.join(root, crew_path) try: spec = importlib.util.spec_from_file_location( - "crew_module", crew_path + "crew_module", crew_os_path ) if not spec or not spec.loader: continue @@ -273,9 +273,11 @@ def get_crew(crew_path: str = "crew.py", require: bool = False) -> Crew | None: for attr_name in dir(module): attr = getattr(module, attr_name) try: - if callable(attr) and hasattr(attr, "crew"): - crew_instance = attr().crew() - return crew_instance + if isinstance(attr, Crew) and hasattr(attr, "kickoff"): + print( + f"Found valid crew object in attribute '{attr_name}' at {crew_os_path}." + ) + return attr except Exception as e: print(f"Error processing attribute {attr_name}: {e}")