Skip to main content

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

Release files for grid-memory 1.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grid-memory 1.2.4
File Size Uploaded
grid_memory-1.2.4.tar.gz 154.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for grid-memory 1.2.4
File Interpreter ABI Platform
grid_memory-1.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 259.2 kB

Release files / grid_memory-1.2.4.tar.gz

Download URL grid_memory-1.2.4.tar.gz
Size 154.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a3e985e4a647b5ca2aa4138f7ca7de905533e93b0d05ba5766390efd7a09b3c2
BLAKE2b-256 checksum
How to use checksums
df5eb00a0b999b3ae1166b4296562203db63c1718dae5e76e05364dc9db5ffd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / grid_memory-1.2.4-py3-none-any.whl

Download URL grid_memory-1.2.4-py3-none-any.whl
Size 104.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
30c89b17acabf6846a14c1fe538fb20fa0f0f0c02919272029777ad82a6994ba
BLAKE2b-256 checksum
How to use checksums
807176a002298104071827d4707c80246dcda581bf3ff1b2c8d60de8b7f7b66f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.2.4 This release

2 release files

1.2.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page