Closes#5725.
In _pre_review_with_lessons (lib/crewai/src/crewai/flow/human_feedback.py),
a broad except Exception: return method_output silently swallowed any
LLM, network, auth, or structured-output failure during the pre-review
step. Callers could not distinguish pre-reviewed output from raw output,
and there was no log or event surfaced.
Changes:
- Add a module logger.
- Narrow the try/except in _pre_review_with_lessons so the mem is None
and not matches short-circuits stay outside the failure path (those
are not error cases).
- On recall or LLM pre-review failure, log a WARNING with exc_info=True
so the silent fallback is observable. Continue to fall back to the raw
method_output so the flow does not break.
- Add an opt-in learn_strict=True parameter on the human_feedback
decorator and HumanFeedbackConfig that re-raises pre-review failures
instead of falling back, for callers that need fail-closed behavior.
- Update the Graceful degradation docs section to reflect the new
observable-by-default behavior and document learn_strict.
Tests (lib/crewai/tests/test_human_feedback_decorator.py):
- New TestHumanFeedbackPreReviewFailure class with 7 tests covering
WARNING logging on LLM and recall failures, learn_strict propagation
in both sync and async paths, and config introspection of the new
learn_strict flag.
Co-Authored-By: João <joao@crewai.com>
* better DevEx
* Refactor: Update supported native providers and enhance memory handling
- Removed "groq" and "meta" from the list of supported native providers in `llm.py`.
- Added a safeguard in `flow.py` to ensure all background memory saves complete before returning.
- Improved error handling in `unified_memory.py` to prevent exceptions during shutdown, ensuring smoother memory operations and event bus interactions.
* Enhance Memory System with Consolidation and Learning Features
- Introduced memory consolidation mechanisms to prevent duplicate records during content saving, utilizing similarity checks and LLM decision-making.
- Implemented non-blocking save operations in the memory system, allowing agents to continue tasks while memory is being saved.
- Added support for learning from human feedback, enabling the system to distill lessons from past corrections and improve future outputs.
- Updated documentation to reflect new features and usage examples for memory consolidation and HITL learning.
* Enhance cyclic flow handling for or_() listeners
- Updated the Flow class to ensure that all fired or_() listeners are cleared between cycle iterations, allowing them to fire again in subsequent cycles. This change addresses a bug where listeners remained suppressed across iterations.
- Added regression tests to verify that or_() listeners fire correctly on every iteration in cyclic flows, ensuring expected behavior in complex routing scenarios.
* feat: introduce human feedback events and decorator for flow methods
- Added HumanFeedbackRequestedEvent and HumanFeedbackReceivedEvent classes to handle human feedback interactions within flows.
- Implemented the @human_feedback decorator to facilitate human-in-the-loop workflows, allowing for feedback collection and routing based on responses.
- Enhanced Flow class to store human feedback history and manage feedback outcomes.
- Updated flow wrappers to preserve attributes from methods decorated with @human_feedback.
- Added integration and unit tests for the new human feedback functionality, ensuring proper validation and routing behavior.
* adding deployment docs
* New docs
* fix printer
* wrong change
* Adding Async Support
feat: enhance human feedback support in flows
- Updated the @human_feedback decorator to use 'message' parameter instead of 'request' for clarity.
- Introduced new FlowPausedEvent and MethodExecutionPausedEvent to handle flow and method pauses during human feedback.
- Added ConsoleProvider for synchronous feedback collection and integrated async feedback capabilities.
- Implemented SQLite persistence for managing pending feedback context.
- Expanded documentation to include examples of async human feedback usage and best practices.
* linter
* fix
* migrating off printer
* updating docs
* new tests
* doc update