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.2.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.2-py3-none-any.whl (104.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: grid_memory-1.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0dfba7c6c23754d1dbe843adebea90b6bf2c1d2fbc05dee504bdb1ea8b81aaa9
MD5 2bea89b60a37780a7dfd40d80da05a11
BLAKE2b-256 711497949b0cf53997200a5427c5a1684b5686a5bd9243518655bd237c2a7e3d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: grid_memory-1.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c960b19be6bc2b92519858ebb7640179345ba8ef0717fd406962475e3ba6632e
MD5 250e8f547e5d20ed970a0f54dbc8bb9a
BLAKE2b-256 942528692edff9b23846a23a38705af566f37ca8141c2420d61091bd434fd173

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