8 Understanding agent memory and knowledge

 

This chapter covers

  • Retrieval in knowledge/memory in AI functions
  • Building retrieval augmented generation workflows with LangChain
  • Retrieval augmented generation for agentic knowledge systems in Nexus
  • Retrieval patterns for memory in agents
  • Improving augmented retrieval systems with memory and knowledge compression

Now that we’ve explored agent actions using external tools, such as plugins in the form of native or semantic functions, we can look at the role of memory and knowledge using retrieval in agents and chat interfaces. We’ll describe memory and knowledge and how they relate to prompt engineering strategies, and then, to understand memory knowledge, we’ll investigate document indexing, construct retrieval systems with LangChain, use memory with LangChain, and build semantic memory using Nexus.

8.1 Understanding retrieval in AI applications

Retrieval in agent and chat applications is a mechanism for obtaining knowledge to keep in storage that is typically external and long-lived. Unstructured knowledge includes conversation or task histories, facts, preferences, or other items necessary for contextualizing a prompt. Structured knowledge, typically stored in databases or files, is accessed through native functions or plugins.

8.2 The basics of retrieval augmented generation (RAG)

8.3 Delving into semantic search and document indexing

8.3.1 Applying vector similarity search

8.3.2 Vector databases and similarity search

8.3.3 Demystifying document embeddings

8.3.4 Querying document embeddings from Chroma

8.4 Constructing RAG with LangChain

8.4.1 Splitting and loading documents with LangChain

8.4.2 Splitting documents by token with LangChain

8.5 Applying RAG to building agent knowledge

8.6 Implementing memory in agentic systems

8.6.1 Consuming memory stores in Nexus

8.6.2 Semantic memory and applications to semantic, episodic, and procedural memory

8.7 Understanding memory and knowledge compression

8.8 Exercises

Summary