Skip to main content

Memory system for AI agents with Structured RAG, built on TypeAgent

Project description

Fork Changes

I've been keeping an eye on this repo for a while. I'm also personally interested in personal assistant agents, and I've been trying to find best practices for memory. Structured RAG is a great design, but since this is an experimental project, the feature set isn't complete yet. So I forked the original repo and added more features, aiming to make it work for more general use cases and projects.

This fork adds Momex - a high-level memory API for AI agents, built on TypeAgent's Structured RAG.

What's New

  • Structured memory - Entity/action/topic extraction via LLM, term-based indexing
  • Short-term memory - Session-based conversation history with persistence
  • Embedding fallback - search_by_embedding() for fast similarity search without LLM
  • Multi-tenant support with hierarchical collections (user:xiaoyuzhang)
  • PostgreSQL backend with pgvector for production deployment

Installation

pip install momex

Quick Start

import asyncio
from momex import Memory, MomexConfig, LLMConfig

async def main():
    config = MomexConfig(
        llm=LLMConfig(provider="openai", model="gpt-4o", api_key="sk-xxx"),
    )

    # Create a memory collection
    memory = Memory(collection="user:xiaoyuzhang", config=config)

    # Add memories — automatically extracts entities, actions, topics
    await memory.add("My name is Xiaoyu, I love Python programming")

    # Search — returns structured results you can feed to your own agent
    results = await memory.search("Python")
    for item in results:
        print(f"[{item.type}] {item.text}")

    # Query — returns an LLM-generated answer
    answer = await memory.query("What does the user love?")
    print(answer)  # "The user loves Python programming."

asyncio.run(main())

See docs/momex.md for full documentation.


Python package 'typeagent'

This is an experimental prototype

Working toward a shared understanding of the MVP for structured RAG.

This is sample code

This is an in-progress project aiming at a Pythonic translation of TypeAgent KnowPro and a few related packages from TypeScript to Python.

Warning

This library will send its input to an LLM hosted by a third party. Don't use it to index confidential information.

Documentation

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

momex-0.2.1.tar.gz (7.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

momex-0.2.1-py3-none-any.whl (208.1 kB view details)

Uploaded Python 3

File details

Details for the file momex-0.2.1.tar.gz.

File metadata

  • Download URL: momex-0.2.1.tar.gz
  • Upload date:
  • Size: 7.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for momex-0.2.1.tar.gz
Algorithm Hash digest
SHA256 531ab7cfc554d69bac107429c462dc071c46783d7e80de38b040b6791f876ab6
MD5 272de2d72c0fbf0f3772d0b6312360c0
BLAKE2b-256 06a4223e79908749d3ec709797e8a2e73b0c353f380d93d2c050e6a3e1973545

See more details on using hashes here.

Provenance

The following attestation bundles were made for momex-0.2.1.tar.gz:

Publisher: release-py.yml on xiaoyu-work/momex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file momex-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: momex-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 208.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for momex-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1962f49625dd4f0029facffb67061156ffcf14bb9c2a5872e7da59614f935c88
MD5 578d671f99143834d8cd70c985ef0ce1
BLAKE2b-256 4e35c5abb9b3bcd478fe8839d83427e02b2368fac654b3181654f1138a07d04b

See more details on using hashes here.

Provenance

The following attestation bundles were made for momex-0.2.1-py3-none-any.whl:

Publisher: release-py.yml on xiaoyu-work/momex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page