liveBook · Manning

Knowledge graph

As explained in AI Agents in Action, Second Edition

A knowledge graph is a graph-structured representation of entities, entity types, observations, and relationships among them.

A knowledge graph represents entities, entity types, observations, and relationships as connected data. Instead of storing facts as a flat log, it makes relationships directly queryable. section 6.4.2 section 10.2.8

The basic mental model is simple: nodes represent entities such as people, places, or concepts; directed edges represent relationships; observations attach discrete facts to entities. A fact such as “Micheal lives in Calgary” creates two nodes and a labeled lives_in edge. section 6.4.2 section 10.2.8

Use the graph structure to support several kinds of retrieval and memory:

  • Query entities, entity types, and observations rather than scanning unrelated records. section 6.4.2
  • Represent long-term memories of conversations, agent activity, problem types, strategies, outcomes, and failure modes. section 6.4.2 section 10.2.8
  • Retrieve relevant entities before planning, record outcomes after evaluation, and connect strategies that succeed across related problems. section 10.2.8

A local memory graph

An MCP memory server can provide entities, relations, and observations through tools such as add_observation, add_relationship, and query_facts. A cognitive agent can search for task-related entities, inject matching observations into its workspace, and record the result after completing a task. section 6.4.2 section 10.2.8

Figure 6.10 Graph diagram examples from the Back to the Future script. The top of the figure explains the relationship between entities/nodes. Below, we see a simple node relationship graph among the various entities from the movie, where types of entities such as people are grouped together, and locations are grouped separately.

Inspect a visual graph showing nodes, relationships, and grouped entity types such as people and locations. section 6.4.2

Figure 10.7 The memory module’s three behaviors layered on the MCP memory server

Inspect how proactive retrieval, experience recording, and relation building turn a basic graph into an active memory component. section 10.2.8

How AI Agents in Action, Second Edition covers it

How deep it goes
Explains nodes, edges, observations, traversal, and memory workflows, while deferring graph database internals.
Examples
Uses a Back to the Future script, Micheal-to-Calgary relationship, and agent experiences as concrete graph examples.
What it assumes
Assumes basic familiarity with agents and MCP while defining graph primitives and showing memory use concretely.
What you can do after
Operate/configure a local MCP memory server and structure agent experiences for retrieval, recording, and relation building.
How it connects
Connects graph databases, Graph RAG, MCP, long-term memory, cognitive agents, entities, relations, and observations.

Also explained in

Compare how 12 books explain knowledge graph →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action, Second Edition. The section links point to the parts of the book it draws on.