Skip to main content

Grid Memory — shared persistent memory for multi-agent teams

Project description

Grid Memory — Python SDK

Shared persistent memory for multi-agent teams. Works with AutoGen, CrewAI, and LangGraph.

pip install grid-memory

Quick Start

from grid_memory import Grid

grid = Grid("http://localhost:8080", default_agent_id="my-agent")

# Write facts, decisions, and handoffs
grid.fact("PostgreSQL pool max: 25 connections", tags=["database"])
grid.decide("Use Express over Fastify", tags=["architecture"],
            rationale="Better middleware ecosystem maturity")
grid.handoff(from_agent="researcher", to_agent="builder",
             content="API spec ready in docs/api-v2.md", status="ready")

# Query by tags, agent, type
entries = grid.query(tags=["database"])
for e in entries["entries"]:
    print(f"[{e['type']}] {e['agent_id']}: {e['content'][:100]}")

# Inject context into agent prompts
context = grid.inject("building the API layer")
print(context)
# ─── SHARED MEMORY GRID ───
# [fact] 18:05 — agent:architect — database
# PostgreSQL pool max: 25 connections
# ─── END GRID ───

# Admin
info = grid.info()
grid.prune()
grid.forget("grid_20260529_abc123")

Per-Agent Identity

All convenience methods accept an agent_id parameter:

grid.fact("Important note", agent_id="researcher-1")   # override per-call
grid.decide("Architecture decision", agent_id="lead-architect")

Or set a default for the client:

grid = Grid(default_agent_id="worker-bee")
grid.fact("My fact")  # uses "worker-bee"

Framework Plugins

AutoGen

from grid_memory import AutoGenGridPlugin
import autogen

# Create the plugin
grid_plugin = AutoGenGridPlugin(agent_id="researcher")

# Create your agent normally
agent = autogen.AssistantAgent(
    name="researcher",
    llm_config=llm_config,
)

# Wrap it — auto-injects Grid context before messages, logs exchanges
agent = grid_plugin.wrap(agent)

CrewAI

from grid_memory import CrewAITool
from crewai import Agent

grid_tool = CrewAITool(agent_id="researcher")

agent = Agent(
    name="Researcher",
    tools=[
        grid_tool.query_tool(),    # query the Grid
        grid_tool.write_tool(),    # write to the Grid
        grid_tool.context_tool(),  # inject context
    ],
)

LangGraph

from grid_memory import langgraph_grid_node
from langgraph.graph import StateGraph

# Create a Grid injection node
inject_context = langgrid_grid_node(agent_id="my-agent")

graph = StateGraph(AgentState)
graph.add_node("grid_inject", inject_context)
graph.add_edge("grid_inject", "next_node")

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests (requires Grid server at localhost:8080)
pytest tests/

Framework Comparison

Feature Grid Memory LangMem Mem0 Zep
Multi-agent shared store ✅ Built for this ❌ Per-agent only ❌ Per-user only ❌ Per-user only
Tagged + TTL'd entries ✅ Built-in ⚠️ Manual ✅ Time-based
Relevance scoring ✅ Tag > type > recency ⚠️
Context injection block ✅ Markdown, LLM-ready
Append-only audit ✅ Immutable entries
Zero dependencies ✅ Pure stdlib
Single Docker container ✅ 130MB Requires DB
API REST + Python + Node SDK Python SDK Python SDK REST + SDK

Running the Grid Server

# Docker (recommended)
docker compose up -d

# Or directly with Node (requires Node >= 18)
cd ../../
node server.js

# Verify
curl http://localhost:8080/health

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

grid_memory-1.2.4.tar.gz (154.8 kB view details)

Uploaded Source

Built Distribution

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

grid_memory-1.2.4-py3-none-any.whl (104.4 kB view details)

Uploaded Python 3

File details

Details for the file grid_memory-1.2.4.tar.gz.

File metadata

  • Download URL: grid_memory-1.2.4.tar.gz
  • Upload date:
  • Size: 154.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for grid_memory-1.2.4.tar.gz
Algorithm Hash digest
SHA256 a3e985e4a647b5ca2aa4138f7ca7de905533e93b0d05ba5766390efd7a09b3c2
MD5 2158edb7e1211b9c90b46e80071645e2
BLAKE2b-256 df5eb00a0b999b3ae1166b4296562203db63c1718dae5e76e05364dc9db5ffd0

See more details on using hashes here.

File details

Details for the file grid_memory-1.2.4-py3-none-any.whl.

File metadata

  • Download URL: grid_memory-1.2.4-py3-none-any.whl
  • Upload date:
  • Size: 104.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for grid_memory-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 30c89b17acabf6846a14c1fe538fb20fa0f0f0c02919272029777ad82a6994ba
MD5 d503c565f61f5ea05e0dfa0d84e84302
BLAKE2b-256 807176a002298104071827d4707c80246dcda581bf3ff1b2c8d60de8b7f7b66f

See more details on using hashes here.

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