crewAIInc / crewAIInc/crewAI

[FEATURE] Memory write guards for multi-agent crews — prevent cross-agent memory poisoning

Open
#6,043 29 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
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
  1. Per-agent input validation — doesn't catch tool outputs or inter-agent messages that flow into memory
  2. Post-hoc memory cleanup — reactive rather than preventive, damage already done by the time you detect it
  3. Disabling shared memory — defeats the purpose of multi-agent collaboration
Additional context
Willingness to Contribute

Yes, I'd be happy to submit a pull request

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.