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/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 +``` 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}") 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",