Skip to content

MemoryAgent is a memory-aware conversational workflow built using LangGraph and LangChain. Its purpose is to enable AI agents to extract, store, and recall user-specific memories across interactions, making conversations more contextual, personalized, and continuous over time.

License

Notifications You must be signed in to change notification settings

mnk-nasir/MemoryAgent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 MemoryAgent

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.


✨ Features

  • πŸ”Ž 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 StateGraph for extensibility and customization.
  • πŸ›‘ Error Resilience – Includes robust error handling and structured logging.

πŸš€ Use Cases

  • 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.

πŸ“¦ Installation

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.

About

MemoryAgent is a memory-aware conversational workflow built using LangGraph and LangChain. Its purpose is to enable AI agents to extract, store, and recall user-specific memories across interactions, making conversations more contextual, personalized, and continuous over time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published