Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
fix: use None check instead of isinstance for memory in human feedback learn
Greyson LaLondeb53c08812df6
diff --git a/lib/crewai/src/crewai/flow/human_feedback.py b/lib/crewai/src/crewai/flow/human_feedback.pyindex 7add43f7a..9bace438e 100644--- a/lib/crewai/src/crewai/flow/human_feedback.py+++ b/lib/crewai/src/crewai/flow/human_feedback.py@@ -374,10 +374,8 @@ def human_feedback() -> Any:"""Recall past HITL lessons and use LLM to pre-review the output."""try:- from crewai.memory.unified_memory import Memory-mem = flow_instance.memory- if not isinstance(mem, Memory):+ if mem is None:return method_outputquery = f"human feedback lessons for {func.__name__}: {method_output!s}"matches = mem.recall(query, source=learn_source)@@ -412,10 +410,8 @@ def human_feedback() -> None:"""Extract generalizable lessons from output + feedback, store in memory."""try:- from crewai.memory.unified_memory import Memory-mem = flow_instance.memory- if not isinstance(mem, Memory):+ if mem is None:returnllm_inst = _resolve_llm_instance()prompt = _get_hitl_prompt("hitl_distill_user").format(@@ -448,7 +444,7 @@ def human_feedback(]if lessons:- mem.remember_many(lessons, source=learn_source)+ mem.remember_many(lessons, source=learn_source) # type: ignore[union-attr]except Exception: # noqa: S110pass # non-critical: don't fail the flow because lesson storage failed