MemoryAgent is a memory-aware conversational workflow built using LangGraph and LangChain.
It enables AI agents to extract, store, and recall user-specific memories across interactions, making conversations more contextual, personalized, and continuous over time.
- π Contextual Memory Retrieval β Fetches relevant past memories using semantic search.
- π Dynamic Memory Storage β Automatically stores new insights with
upsert_memory. - β³ Temporal Awareness β Injects current timestamps for time-sensitive reasoning.
- π Tool-Augmented LLM β Lets the model call structured tools for memory updates.
- π Modular Workflow β Built with
StateGraphfor extensibility and customization. - π‘ Error Resilience β Includes robust error handling and structured logging.
- Personal AI Assistants β Remember user preferences and conversations across sessions.
- Customer Support Agents β Retain context about past issues for smoother resolutions.
- Knowledge Management β Extract, organize, and recall key details from conversations.
- Adaptive Dialogue Systems β Build natural, human-like conversational AI that learns over time.
Clone the repository and install dependencies:
git clone https://github.com/<your-username>/recallflow.git
cd recallflow
pip install -r requirements.txt
β‘ Usage
Hereβs a quick example of running RecallFlow inside your project:
import asyncio
from langgraph.runtime import Runtime
from memory_agent.context import Context
from memory_agent.state import State
from recallflow import graph
async def main():
runtime = Runtime(context=Context(user_id="user123", model="gpt-4", system_prompt="System prompt template"))
state = State(messages=[])
result = await graph.ainvoke(state, runtime=runtime)
print(result)
asyncio.run(main())
π Development
Code is organized around LangGraph workflows (StateGraph).
Memories are stored via BaseStore (customizable for databases, vector stores, or cloud backends).
LLM initialized via langchain.chat_models.init_chat_model.
Run tests:
pytest
π Project Structure
recallflow/
βββ memory_agent/
β βββ context.py # Context schema (user_id, model, system_prompt)
β βββ state.py # State schema (conversation state, messages)
β βββ tools.py # Tool definitions (e.g., upsert_memory)
β βββ utils.py # Utility helpers
βββ recallflow.py # RecallFlow graph definition
βββ requirements.txt # Dependencies
βββ README.md # Project docs
π€ Contributing
Contributions are welcome!
Feel free to open issues, suggest features, or submit pull requests.