Storage
Agents use storage to persist sessions by storing them in a database.
Agents come with built-in memory, but it only lasts while the session is active. To continue conversations across sessions, we store agent sessions in a database like PostgreSQL.
The general syntax for adding storage to an Agent looks like:
Example
Create an Agent with Storage
Create a file agent_with_storage.py
with the following contents
Run the agent
Install libraries
MacWindows
Run the agent
Now the agent continues across sessions. Ask a question:
Then message bye
to exit, start the app again and ask:
Start a new run
Run the agent_with_storage.py
file with the --new
flag to start a new run.
Params
storage
Optional[AgentStorage]
None
Storage mechanism for the agent, if applicable.
Last updated