* CLI command added
* Added reset agent knowledge function
* Reduced verbose
* Added test cases
* Added docs
* Llama test case failing
* Changed _reset_agent_knowledge function
* Fixed new line error
* Added docs
* fixed the new line error
* Refractored
* Uncommmented some test cases
* ruff check fixed
* fixed run type checks
* fixed run type checks
* fixed run type checks
* Made reset_fn callable by casting to silence run type checks
* Changed the reset_knowledge as it expects only list of knowledge
* Fixed typo in docs
* Refractored the memory_system
* Minor Changes
* fixed test case
* Fixed linting issues
* Network test cases failing
---------
Co-authored-by: Lucas Gomide <lucaslg200@gmail.com>
During the sys.stdout = FilteredStream(old_stdout) assignment, if any code (including logging, print, or internal library output) writes to sys.stdout immediately, and that write happens before __init__ completes, the write() method is called on a not-fully-initialized object.. hence _lock doesn’t exist yet.
I used ai.dev as the alternate URL as it takes up less space but if this
is likely to confuse users we can use the long form.
Co-authored-by: Tony Kipkemboi <iamtonykipkemboi@gmail.com>
The Gemini & Vertex sections were conflated and a little hard to
distingush, so I have put them in separate sections.
Also added the latest 2.5 and 2.0 flash-lite models, and added a note
that Gemma models work too.
Co-authored-by: Tony Kipkemboi <iamtonykipkemboi@gmail.com>
This commit updates the project version to 0.119.0 and modifies the required version of the `crewai-tools` dependency to 0.44.0 across various configuration files. Additionally, the version number is reflected in the `__init__.py` file and the CLI templates for crew, flow, and tool projects.
* feat: implement knowledge retrieval events in Agent
This commit introduces a series of knowledge retrieval events in the Agent class, enhancing its ability to handle knowledge queries. New events include KnowledgeRetrievalStartedEvent, KnowledgeRetrievalCompletedEvent, KnowledgeQueryGeneratedEvent, KnowledgeQueryFailedEvent, and KnowledgeSearchQueryCompletedEvent. The Agent now emits these events during knowledge retrieval processes, allowing for better tracking and handling of knowledge queries. Additionally, the console formatter has been updated to handle these new events, providing visual feedback during knowledge retrieval operations.
* refactor: update knowledge query handling in Agent
This commit refines the knowledge query processing in the Agent class by renaming variables for clarity and optimizing the query rewriting logic. The system prompt has been updated in the translation file to enhance clarity and context for the query rewriting process. These changes aim to improve the overall readability and maintainability of the code.
* fix: add missing newline at end of en.json file
* fix broken tests
* refactor: rename knowledge query events and enhance retrieval handling
This commit renames the KnowledgeQueryGeneratedEvent to KnowledgeQueryStartedEvent to better reflect its purpose. It also updates the event handling in the EventListener and ConsoleFormatter classes to accommodate the new event structure. Additionally, the retrieval knowledge is now included in the KnowledgeRetrievalCompletedEvent, improving the overall knowledge retrieval process.
* docs for transparancy
* refactor: improve error handling in knowledge query processing
This commit refactors the knowledge query handling in the Agent class by changing the order of checks for LLM compatibility. It now logs a warning and emits a failure event if the LLM is not an instance of BaseLLM before attempting to call the LLM. Additionally, the task_prompt attribute has been removed from the KnowledgeQueryFailedEvent, simplifying the event structure.
* test: add unit test for knowledge search query and VCR cassette
This commit introduces a new test, `test_get_knowledge_search_query`, to verify that the `_get_knowledge_search_query` method in the Agent class correctly interacts with the LLM using the appropriate prompts. Additionally, a VCR cassette is added to record the interactions with the OpenAI API for this test, ensuring consistent and reliable test results.
Updated prereqs and setup steps to point to the now-more-model-agnostic
LLM setup guide, and updated the relevant text to go with it.
Co-authored-by: Tony Kipkemboi <iamtonykipkemboi@gmail.com>
This removes any specific model from the "Setting up your LLM" guide,
but provides examples for the top-3 providers.
This section also conflated "model selection" with "model
configuration", where configuration is provider-specific, so I've
focused this first section on just model selection, deferring the config
to the "provider" section that follows.
Co-authored-by: Tony Kipkemboi <iamtonykipkemboi@gmail.com>
This commit adds a new crew field called parent_flow, evaluated when the Crew
instance is instantiated. The stacktrace is traversed to look up if the caller
is an instance of Flow, and if so, it fills in the field.
Other alternatives were considered, such as a global context or even a new
field to be manually filled, however, this is the most magical solution that
was thread-safe and did not require public API changes.
* fix: support to reset memories after changing Crew's embedder
The sources must not be added while initializing the Knowledge otherwise we could not reset it
* chore: improve reset memory feedback
Previously, even when no memories were actually erased, we logged that they had been. From now on, the log will specify which memory has been reset.
* feat: improve get_crew discovery from a single file
Crew instances can now be discovered from any function or method with a return type annotation of -> Crew, as well as from module-level attributes assigned to a Crew instance. Additionally, crews can be retrieved from within a Flow
* refactor: make add_sources a public method from Knowledge
* build(dev): add pytest-randomly dependency
By randomizing the test execution order, this helps identify tests
that unintentionally depend on shared state or specific execution
order, which can lead to flaky or unreliable test behavior.
* build(dev): add pytest-timeout
This will prevent a test from running indefinitely
* test: block external requests in CI and set default 10s timeout per test
* test: adding missing cassettes
We notice that those cassettes are missing after enabling block-network on CI
* test: increase tests timeout on CI
* test: fix flaky test ValueError: Circular reference detected (id repeated)
* fix: prevent crash when event handler raises exception
Previously, if a registered event handler raised an exception during execution,
it could crash the entire application or interrupt the event dispatch process.
This change wraps handler execution in a try/except block within the `emit` method,
ensuring that exceptions are caught and logged without affecting other handlers or flow.
This improves the resilience of the event bus, especially when handling third-party
or temporary listeners.
* feat: support to define a guardrail task no-code
* feat: add auto-discovery for Guardrail code execution mode
* feat: handle malformed or invalid response from CodeInterpreterTool
* feat: allow to set unsafe_mode from Guardrail task
* feat: renaming GuardrailTask to TaskGuardrail
* feat: ensure guardrail is callable while initializing Task
* feat: remove Docker availability check from TaskGuardrail
The CodeInterpreterTool already ensures compliance with this requirement.
* refactor: replace if/raise with assert
For this use case `assert` is more appropriate choice
* test: remove useless or duplicated test
* fix: attempt to fix type-checker
* feat: support to define a task guardrail using YAML config
* refactor: simplify TaskGuardrail to use LLM for validation, no code generation
* docs: update TaskGuardrail doc strings
* refactor: drop task paramenter from TaskGuardrail
This parameter was used to get the model from the `task.agent` which is a quite bit redudant since we could propagate the llm directly
Add `__init__.py` files to 20 directories to conform with Python package standards. This ensures directories are properly recognized as packages, enabling cleaner imports.
This commit fixes a bug where changing logging level would be overriden
by `src/crewai/project/crew_base.py`. For example, the following snippet
on top of a crew or flow would not work:
```python
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
```
Crews and flows should be able to set their own log level, without being
overriden by CrewAI library code.
* Fix issue #2402: Handle missing templates gracefully
Co-Authored-By: Joe Moura <joao@crewai.com>
* Fix import sorting in test files
Co-Authored-By: Joe Moura <joao@crewai.com>
* Bluit in top of devin-ai integration
* Fixed test cases
* Fixed test cases
* fixed linting issue
* Added docs
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <joao@crewai.com>
* build(litellm): upgrade LiteLLM to latest version
* fix: update filtered logs from LiteLLM
* Fix for a missing backtick
---------
Co-authored-by: Mike Plachta <mike@crewai.com>
Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>
* added gpt4.1 models and gemini 2.0 and 2.5 models
* added flash model
* Updated test fun to all models
* Added Gemma3 test cases and passed all google test case
* added gemini 2.5 flash
* added gpt4.1 models and gemini 2.0 and 2.5 models
* added flash model
* Updated test fun to all models
* Added Gemma3 test cases and passed all google test case
* added gemini 2.5 flash
* added gpt4.1 models and gemini 2.0 and 2.5 models
* added flash model
* Updated test fun to all models
* Added Gemma3 test cases and passed all google test case
* added gemini 2.5 flash
* test: add missing cassettes
* test: ignore authorization key from gemini/gemma3 request
---------
Co-authored-by: Lucas Gomide <lucaslg200@gmail.com>
Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>