Entity Memory and Knowledge Graphs
You'll learn: How AI agents can remember specific people, places, and concepts—and how they relate to each other—by storing them in structured formats instead of raw text.
The Problem with Raw Memory
When an agent stores conversation history as plain text, it's like keeping a diary. You can search it, but you can't easily answer questions like "Who does Sarah work with?" or "What cities has the user mentioned traveling to?" The relationships between entities get lost in paragraphs.
What Is Entity Memory?
Entity memory explicitly tracks important entities (people, companies, locations, concepts) and their relationships. Instead of remembering "Sarah mentioned she works with Bob at Acme Corp in Boston," the agent stores:
- Entity: Sarah (Person)
- Entity: Bob (Person)
- Entity: Acme Corp (Company)
- Entity: Boston (Location)
- Relationship: Sarah → works_with → Bob
- Relationship: Sarah → employed_at → Acme Corp
- Relationship: Acme Corp → located_in → Boston
This is called a knowledge graph—a network of nodes (entities) connected by edges (relationships).
Why Use Structured Storage?
Knowledge graphs let agents query specific patterns: "Show me all people connected to Acme Corp" or "What locations are associated with the user's work?" This beats searching through raw conversation text.
You can implement simple entity memory with dictionaries or databases, or use graph databases for complex relationship queries.
Key Takeaway: Entity memory and knowledge graphs help agents remember not just what was said, but who and what matter, and how they connect—enabling more intelligent, context-aware responses.