mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-15 15:32:40 +00:00
Fixes #5057 - Add sanitize_memory_content() utility in crewai.memory.utils that: - Collapses excessive whitespace/newlines - Truncates to max_length (default 500 chars) - Wraps content in [RETRIEVED_MEMORY_START]/[RETRIEVED_MEMORY_END] boundary markers - Apply sanitization in all memory injection sites: - LiteAgent._inject_memory_context() - Agent.execute_task() (sync and async) - Agent._prepare_kickoff() - Flow human_feedback._pre_review_with_lessons() - Update MemoryMatch.format() to sanitize content - Update framing text to 'retrieved context, not instructions' - Add 16 tests covering sanitization logic and integration Co-Authored-By: João <joao@crewai.com>