Memory and Knowledge
Now that our agents can take action using tools, it’s time to make them more intelligent in a more human-like way by giving them memory and knowledge. In this chapter, we will explore how to move beyond stateless interactions and give agents the ability to remember past messages, retain important facts, and reference external information sources when generating responses. This is a major leap forward in making agents more conversational, helpful, and context-aware.
Here is what you will learn as part of this chapter:
- Short-term memory: Learn how to track conversation history using message lists, loops, and the
Sessions
class to build multi-turn agents that remember what was said earlier in the session - Long-term memory: Persist memory across sessions using
SQLiteSession
, and go further with structured memory using function tools that store and recall key facts - Training knowledge: Understand what knowledge the model already has...