Skip to content

Context Graphs

Platforms: claude openai gemini m365-copilot

A context graph is a structured system that captures not just what information an AI agent uses, but why decisions were made and how facts relate to each other.

Think of it this way: a document gives an AI agent information. A context graph gives it understanding — the connections between entities, the reasoning behind decisions, and the temporal sequence of events that led to the current state.

Context graphs build on the concept of a knowledge graph (a network of entities connected by labeled relationships) but go further by encoding decision logic, confidence levels, and causal chains. In a knowledge graph, you might store that “Customer A bought Product B.” In a context graph, you also capture why — the sales signal that triggered outreach, the objection that was overcome, and the precedent from a similar deal that informed the approach.

ApproachWhat It DoesWhat It Misses
Context windowHolds the text (measured in tokens — chunks of text the model processes) visible to the model in a single conversationNo structure, no persistence, limited size
RAGRetrieval-Augmented Generation — retrieves relevant documents from a database and injects them into the promptFinds related content but doesn’t capture relationships between concepts
Knowledge graphMaps entities and their relationships in a structured network of nodes (things) and edges (connections)Static structure, no decision reasoning or temporal context
Context graphCaptures entities, relationships, decisions, reasoning chains, and temporal context in a queryable structureEmerging technology, more complex to build and maintain

Each approach in this table builds on the ones above it. RAG helps an AI find relevant documents. A knowledge graph helps it understand how entities relate. A context graph helps it understand why things happened and what led to decisions — which is what agents need for multi-step reasoning.

Nodes are the things in a context graph. Unlike a traditional knowledge graph where nodes are mostly entities (people, companies, products), context graph nodes include:

Node TypeWhat It RepresentsExample
EntityA person, organization, product, or concept”Acme Corp”, “Q4 Revenue Report”
DecisionA choice that was made, with reasoning”Chose vendor B because of compliance requirements”
SignalAn event or data point that triggered action”Customer satisfaction dropped below 80%“
StateA snapshot of conditions at a point in time”Pipeline status as of January 2026”

Edges are the connections between nodes — they describe how things relate. Context graphs use richer edge types than traditional knowledge graphs:

Edge TypeWhat It CapturesExample
CausationOne thing led to anotherSignal “churn risk detected” → Decision “escalate to account manager”
DependencyOne thing requires anotherTask “generate report” depends on State “data refresh complete”
PrecedentA past decision that informs a current oneDecision “pricing for Enterprise tier” references Decision “pricing for Mid-Market tier”
TemporalSequence and timing of eventsSignal A occurred before Signal B, 3 days apart
ConfidenceHow certain a relationship isEntity “likely competitor” connected with 0.7 confidence

The combination of nodes and edges creates relationship patterns that agents can traverse:

  • Temporal chains — “What sequence of events led to this outcome?”
  • Conditional logic — “Under what conditions was this decision made?”
  • Confidence-weighted paths — “What’s the most reliable chain of reasoning?”

Context graphs address specific limitations that surface when AI agents handle multi-step, real-world workflows:

  • Multi-step reasoning — Agents can trace chains of causation and dependency rather than relying on whatever fits in the context window
  • Structured memory — Decisions and their rationale persist across conversations and sessions, giving agents institutional knowledge
  • Auditability — Every recommendation can be traced back through the graph to the signals and precedents that informed it
  • Compounding organizational knowledge — Each interaction adds to the graph, making the system more capable over time rather than starting fresh each session

The AI industry is undergoing a shift from prompt engineering (optimizing how you ask) to context engineering (optimizing what information the model sees).

The core insight: a well-structured, relevant context makes even a simple prompt produce excellent results. A perfectly crafted prompt with poor context still produces poor results.

This shift has practical implications:

  • Where you invest time changes — less on prompt syntax, more on building and curating the information your AI workflows consume
  • What you build changes — systems that assemble, filter, and structure context become more valuable than prompt template libraries
  • How you measure quality changes — success depends on whether the right context reached the model, not just whether the prompt was well-written

Context graphs represent the most structured end of this spectrum — purpose-built systems for assembling exactly the right context for each agent action.

ToolWhat It DoesBest For
TrustGraphExtracts knowledge graphs from documents with AI, supports context graph queriesDocument-heavy workflows needing structured extraction
GraphitiTemporal knowledge graph library for building agent memoryAgents that need persistent, evolving memory across sessions
LangGraphFramework for building stateful, multi-agent workflows with graph-based orchestrationComplex agent orchestration with branching logic
Neo4jGraph database for storing and querying relationship-rich dataEnterprise-scale knowledge and context graph storage
MCPModel Context Protocol — a standard for connecting AI models to external data sources and toolsConnecting agents to live context from APIs, databases, and services

Context graphs intersect with every other building block:

  • Prompts — Context graphs provide the structured background that makes prompts effective. Instead of cramming context into a prompt, agents query the graph for exactly what’s relevant.
  • Projects — Projects organize persistent context. Context graphs add structure within that context — not just “here are the files” but “here’s how they relate.”
  • Skills — Skills can use context graphs to make decisions based on precedent and historical patterns rather than just the instructions they contain.
  • Agents — Agents are the primary consumers of context graphs. Multi-step workflows benefit most from structured reasoning and memory.
  • MCP — MCP servers can expose context graph data as tools and resources, giving agents structured access to organizational knowledge.
  • Context Engineering — the broader discipline; context graphs are an advanced technique within it
  • Context — the Context building block overview
  • Agentic Building Blocks — Context Graphs in the context of all building blocks
  • AI Use Cases — what teams build with context, organized by six primitives
  • Agents — autonomous workflows that benefit most from structured context
  • MCP — the protocol for connecting agents to external context sources
  • Prompts — the instructions that context enhances