crewai - 💡(How to fix) Fix [FEATURE] Built-in memory poisoning protection via OWASP Agent Memory Guard

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

from crewai import Crew, Agent
from agent_memory_guard.integrations.crewai import GuardedCrewMemory

crew = Crew(
    agents=[researcher, writer],
    memory=True,
    memory_config={"provider": GuardedCrewMemory()}
)
RAW_BUFFERClick to expand / collapse

Feature Area

Core functionality

Is your feature request related to a an existing bug? Please link it here.

NA

Describe the solution you'd like

Problem

CrewAI agents with persistent memory (long-term memory, entity memory) are vulnerable to memory poisoning attacks — adversarial inputs stored in memory can cause agents to leak secrets, ignore instructions, or produce corrupted outputs in future conversations. In multi-agent crews, a poisoned memory in one agent can propagate to others via shared memory stores.

Proposed Solution

Integrate OWASP Agent Memory Guard (pip install agent-memory-guard) as an opt-in security layer for CrewAI's memory subsystem.

AMG v0.3.0 provides:

  • Real-time memory write/read scanning with 7 detection layers
  • CLI scanner (amg scan) for offline audits
  • REST API server (amg serve) for microservice deployment
  • ML-based detection (DistilBERT) for semantic injection beyond regex
  • 92.5% detection rate on AgentThreatBench (200+ adversarial payloads)

Integration Pattern for CrewAI

from crewai import Crew, Agent
from agent_memory_guard.integrations.crewai import GuardedCrewMemory

crew = Crew(
    agents=[researcher, writer],
    memory=True,
    memory_config={"provider": GuardedCrewMemory()}
)

This would scan every memory write for:

  • Prompt injection attempts
  • PII/secret leakage
  • Privilege escalation patterns
  • Tool abuse indicators
  • Cross-task contamination

Why This Matters for CrewAI

  1. Multi-agent crews share memory, creating a larger attack surface
  2. Adversarial inputs stored by one agent can compromise the entire crew
  3. OWASP identifies memory poisoning (ASI-06) as a top risk for agentic AI

Happy to contribute a PR implementing this integration.

Describe alternatives you've considered

No response

Additional context

No response

Willingness to Contribute

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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING