8000 GitHub - MehulG/memX: A real-time shared memory layer for multi-agent LLM systems.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MehulG/memX

Repository files navigation

🧠 memX Context Store

A real-time shared memory layer for multi-agent LLM systems.

Built for coordination, not just storage — with pub/sub, schema enforcement, and API-key ACLs.

Think: Redis + schema + pub/sub + ACL — purpose-built for agents.


🎬 Example: Multi-Agent LLMs Using memX Shared Memory

💡 Three autonomous LLM agents collaborate on a research task using memX — no chat, no controller, just shared memory.

🧠 Each agent reads/writes to shared keys:

Agent What it does
QueryAgent Seeds the research question + background context
ExplorerAgent Adds search results + working thoughts
SynthesizerAgent Summarizes shared context into a final insight
MonitorAgent Logs how memory evolves in real time

💡 All communication happens only through shared keys in memX.

memX agent demo

🚀 Features

  • 🔄 Real-time context sync (WebSocket)
  • 📬 Pub/sub updates on key change
  • 📐 JSON Schema validation (per key)
  • 🔐 API key-based access control
  • 🐍 Python SDK (context-sdk) for easy integration
  • 🐳 Docker-compatible self-hosting

📦 Quickstart

▶️ Install SDK

pip install context-sdk

💡 Usage Example

from context_sdk import AgentContext

ctx = AgentContext(api_key="agent_key_1")
ctx.set("agent:goal", "navigate kitchen")
ctx.subscribe("agent:goal", lambda data: print("Goal:", data["value"]))

⚙️ Run the Server

Option 1: Local Dev

uvicorn main:app --reload

Option 2: Docker

docker-compose up --build

Visit: http://localhost:8000/docs for interactive Swagger UI.


🔑 Adding API Keys

Edit config/acl.json:

{
  "agent_key_1": ["agent:*"],
  "planner_key": ["agent:goal"]
}

📐 Setting Schemas

POST /schema
Headers: x-api-key
Body:
{
  "key": "agent:state",
  "schema": {
    "type": "object",
    "properties": {"x": {"type": "number"}, "y": {"type": "number"}},
    "required": ["x", "y"]
  }
}

Or dynamically via SDK:

ctx.set_schema("agent:state", schema_dict)

📁 Project Structure

core/       # FastAPI + WebSocket backend
sdk/        # Python SDK (installable)
config/     # Contains acl.json, (optionally schemas.json)
examples/   # Agent examples

About

A real-time shared memory layer for multi-agent LLM systems.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0