Skip to content

LuoDaa/EdgeMemory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

EdgeMemory β€” LangGraph Memory-Enhanced AI Agent

Python License LangGraph

Cross-platform LangGraph agent with local LLM/LoRA, RAG, and multi-backend memory

Overview

EdgeMemory is a memory-enhanced AI agent built on LangGraph, designed to run entirely on local hardware. It integrates multiple memory backends (Kuzu graph DB + LanceDB vector store) with on-device LLM inference (llama.cpp) and LoRA fine-tuning for truly personalized AI experiences.

Why EdgeMemory?

  • πŸ›‘οΈ Fully Local β€” No cloud dependency. Your conversations, memories, and data stay on your machine.
  • 🧠 Deep Memory β€” Combines episodic events, semantic entities, preferences, procedures, and encrypted secrets across KuzuDB (graph) and LanceDB (vector).
  • πŸ”₯ Hot-Swap LoRA β€” Load/unload fine-tuned LoRA adapters at runtime without restarting the agent.
  • πŸ“Š LangGraph Orchestration β€” Modular graph nodes for intent routing, memory read/write, RAG retrieval, planning, and answer merging.
  • 🌐 Web UI + CLI β€” Built-in web dashboard (FastAPI + static HTML) and CLI for local interaction.
  • πŸ”Œ Extensible β€” Provider-agnostic LLM client; swap in any OpenAI-compatible API or local model.

Architecture

User Input
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  LangGraph Orchestration    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Router  β”‚β†’β”‚ Intent   β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚       ↓              ↓      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Memory  β”‚  β”‚ Planner  β”‚ β”‚
β”‚  β”‚ R/W     β”‚  β”‚          β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚       ↓              ↓      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”β”‚
β”‚  β”‚ RAG Retrieveβ”‚  β”‚Answer β”‚β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”˜β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    β”‚              β”‚
    β–Ό              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ KuzuDB β”‚  β”‚ LanceDB  β”‚
β”‚(Graph) β”‚  β”‚ (Vector) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    β”‚
    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ llama.cpp  β”‚
β”‚ + LoRA     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Memory Backends

Backend Type Purpose
KuzuDB Graph Database Entities, relationships, events, procedures, preferences
LanceDB Vector Store Semantic search, document RAG, embedding retrieval
SQLite Relational Chat history, fine-tune jobs, checkpoints

Memory Types

  • Core Profile β€” User identity, basic facts (key-value)
  • Episodic Events β€” Time-stamped events with participants and topics
  • Semantic Entities β€” People, places, things with typed relationships
  • Preferences β€” User likes/dislikes with confidence scoring
  • Procedures β€” Multi-step process templates
  • Encrypted Secrets β€” AES-GCM encrypted sensitive information with double-confirmation reveal flow

Quick Start

Prerequisites

  • Python 3.10+
  • CUDA-capable GPU (recommended) or CPU with 8GB+ RAM
  • Windows, Linux, or macOS

Installation

# Clone the repository
git clone https://github.com/YOUR_USERNAME/EdgeMemory.git
cd EdgeMemory

# Create virtual environment
python -m venv .venv
# Windows
.\.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Download Models

  1. Download a GGUF model (e.g., Qwen2.5-7B-Instruct-Q4_K_M.gguf) and place in models/
  2. (Optional) Download embedding model for vector search

Configuration

Copy and edit the sample config:

cp edge_agent.yaml.sample edge_agent.yaml

Edit edge_agent.yaml to set model paths, ports, and memory settings.

Launch

# Full application (Web UI + Qt + API)
python edge_agent_main.py

# CLI-only mode
python core/src/main.py

# Build LanceDB index
python core/src/build_index.py

Access the web UI at http://localhost:8080.

Project Structure

EdgeMemory/
β”œβ”€β”€ core/src/           # Main source code
β”‚   β”œβ”€β”€ nodes/          # LangGraph nodes (router, intent, planner, memory, answer...)
β”‚   β”œβ”€β”€ rag/            # LanceDB retriever
β”‚   β”œβ”€β”€ memory/         # KuzuDB ingest, snapshot, contract
β”‚   β”œβ”€β”€ llm/            # Local LLM client (llama.cpp wrapper)
β”‚   β”œβ”€β”€ vector_store/   # LanceDB store + index builder
β”‚   β”œβ”€β”€ db/             # Chat logger, SQLite persistence
β”‚   β”œβ”€β”€ workers/        # Async tasks (embedding, ingest, finetune, summarize)
β”‚   β”œβ”€β”€ tools/          # CLI utilities (clean, sync)
β”‚   └── utils/          # Config, paths, watchdog, LoRA state, resource guard
β”œβ”€β”€ apps/               # Qt desktop client
β”œβ”€β”€ frontend/           # Web frontend assets
β”œβ”€β”€ TTS/                # Text-to-speech integration
β”œβ”€β”€ tools/              # Additional tooling
β”œβ”€β”€ edge_agent_main.py  # Main entry point
└── edge_agent.yaml     # Configuration

Configuration Reference

Key settings in edge_agent.yaml:

# LLM server settings
llama_server:
  host: localhost
  port: 8080
  model_path: models/your-model.gguf

# Embedding server
embedding:
  host: localhost
  port: 8081
  model_path: models/embedding-model.gguf

# Memory backends
memory:
  kuzu_path: artifacts/kuzu_db
  lancedb_path: artifacts/lancedb

# LoRA
lora:
  enabled: false
  adapter_path: models/lora-adapter.gguf

Dependencies

  • LangGraph β€” Agent orchestration framework
  • llama.cpp β€” Local LLM inference (via llama-server)
  • KuzuDB β€” Embedded graph database for structured memory
  • LanceDB β€” Embedded vector database for semantic search
  • FastAPI β€” REST API + WebSocket server
  • PySide6 β€” Qt desktop client (optional)

Roadmap

  • Docker Compose one-click deployment
  • Multi-user session support
  • Memory visualization dashboard
  • Plugin system for custom memory types
  • Remote LLM provider support (OpenAI-compatible API)

Contributing

See CONTRIBUTING.md for guidelines.

License

Apache 2.0 β€” See LICENSE for details.

About

LangGraph memory-enhanced AI agent with local LLM/LoRA, RAG, and multi-backend memory (KuzuDB + LanceDB). Fully local, privacy-first.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors