* feat: Add inject_date flag to Agent for automatic date injection
Co-Authored-By: Joe Moura <joao@crewai.com>
* feat: Add date_format parameter and error handling to inject_date feature
Co-Authored-By: Joe Moura <joao@crewai.com>
* fix: Update test implementation for inject_date feature
Co-Authored-By: Joe Moura <joao@crewai.com>
* fix: Add date format validation to prevent invalid formats
Co-Authored-By: Joe Moura <joao@crewai.com>
* docs: Update documentation for inject_date feature
Co-Authored-By: Joe Moura <joao@crewai.com>
* unnecesary
* new tests
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <joao@crewai.com>
Co-authored-by: João Moura <joaomdmoura@gmail.com>
- Add `HallucinationGuardrail` class as enterprise feature placeholder
- Update LLM guardrail events to support `HallucinationGuardrail` instances
- Add comprehensive tests for `HallucinationGuardrail` initialization and behavior
- Add integration tests for `HallucinationGuardrail` with task execution system
- Ensure no-op behavior always returns True
* Refactor Crew class memory initialization and enhance event handling
- Simplified the initialization of the external memory attribute in the Crew class.
- Updated memory system retrieval logic for consistency in key usage.
- Introduced a singleton pattern for the Telemetry class to ensure a single instance.
- Replaced telemetry usage in CrewEvaluator with event bus emissions for test results.
- Added new CrewTestResultEvent to handle crew test results more effectively.
- Updated event listener to process CrewTestResultEvent and log telemetry data accordingly.
- Enhanced tests to validate the singleton pattern in Telemetry and the new event handling logic.
* linted
* Remove unused telemetry attribute from Crew class memory initialization
* fix ordering of test
* Implement thread-safe singleton pattern in Telemetry class
- Introduced a threading lock to ensure safe instantiation of the Telemetry singleton.
- Updated the __new__ method to utilize double-checked locking for instance creation.
* Add reasoning attribute to Agent class
Co-Authored-By: Joe Moura <joao@crewai.com>
* Address PR feedback: improve type hints, error handling, refactor reasoning handler, and enhance tests and docs
Co-Authored-By: Joe Moura <joao@crewai.com>
* Implement function calling for reasoning and move prompts to translations
Co-Authored-By: Joe Moura <joao@crewai.com>
* Simplify function calling implementation with better error handling
Co-Authored-By: Joe Moura <joao@crewai.com>
* Enhance system prompts to leverage agent context (role, goal, backstory)
Co-Authored-By: Joe Moura <joao@crewai.com>
* Fix lint and type-checker issues
Co-Authored-By: Joe Moura <joao@crewai.com>
* Enhance system prompts to better leverage agent context
Co-Authored-By: Joe Moura <joao@crewai.com>
* Fix backstory access in reasoning handler for Python 3.12 compatibility
Co-Authored-By: Joe Moura <joao@crewai.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <joao@crewai.com>
Co-authored-by: João Moura <joaomdmoura@gmail.com>
* Add markdown attribute to Task class for formatting responses in Markdown
Co-Authored-By: Joe Moura <joao@crewai.com>
* Enhance markdown feature based on PR feedback
Co-Authored-By: Joe Moura <joao@crewai.com>
* Fix lint error and validation error in test_markdown_task.py
Co-Authored-By: Joe Moura <joao@crewai.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <joao@crewai.com>
* Changed test case
* Addd new interaction with llama
* fixed linting issue
* Gemma Flaky test case
* Gemma Flaky test case
* Minor change
* Minor change
* Dropped API key
* Removed falky test case check file
* Enhance string interpolation to support hyphens in variable names and add corresponding test cases. Update existing tests for consistency and formatting.
* Refactor tests in task_test.py by removing unused Task instances to streamline test cases for the interpolate_only method and related functions.
* 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.