memory_agent.py
sarah. The second run uses the same user_id, so the agent can recall those facts in a different session.
How Memory Works
user_ididentifies whose memories should be loaded.- The configured database stores each user’s memory records.
- Stored memories for that user are added to the model context for later runs.
- The selected memory mode controls when records are created, updated, or deleted.
Choose a Memory Mode
Automatic memory applies one consistent extraction step during each run. Agentic memory adds memory tools to the agent’s toolset and lets the model choose when to call them.
When both settings are enabled, agentic memory takes precedence and the automatic extraction step is skipped. Choose one mode for each agent.
Memory, History, and State
These features can work together. A support agent can use memory for the customer’s communication preference, history for the current ticket, and state for the ticket status.
Store and Inspect Memories
Memories use the database configured on the agent. The default table or collection name isagno_memories. Set memory_table on the database when your application needs a custom name.
Next Steps
Agent Memory
Configure memory for a single agent.
Team Memory
Share user memories with a team and its members.
Working with Memories
Customize memory creation, retrieval, and storage.
Production Best Practices
Plan user isolation, retention, and memory quality checks.