Back to BlogAI Frameworks

Graph Engineering: Structured Context for AI Agents

Orioverse Team·
🔗

Graph Engineering: Structured Context for AI Agents

ACL 2026 featured two major papers on graph-based agent memory architectures - MAGMA and GAM - that both showed significant improvements over prior state-of-the-art systems. This post covers what they found and what it means for production agent systems.

The Problem with Flat Memory

The fundamental problem with flat context stores: relationships are implicit. You can store in semantic memory that user X has account Y, but the agent has to infer the connection from the text. With a graph, the relationship is explicit - the agent can traverse from any entity to its related entities in one step.

The MAGMA paper identifies three specific failure modes of monolithic memory stores:

  • Temporal, causal, and entity information are entangled, making retrieval imprecise
  • Query intent often does not align with what similarity search returns
  • Reasoning paths are opaque - you cannot see why a particular memory was retrieved

MAGMA: Multi-Graph Memory

MAGMA addresses these problems by representing each memory item across four orthogonal graphs:

  • Semantic graph: what a memory means, based on content similarity
  • Temporal graph: when events happened and their chronological relationships
  • Causal graph: what led to what - causes and effects
  • Entity graph: which entities are involved and how they relate

Retrieval in MAGMA is policy-guided traversal over these relational views rather than vector similarity search. When an agent queries for relevant memories, it starts from the current context - the entities mentioned, the time frame, the causal chain - and traverses the graph along edges matching the query's intent.

The key advance is decoupling memory representation from retrieval logic. Each memory item has representations across all four graphs, but the retrieval policy chooses which graph to traverse based on the query type. This provides transparent reasoning paths - you can see exactly which edges the agent traversed to reach a retrieved memory.

MAGMA outperformed prior state-of-the-art agentic memory systems on both the LoCoMo and LongMemEval benchmarks for long-horizon reasoning tasks.

GAM: Hierarchical Graph Memory

GAM addresses a different problem: the tension between rapid context perception and stable knowledge retention. In continuous stream-based memory systems, established knowledge gets distorted by new information through a phenomenon called memory contamination - where existing nodes become structurally isolated and forgotten due to weak connectivity or semantically drift as distinct topics get erroneously conflated.

GAM's solution is a dual-phase architecture:

Episodic buffering phase: Ongoing dialogue is captured in a local event progression graph. This graph is isolated from the global memory store, protecting it from interference while the conversation is active.

Semantic consolidation phase: When a semantic shift is detected - the topic changes, the conversation reaches a natural boundary - the buffered events are summarized and merged into a global topic associative network. This only happens at semantically complete boundaries, not continuously.

This structure prevents the distortion problem while preserving the ability to update knowledge. The local buffer absorbs rapid changes. The global network maintains stable knowledge. Consolidation bridges the two at the right moment.

For retrieval, GAM uses a graph-guided multi-factor strategy that integrates temporal signals, confidence scores, and role-based information to traverse from high-level semantic themes down to precise episodic details.

What This Means for Production Agents

Both papers converge on the same insight: the structure of memory affects the quality of reasoning more than the quantity of stored information.

For teams building production agents, the practical takeaways:

First, a single embedding-based similarity store is likely not sufficient for agents that need to reason about relationships. The graph structure lets the agent traverse connections that similarity search would miss.

Second, consolidation is essential. Without it, memory contamination erodes the quality of stored knowledge over time. The consolidation trigger - whether periodic or event-driven - determines how well the system balances stability and adaptability.

Third, the retrieval mechanism must match the query type. Relationship queries need graph traversal. Fact queries need entity lookup. Temporal queries need timeline traversal. A single retrieval strategy for all query types forces trade-offs.

At Orioverse, we are experimenting with a hybrid approach: semantic memory for facts about individual entities, with a lightweight graph layer encoding relationships between entities for traversal queries. The graph is populated by a consolidation process that extracts relationship triples from episodic memory, similar to the GAM consolidation pattern.

Read the full Context Engineering series: orioverse.com/blog/what-is-context-engineering

References

  1. https://aclanthology.org/2026.acl-long.1709/
  2. https://aclanthology.org/2026.acl-long.1600.pdf
  3. https://arxiv.org/html/2511.07800