Add production-grade memory with hybrid search to any AI agent
GitHub RepoImpressions444

Add production-grade memory with hybrid search to any AI agent

@githubprojectsPost Author

Project Description

View on GitHub

Give Your AI Agent a Real Memory

Building an AI agent that can hold a coherent conversation beyond a single session is tough. You can bolt on a vector store, but getting production-ready, long-term memory with the nuance of semantic and keyword search often means a complex, multi-service setup. What if you could add that capability in a few lines of code?

That's the idea behind memory-lancedb-pro. It's a drop-in memory module designed to give any AI agent—whether it's a chatbot, an analysis tool, or an automation assistant—a persistent, searchable memory using LanceDB's hybrid search. No more starting from scratch every time.

What It Does

In short, this package provides a production-grade memory system for AI agents. It uses LanceDB as the backend, which is an embedded vector database that's fast and doesn't require a separate server. The key feature is hybrid search: it combines semantic (vector) search with traditional keyword (full-text) search. This means your agent can find relevant past interactions based on the meaning and specific terms used, making memory retrieval much more accurate and context-aware.

You feed it conversation turns, documents, or any text data. It stores them with embeddings and metadata. Later, when your agent needs context, you query this memory, and it returns the most relevant snippets using that hybrid approach.

Why It's Cool

The "pro" in the name hints at its focus on being ready for real use. It's not just a prototype.

  • Hybrid Search Out-of-the-Box: Combining BM25 keyword scoring with cosine similarity for vector search is a known best practice for relevance, but implementing it yourself is a chore. This handles it automatically.
  • LanceDB is a Great Fit: Being an embedded database, it simplifies deployment dramatically. You get powerful vector search without managing a separate database process. It's just files on disk.
  • It's an Agent-First Module: It's designed to be integrated into existing agent frameworks or custom loops. You can slot it into a LangChain agent, an AutoGen workflow, or your own Python-based bot with minimal fuss.
  • Handles the Chunking and Embedding: It manages the process of breaking down text into sensible chunks and generating embeddings for you, though you can customize this if needed.

How to Try It

Getting started is straightforward. You'll need Python and an OpenAI API key (or another compatible embedding provider).

  1. Install the package:

    pip install memory-lancedb-pro
    
  2. Basic integration looks like this:

    from memory_lancedb_pro import MemoryLancedbPro
    
    # Initialize the memory. It handles connection & table creation.
    memory = MemoryLancedbPro(
        uri="./lancedb_data", # Path for the database
        api_key="your-openai-key"
    )
    
    # Add some memories (like past conversation turns).
    memory.add_memory("The user said their favorite programming language is Python.")
    memory.add_memory("We discussed deploying applications using Docker containers.")
    
    # When you need context, search for it.
    results = memory.search_memory("What does the user like to code in?", limit=2)
    for res in results:
        print(f"Score: {res['score']:.3f} | Memory: {res['text']}")
    

The repository on GitHub has more detailed examples, including how to use it with different embedding models and customize the search behavior.

Check out the full code and docs here: https://github.com/CortexReach/memory-lancedb-pro

Final Thoughts

For developers building agents that need to remember, memory-lancedb-pro feels like a solid step in the right direction. It removes a significant infrastructure hurdle. Instead of worrying about the memory backend, you can focus on designing your agent's logic and personality.

If you're prototyping an agent and want to quickly add a capable memory layer, or if you're looking to replace a fragile homemade solution with something more robust, this is definitely worth a look. It gets you 80% of the way there with 10% of the work, which is usually a trade-off worth making.


Follow us for more projects: @githubprojects

Back to Projects
Project ID: 9faf5a5f-de7f-40a0-b01f-d1effb308f64Last updated: April 6, 2026 at 03:45 AM