Overview
The Agno Memory Agent demonstrates how to create intelligent agents with persistent memory capabilities using the Agno framework and Nebius AI models. This example shows both agentic memory (agent-controlled memory updates) and user memories (automatic memory extraction from conversations).Key Features
- Persistent Memory: SQLite-based memory storage across sessions
- Agentic Memory: Agents actively manage their own memories
- User Memories: Automatic memory extraction from conversations
- Chat History: Complete conversation history with configurable retention
- Streaming Responses: Real-time agent responses with intermediate steps
Memory Architecture
Memory Storage
Agno uses a dual-storage system:The memory system uses two separate tables:
user_memories for extracted facts and agent_sessions for chat history.Agent Configuration
Implementation Example
Basic Memory Usage
Memory Types
Agentic Memory
Whenenable_agentic_memory=True, the agent can:
- Create new memories based on user information
- Update existing memories with new details
- Delete outdated or incorrect memories
- Reason about what information to store
User Memories
Whenenable_user_memories=True, the system automatically:
- Extracts key facts from conversations
- Associates memories with specific users via
user_id - Updates memories when new information is provided
- Retrieves relevant memories for context
Memory Operations
Retrieving Memories
Chat History
Database Schema
The application creates two SQLite tables:| Table | Purpose | Key Fields |
|---|---|---|
user_memories | Stores extracted user facts | user_id, memory_text, created_at |
agent_sessions | Stores conversation history | session_id, user_id, messages, created_at |
Configuration Options
Allows the agent to actively create and manage memories
Automatically extracts and stores user information from conversations
Number of previous conversation runs to include in context
Whether to include chat history in the message context
Use Cases
Personal Assistants
Remember user preferences, schedules, and personal information across sessions
Customer Support
Maintain context of customer issues and previous interactions
Educational Tutors
Track student progress, learning style, and knowledge gaps
Health Coaches
Remember health goals, medical history, and progress over time
Installation
Environment Setup
Create a.env file:
Running the Example
Expected Output
The example demonstrates a three-step conversation flow:- Introduction: User shares personal information
- Location Query: Agent uses stored memories to provide personalized recommendations
- Memory Recall: Agent retrieves and summarizes stored information
Best Practices
Configure History Carefully
Set
num_history_runs based on your use case - higher values consume more tokensClear Memories When Needed
Use
memory.clear() to reset the memory system during development or testingRelated Resources
Agno Documentation
Official Agno framework documentation
Nebius AI
Nebius AI model provider