Back to blog
What Is a Context Graph? How AI Agents Use One

This blog is written by AI for SEO

What Is a Context Graph? How AI Agents Use One

HelixDB8 min read

A context graph is a knowledge graph extended with time and decision context: it records not only which entities exist and how they connect, but when facts held and what was decided, by whom, on what evidence. Agents use it to answer "what is true?" and also "how was this handled before, and why?".

The term is new and sources use it a little differently, so it helps to be concrete. This post gives the plain definition, separates it from a knowledge graph and an ontology, lists what a company context graph should hold, shows how agents query it, and walks through building one with Helix Foundry, the open-source app that loads one connected graph into HelixDB with every value traced to its source.

What a context graph is, in plain terms

A context graph is a connected map of your entities and relationships, plus the two things a plain map lacks: time and decision lineage. Graphwise describes it as extending the knowledge graph "by adding the dimensions of time and decision lineage". IBM frames it as structure for the information a large language model reads, so its output improves.

Take a refund. A knowledge graph can tell you that customer A placed order 1042 and that policy P covers refunds within 30 days. A context graph also holds that on March 3 an agent approved the refund, citing policy P and the support ticket, and what happened to the account afterward. That is the difference between a fact and a precedent.

The practical payoff is that an agent stops guessing from isolated text chunks. It gets entities, the links between them, when each fact applied, and the trail of earlier decisions, all in one place it can traverse.

Context graph vs knowledge graph vs ontology

A knowledge graph stores entities and relationships, an ontology defines what kinds of entities and links are allowed, and a context graph adds time and decision history on top. They are layers, not rivals.

Answers Holds
Ontology What kinds of things exist and how may they relate? Types, relationships, rules
Knowledge graph What is connected, and what is true? Instances of those types, with links
Context graph How was this handled before, and why? The above plus time, provenance and decision traces

If you want the longer treatment, see AI Knowledge Graph: What It Is and How to Build One and RAG vs Ontology: Which Your AI Agents Actually Need.

One caveat: vendors define "context graph" loosely. Decision traces are the part most definitions agree on, so judge any tool by whether it records them, not by the label.

What a company context graph holds: customers, orders, people, documents, decisions

A company context graph holds five kinds of nodes, and the links between them are where the value sits.

  • Customers and accounts: one node per real customer, merged across the systems that each know a slice of them.

  • Orders, payments and subscriptions: the transactions, linked to the customer who made them.

  • People: employees, owners and contacts, linked to the accounts and documents they touch.

  • Documents: contracts, call notes and policies, with the quote that supports each extracted fact.

  • Decisions: an approval, an exception or a pricing call, linked to the people, evidence, policy and outcome involved.

Time lives on the links and facts: when a contract took effect, when a plan changed, when a decision was made. Model it explicitly, because a graph does not invent history for you. In HelixDB, time-range indexing makes range queries over timestamps efficient, but the time modelling itself is yours to design.

The rule that keeps this trustworthy is provenance. Every value should point back to the row or document quote it came from. Without that, an agent's answer cannot be checked and nobody can fix a bad link at its source. For a worked example of one customer entity across tools, see Link the Same Customer Across Stripe, Postgres and Notion.

How agents query a context graph

Agents query a context graph by starting at an entity, walking its links, and filtering by time or by what was decided. They do not search for similar text and hope.

Three query shapes cover most work:

  1. Lookup and traversal. "Show everything connected to this customer: orders, owners, open documents." One hop or several, following typed links.

  2. Time-scoped questions. "What was this customer's plan on June 1?" The query filters facts by the period they held.

  3. Precedent search. "Find earlier refund decisions that cited this policy, and what followed." The agent walks from the policy to its decision nodes and reads the outcomes.

In Helix Foundry, people and agents reach the graph through Analyst, the Helix MCP, dashboards and workflows. The Helix MCP is how an outside agent such as Claude reads the ontology without custom glue code. Because each answer traces to a source row or quote, the agent can cite where a claim came from.

Underneath, HelixDB is the database holding the graph. It combines graph traversal, vector search and BM25 full-text search in one engine, so a precedent search can mix "semantically similar to this ticket" with "linked to this policy" in one query. Vector search can also be pre-filtered to a related set of entities rather than the whole index.

A context graph rots unless something keeps its links correct, and this is the hard part of running one, not building it. Source systems change: a column is renamed, a customer is merged in the CRM, a new document type appears. Each change can leave links pointing at the wrong thing or fields no longer mapped.

There are three failure modes to plan for:

  • Wrong links: two records matched that are not the same customer, or the same customer left split.

  • Schema drift: the ontology no longer describes the data actually arriving.

  • Stale facts: a value changed at the source but the graph still holds the old one.

The defence is traceability plus review. If every value points to its source, you can recheck a link against evidence instead of trusting it. A rule engine that flags what does not add up, and a person who approves uncertain changes, keeps errors from spreading quietly. Helix Foundry is built to handle this work: self-healing, creating correct links, and updating the schema and graph as the workload and data change. The mechanics are in Self-Healing Ontology: Keeping Links Right as Data Drifts.

Build one with Helix Foundry

Helix Foundry connects your databases, tools and documents, has an ontology agent draft one ontology over them, and loads it into HelixDB as one connected graph. It is open source under Apache 2.0, and the repo is helix-foundry on GitHub.

To run it on your computer you need Docker with Compose v2 and ports 3000 and 8333 free:

git clone https://github.com/helixdb/helix-foundry.git
cd helix-foundry
docker compose up -d --wait

Then open http://localhost:3000. The self-hosted install is single-user on localhost with no sign-in, so do not expose it to a network. To skip the local setup, use Helix Cloud at foundry.helix-db.com and choose Set up with your agent.

Then follow this order:

  1. Connect sources. Foundry lists connectors for PostgreSQL, MySQL, Amazon S3, Stripe, Attio and Granola, among others, plus documents. There are no Salesforce or HubSpot connectors, so plan around what is listed.

  2. Let the agent draft the ontology. Review the entity types and links it proposes: customers, orders, people, documents.

  3. Load and inspect. Open the graph, click a value and confirm it traces to a source row or document quote.

  4. Query it. Use Analyst, the Helix MCP, dashboards or workflows.

For a concrete customer example, see Build a Customer Ontology From Attio, Granola and Stripe, and for the document side, How to Extract an Ontology From Contracts and PDFs.

Trade-offs: when a context graph is not worth it

Skip a context graph when your agent only needs to search one pile of documents. Plain retrieval over a single source is cheaper and good enough, and a graph adds modelling work you will not use.

It is also overkill when your data lives in one system with clean keys, since a SQL view already gives you the connections. And decision traces only pay off if decisions are actually recorded somewhere: if approvals happen in hallway chats, the graph has nothing to link.

It earns its cost when the same customer, order or vendor appears across several tools under different names, when you need to trace an answer back to evidence, or when agents act on the data and a wrong link has a price. Be honest about upkeep too: the graph needs review when sources change, which is exactly the work to automate before you rely on it.

Start with one connected slice, then add decisions

A context graph is only as good as its links and its provenance, so build it small and check it against sources before you widen it. Clone helix-foundry, connect two systems that share a customer, and confirm every value in the loaded HelixDB graph traces to its source. Then add the decisions your agents make and let them query precedent.

Try Foundry on a sample company

Sign in and Foundry sets up Acme Corp: its database and documents connected into one ontology you can explore and ask questions of, with a source behind every answer. Then connect your own data.