Skip to main content

Astrocyte

Astrocyte

Open-source memory framework for AI agents. Retain, recall, and synthesize — with pluggable backends, built-in governance, and 18 framework integrations.

PyPI Python License Docs


What is Astrocyte?

Astrocyte gives AI agents persistent memory — store what matters, retrieve what's relevant, synthesize answers from accumulated knowledge. It sits between your agents and their storage, providing:

  • Three operations: retain(), recall(), reflect() — one API for every agent and every backend
  • Pluggable backends: storage providers (pgvector, Pinecone, Qdrant, Neo4j) or engine providers (Mystique, Mem0, Zep, Letta)
  • Built-in governance: PII scanning, rate limits, token budgets, circuit breakers, access control, observability
  • 18 framework integrations: LangGraph, CrewAI, OpenAI, Claude Agent SDK, Google ADK, AutoGen, and more
  • MCP server: Any MCP-capable agent (Claude Code, Cursor, Windsurf) gets memory with zero code

Memory for your coding agent

Two commands give Claude Code, Codex, Cursor, Gemini CLI, Windsurf and Copilot CLI persistent memory — no database or server; it uses your Claude Code login (or OPENAI_API_KEY) for fact extraction and a local embedding model:

uv tool install 'astrocyte[local]'
astrocyte setup

setup stores memories in one local SQLite file, embeds them with a local model, and wires the MCP server into every agent it finds. In Claude Code, Codex and Antigravity it also turns on automatic memory (Copilot CLI recalls what the others saved): each finished turn is saved to that project's memory, and relevant memories are added to new prompts. Credentials are redacted before anything is stored.

astrocyte doctor          # check everything end to end (--fix repairs it)
astrocyte memory          # what is remembered about the project you're in
astrocyte memory import CLAUDE.md AGENTS.md docs/   # start with what the project already says
astrocyte memory forget <id>

Quick start (library)

pip install astrocyte
from astrocyte import Astrocyte

brain = Astrocyte.from_config("astrocyte.yaml")

# Store a memory
await brain.retain("Calvin prefers dark mode", bank_id="user-123")

# Recall relevant memories
hits = await brain.recall("What are Calvin's preferences?", bank_id="user-123")

# Synthesize an answer from memory
result = await brain.reflect("Summarize what we know about Calvin", bank_id="user-123")

Agent framework integrations

Astrocyte works with every major agent framework through thin middleware — one integration per framework, works with every memory backend.

Framework Module
LangGraph / LangChain astrocyte.integrations.langgraph
CrewAI astrocyte.integrations.crewai
OpenAI Agents SDK astrocyte.integrations.openai_agents
Claude Agent SDK astrocyte.integrations.claude_agent_sdk
Google ADK astrocyte.integrations.google_adk
Pydantic AI astrocyte.integrations.pydantic_ai
AutoGen / AG2 astrocyte.integrations.autogen
Smolagents (HuggingFace) astrocyte.integrations.smolagents
LlamaIndex astrocyte.integrations.llamaindex
Semantic Kernel astrocyte.integrations.semantic_kernel
DSPy astrocyte.integrations.dspy
CAMEL-AI astrocyte.integrations.camel_ai
BeeAI (IBM) astrocyte.integrations.beeai
Strands Agents (AWS) astrocyte.integrations.strands
LiveKit Agents astrocyte.integrations.livekit
Haystack (deepset) astrocyte.integrations.haystack
Microsoft Agent Framework astrocyte.integrations.microsoft_agent
MCP (Claude Code, Cursor) astrocyte.mcp

MCP server

Any MCP-capable agent gets memory with zero code integration. astrocyte setup registers it for you; to wire one by hand:

{
  "mcpServers": {
    "memory": {
      "command": "astrocyte-mcp",
      "args": ["--config", "astrocyte.yaml"]
    }
  }
}

Built-in governance

Neuroscience-inspired policies that protect every operation — regardless of backend:

  • PII barriers — regex, NER, or LLM-based scanning with redact/reject/warn actions
  • Rate limits & quotas — token bucket rate limiting and daily quotas per bank
  • Circuit breakers — automatic degraded mode when backends go down
  • Access control — per-bank read/write/forget/admin permissions
  • Observability — OpenTelemetry spans and Prometheus metrics on every operation
  • Data governance — classification levels, compliance profiles (GDPR, HIPAA, PDPA)

Multi-bank orchestration

Query across personal, team, and org banks with cascade, parallel, or first-match strategies:

hits = await brain.recall(
    "What are Calvin's preferences and team policies?",
    banks=["personal", "team", "org"],
    strategy="cascade",
)

Memory portability

Export and import memories between providers — no vendor lock-in:

await brain.export_bank("user-123", "./backup.ama.jsonl")
await brain.import_bank("user-123", "./backup.ama.jsonl")

Evaluation

Benchmark memory quality with built-in suites and DeepEval LLM-as-judge:

from astrocyte.eval import MemoryEvaluator

evaluator = MemoryEvaluator(brain)
results = await evaluator.run_suite("basic", bank_id="eval-bank")
print(f"Recall precision: {results.metrics.recall_precision:.2%}")

Benchmarks

Astrocyte includes adapters for two academic memory benchmarks plus built-in eval suites.

Benchmark What it tests Dataset
LoCoMo (ECAI 2025) Long-term conversational memory — single-hop, multi-hop, temporal, open-domain QA snap-research/locomo
LongMemEval Long-context memory extraction, reasoning, temporal ordering xiaowu0162/LongMemEval

Quick start

The PageIndex bench (M9+) requires Postgres + a real LLM provider; secrets are loaded via Doppler (DOPPLER_TOKEN set in your environment or doppler login once locally). The Makefile already runs doppler run -- for every bench target.

# Full LoCoMo run (200 stratified questions by default, ~$1 in API costs)
make bench-locomo

# Quick variant — cap to ~50 questions for fast iteration
make bench-locomo LOCOMO_MAX_Q=5

# LongMemEval (200 samples by default; ~$5 in API costs)
make bench-longmemeval
make bench-longmemeval LME_MAX_SAMPLES=50      # quick

# Parallel run on two Postgres containers (locomo on :5433, lme on :5434)
make bench-parallel

Results land under benchmark-results/pageindex/{locomo,lme}/ and are automatically uploaded to the R2 archive (see make bench-archive-* targets).

Dataset management

Datasets are cloned to datasets/ (gitignored) on first benchmark run. To manage manually:

make fetch-datasets       # Fetch all datasets
make clean-datasets       # Remove downloaded datasets
make clean-results        # Remove benchmark results

See docs/_design/evaluation.md for the full evaluation specification.

Development

From astrocyte-py/ with the dev extra:

uv sync --extra dev
uv run ruff check astrocyte/ tests/
uv run python -m pytest tests/ -x --tb=short

Git hooks (Ruff via pre-commit) — reduces CI lint failures. From the repository root (parent of astrocyte-py/):

uv sync --extra dev --directory astrocyte-py
uv run --project astrocyte-py pre-commit install

Hooks run automatically on git commit; run on all files anytime with:

uv run --project astrocyte-py pre-commit run --all-files

CodeQL is not run in pre-commit (too slow for every commit). Enable Code scanning under the repo’s Settings → Code security so GitHub runs CodeQL on pushes/PRs using the default or advanced setup.

Documentation

astrocyteai.github.io/astrocyte

License

Apache 2.0 — see LICENSE.

Metadata

Release files for astrocyte 0.17.0

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

Source distribution (sdist)

Source distribution for astrocyte 0.17.0
File Size Uploaded Provenance Actions
astrocyte-0.17.0.tar.gz 1.5 MB Without provenance Details for astrocyte-0.17.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for astrocyte 0.17.0
File Interpreter ABI Platform Actions
astrocyte-0.17.0-py3-none-any.whl Python 3 none any Details for astrocyte-0.17.0-py3-none-any.whl

Total release size: 2.2 MB

Release files / astrocyte-0.17.0.tar.gz

Download URL astrocyte-0.17.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
e02c6967b3f3399de3bc66bd671e214f7413bee592e62066563b18673362351c
BLAKE2b-256 checksum
How to use checksums
3c858c5da342d858e5069d0d4cae17ab13f93cfa1aba78ddd8dbb03022068bef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / astrocyte-0.17.0-py3-none-any.whl

Download URL astrocyte-0.17.0-py3-none-any.whl
Size 743.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
185c26eafcbcea45626218c95df24deee32eb3715350bad1fb3458f56f94c633
BLAKE2b-256 checksum
How to use checksums
36745fe913fd65e5e24800ac85941926db93890544d572a4423b7a06544b98d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Security for astrocyte 0.17.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.17.0 This release

2 release files No provenance

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