Version 0.10.0 introduces a major refactoring of the memory system, separating it into two distinct types:
- Chat Memory - Conversation history (sequential storage)
- Knowledge Memory - RAG/Semantic search (vector-based)
memory/
├── base.py # BaseMemory
├── simple.py # SimpleMemory
├── chroma.py # ChromaMemory (mixed purpose)
└── faiss.py # FAISSMemory (mixed purpose)
memory/
├── chat/ # Conversation history
│ ├── base.py # BaseChatMemory
│ ├── simple.py # SimpleChatMemory
│ └── sqlite.py # SQLiteChatMemory (NEW!)
│
├── knowledge/ # RAG / Semantic search
│ ├── base.py # BaseKnowledgeMemory
│ ├── chroma.py # ChromaKnowledgeMemory
│ └── faiss.py # FAISSKnowledgeMemory
│
└── adapters.py # Backward compatibility
from react_agent_framework.core.memory import SimpleMemory
from react_agent_framework.core.memory import ChromaMemory
from react_agent_framework.core.memory import FAISSMemory# Chat memory
from react_agent_framework.core.memory.chat import SimpleChatMemory
from react_agent_framework.core.memory.chat import SQLiteChatMemory
# Knowledge memory
from react_agent_framework.core.memory.knowledge import ChromaKnowledgeMemory
from react_agent_framework.core.memory.knowledge import FAISSKnowledgeMemorypip install react-agent-framework # SQLite included (stdlib)# ChromaDB
pip install react-agent-framework[knowledge-chroma]
# FAISS
pip install react-agent-framework[knowledge-faiss]
# Both
pip install react-agent-framework[all-memory]Old Code (v0.9.x):
from react_agent_framework import ReactAgent
from react_agent_framework.core.memory import SimpleMemory
agent = ReactAgent(
name="Assistant",
memory=SimpleMemory(max_messages=100)
)New Code (v0.10.0):
from react_agent_framework import ReactAgent
from react_agent_framework.core.memory.chat import SimpleChatMemory
agent = ReactAgent(
name="Assistant",
chat_memory=SimpleChatMemory(max_messages=100)
)from react_agent_framework import ReactAgent
from react_agent_framework.core.memory.chat import SQLiteChatMemory
agent = ReactAgent(
name="Assistant",
chat_memory=SQLiteChatMemory(
db_path="./conversations.db",
session_id="user_123"
)
)
# Chat history persists across restarts!
agent.run("Hello!")
# Later...
agent.run("What did we talk about?") # Remembers previous conversationOld Code (mixed purpose):
from react_agent_framework import ReactAgent
from react_agent_framework.core.memory import ChromaMemory
agent = ReactAgent(
name="Assistant",
memory=ChromaMemory(collection_name="docs")
)
# This was confusing - was it for chat or RAG?
agent.memory.add("Python is a programming language", role="system")New Code (clear separation):
from react_agent_framework import ReactAgent
from react_agent_framework.core.memory.chat import SQLiteChatMemory
from react_agent_framework.core.memory.knowledge import ChromaKnowledgeMemory
agent = ReactAgent(
name="Assistant",
chat_memory=SQLiteChatMemory("./chat.db"), # Conversation history
knowledge_memory=ChromaKnowledgeMemory("./kb") # RAG knowledge base
)
# Add documents to knowledge base
agent.knowledge_memory.add_document(
"Python is a programming language",
metadata={"category": "programming"}
)
# Search knowledge base
results = agent.knowledge_memory.search("programming languages", top_k=3)
for doc in results:
print(doc.content)from react_agent_framework import ReactAgent
from react_agent_framework.core.memory.chat import SQLiteChatMemory
from react_agent_framework.core.memory.knowledge import FAISSKnowledgeMemory
# Create agent with both types
agent = ReactAgent(
name="Technical Assistant",
chat_memory=SQLiteChatMemory("./chat.db"),
knowledge_memory=FAISSKnowledgeMemory("./tech_docs")
)
# Load technical documentation
docs = [
"Docker is a containerization platform",
"Kubernetes orchestrates containers",
"FastAPI is a modern Python web framework"
]
agent.knowledge_memory.add_documents(docs)
# Chat with RAG
answer = agent.run("How do I deploy a FastAPI app with Docker?")
# Agent uses:
# 1. chat_memory for conversation context
# 2. knowledge_memory for technical documentation- Purpose: Store sequential chat history
- Storage: SQLite, in-memory
- Retrieval: Chronological order, simple keyword search
- Use Case: Maintain conversation context
- Purpose: Store documents for semantic search
- Storage: Vector databases (ChromaDB, FAISS)
- Retrieval: Semantic similarity search
- Use Case: Retrieval Augmented Generation
agent = ReactAgent(
memory=SimpleMemory() # Deprecated
)agent = ReactAgent(
chat_memory=SimpleChatMemory(), # Chat history
knowledge_memory=ChromaKnowledgeMemory() # RAG (optional)
)The old API still works! We provide adapters for backward compatibility:
from react_agent_framework import ReactAgent
from react_agent_framework.core.memory import SimpleMemory # Old import
agent = ReactAgent(
memory=SimpleMemory() # Still works!
)However, you should migrate to the new API for:
- ✅ Better performance
- ✅ Clear separation of concerns
- ✅ Access to new features (SQLite, better RAG)
- ✅ Future-proof code
| Feature | Old (v0.9.x) | New Chat (v0.10.0) | New Knowledge (v0.10.0) |
|---|---|---|---|
| Purpose | Mixed | Conversation history | RAG/Search |
| Storage | In-memory/Vector | In-memory/SQLite | Vector DB |
| Persistence | Limited | ✅ SQLite | ✅ ChromaDB/FAISS |
| Search | Basic | Keyword | Semantic |
| Sessions | Basic | ✅ Multi-session | N/A |
| Scalability | Low | Medium | High |
- Update imports - Use new
chatandknowledgepackages - Separate concerns - Use chat memory for history, knowledge memory for RAG
- Try SQLite - Persistent chat history without external dependencies
- Leverage RAG - Use knowledge memory for document search