[FEATURE] Memory write guards for multi-agent crews — prevent cross-agent memory poisoning
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 58.8k
- Forks
- 8.5k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 109
Description
Feature Area
Core functionality
Is your feature request related to a an existing bug? Please link it here.
NA - not related to an existing bug
Describe the solution you'd like
In multi-agent CrewAI crews, agents share memory (short-term, long-term, entity memory). A compromised or manipulated agent can poison shared memory with prompt injection payloads that affect all other agents in the crew.
Proposed solution: Add a memory_guard parameter to Crew that validates all memory writes before persistence:
from crewai import Crew, Agent, Task
from agent_memory_guard import scan_text
def memory_validator(content: str) -> bool:
result = scan_text(content)
return result.risk_level != "critical"
crew = Crew(
agents=[researcher, writer, reviewer],
tasks=[...],
memory=True,
memory_guard=memory_validator # New parameter
)
This would intercept writes to all memory types (short-term, long-term, entity) and block content that matches injection patterns. The agent-memory-guard package (OWASP project, 59µs latency, zero deps) provides a production-ready validator.
Why this matters for CrewAI specifically: Multi-agent crews amplify the risk because one poisoned memory entry propagates to ALL agents. A single injection in a researcher agent's output can compromise the writer and reviewer agents permanently.
Describe alternatives you've considered
- Per-agent input validation — doesn't catch tool outputs or inter-agent messages that flow into memory
- Post-hoc memory cleanup — reactive rather than preventive, damage already done by the time you detect it
- Disabling shared memory — defeats the purpose of multi-agent collaboration
Additional context
- OWASP ASI-06 (Memory Poisoning): https://owasp.org/www-project-agentic-security-initiative/
- Reference implementation: https://pypi.org/project/agent-memory-guard/
- GitHub: https://github.com/OWASP/www-project-agent-memory-guard
- I have a working prototype of this integration and would be happy to submit a PR
Willingness to Contribute
Yes, I'd be happy to submit a pull request
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Crew entry point and trace how short-term, long-term, and entity memory writes are persisted. Review the proposed memory_guard callback and the prototype or agent-memory-guard reference, then define coverage for every memory type. Done means critical-risk content is rejected before persistence without disabling shared memory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, backend, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100