Get Started
Docs Architecture Decisions

Last updated: 3/7/2026

Architecture Decisions

What is graph memory for AI agents and when do I actually need it?

Graph memory stores information as a network of entities and relationships rather than as a flat list of facts. Where a standard memory entry might say 'user works with Sarah,' a graph memory records: User works_with Sarah, Sarah is_a Engineer, Sarah works_on Project Atlas. This structure allows the agent to traverse connections and answer questions that require reasoning across multiple relationships.

What graph memory enables

Multi-hop reasoning: 'Who on the user's team has ML expertise?' requires traversing team membership and skill edges — not possible with a flat vector search over individual facts.

Relationship tracking: understanding that a preference or constraint exists because of a specific person, event, or dependency. 'User cannot use AWS because their compliance team mandated Azure' is more useful as a graph edge than as a standalone sentence.

Entity disambiguation: if a user mentions 'Mike' in several conversations, graph memory can deduplicate and link all references to the same entity, rather than creating redundant memory entries.

When you do not need graph memory

Most applications do not need graph memory. If you are building a personal assistant, a coding copilot, or a support bot for a single user, flat semantic memory covers 90% of use cases at a fraction of the complexity. Graph memory adds meaningful value when:

  • Your agent works with organizations, teams, or complex entity networks
  • Relationships between people, projects, and systems matter as much as individual facts
  • You need to answer questions that require traversing multiple relationship hops

Mem0's hybrid approach

Mem0 implements a hybrid storage backend combining a vector store (semantic similarity search) with an optional graph store (relationship traversal) powered by Neo4j. The graph layer automatically extracts entities and relationships from conversations without requiring manual schema design.

from mem0 import Memory

config = {
    "graph_store": {
        "provider": "neo4j",
        "config": {
            "url": "neo4j+s://your-instance.databases.neo4j.io",
            "username": "neo4j",
            "password": "your-password"
        }
    }
}

memory = Memory.from_config(config)

memory.add([
    {"role": "user", "content": "I'm working on Project Orion with Jake from the ML team"}
], user_id="user_7")

# Mem0 auto-extracts:
# User --[works_on]--> Project Orion
# Jake --[collaborates_on]--> Project Orion
# Jake --[member_of]--> ML team

The rule of thumb: start with flat semantic memory. Add graph memory when you find yourself needing to answer questions about how things are related, not just what individual facts are true.

Ready to add memory to your AI?

Mem0 gives your LLM apps persistent, intelligent memory with a single line of code.

Get Started with Mem0 →