chapter eight

8 Understanding agent memory and knowledge

 

This chapter covers

  • How retrieval is used in knowledge and memory in AI applications functions
  • Building retrieval-augmented generation workflows with LangChain
  • Introducing RAG for agentic knowledge systems within Nexus
  • Implementing the retrieval pattern for memory in agents that consume various forms of memory, from conversation, semantic, episodic, and procedural
  • How memory and knowledge compression work and can improve augmented retrieval systems

Now that we have explored agent actions using external tools like 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 will describe memory and knowledge and how they relate to prompt engineering strategies, and then, to understand memory knowledge, we will 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 represents a storage mechanism that is typically external and long-lived. Unstructured retrieval can store conversation or task histories, facts, preferences, or other items necessary for contextualizing a prompt. Structured retrieval, 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

8.9 Summary