- Add MemorySanitizer class that detects and neutralizes prompt injection
patterns (system overrides, instruction overrides, role hijacking,
command injection, hidden instructions, jailbreak attempts)
- Integrate sanitization into Memory.save() base class for write-time protection
- Integrate sanitization into ContextualMemory.build_context_for_task() for
defense-in-depth on retrieval
- Sanitize LongTermMemory metadata (suggestions, expected_output)
- Add sanitize_memory config option in memory_config (default: True)
- Add 41 tests covering all injection pattern categories, integration with
Memory.save(), ContextualMemory retrieval, config toggle, and edge cases
Co-Authored-By: João <joao@crewai.com>
* byom - short/entity memory
* better
* rm uneeded
* fix text
* use context
* rm dep and sync
* type check fix
* fixed test using new cassete
* fixing types
* fixed types
* fix types
* fixed types
* fixing types
* fix type
* cassette update
* just mock the return of short term mem
* remove print
* try catch block
* added docs
* dding error handling here
* rebuilding executor
* removing langchain
* Making all tests good
* fixing types and adding ability for nor using system prompts
* improving types
* pleasing the types gods
* pleasing the types gods
* fixing parser, tools and executor
* making sure all tests pass
* final pass
* fixing type
* Updating Docs
* preparing to cut new version
* Adding support to force a tool return to be the final answer.
This will at the end of the execution return the tool output.
It will return the output of the latest tool with the flag
* Update src/crewai/agent.py
Co-authored-by: Gui Vieira <guilherme_vieira@me.com>
* Update tests/agent_test.py
Co-authored-by: Gui Vieira <guilherme_vieira@me.com>
---------
Co-authored-by: Gui Vieira <guilherme_vieira@me.com>
* fix: fix test actually running
* fix: fix test to not send request to openai
* fix: fix linting to remove cli files
* fix: exclude only files that breaks black