Skip to content

Storage backend setup

How to install, configure, and run each Astrocyte storage adapter. All adapters are optional PyPI packages that register via Python entry points — install the one you need, set the config key, and Astrocyte picks it up automatically.


Store typeRoleAdaptersWhen to use
Vector storeSemantic search (embeddings)pgvector, qdrantAlways — required for Tier 1 recall
Graph storeEntity relationships and traversalneo4jWhen you need “who knows whom” or relationship-aware recall beyond the built-in flat-table graph
Document storeBM25 full-text / keyword searchelasticsearchWhen you need keyword recall alongside semantic

Built-in graph traversal: section-level graph traversal (entity bridging, causal links, semantic kNN links) runs over flat SQL tables (section_links, section_entities) inside astrocyte-postgres with no additional adapter. A GraphStore adapter (Neo4j) is only needed for cross-bank relationship queries and explicit graph_search() / graph_neighbors() API calls.

You can combine stores for hybrid recall — e.g. pgvector (semantic) + Neo4j (graph) + Elasticsearch (keyword). Results are fused with reciprocal rank fusion (RRF).

For quick prototyping, use the built-in in-memory store (no install required):

provider_tier: storage
vector_store: in_memory
llm_provider: mock

No persistence — data is lost on restart.


Recommended default for production. One PostgreSQL instance provides:

  • Durable memory rows, lifecycle columns, banks, and access grants.
  • Dense retrieval through pgvector.
  • Durable wiki pages, revisions, source provenance, links, and lint state through the WikiStore.
  • Graph traversal via flat SQL tables (section_links, section_entities) — no extension required; entity bridging, causal links, and semantic kNN links all run as plain SQL CTEs.
  • Durable background work through PgQueuer.
Terminal window
pip install astrocyte-postgres
# or from source:
cd adapters-storage-py/astrocyte-postgres && pip install -e .
Terminal window
# Docker Compose (quickest full stack)
cd astrocyte-services-py
cp .env.example .env
docker compose up --build

The Compose stack uses the repository’s combined Postgres image with pgvector. For production-shaped local runs with migrations applied first, use ./scripts/runbook-up.sh from astrocyte-services-py/.

provider_tier: storage
vector_store: postgres
wiki_store: postgres
llm_provider: mock
vector_store_config:
dsn: ${DATABASE_URL}
embedding_dimensions: 1536 # must match your embedding model
bootstrap_schema: true # auto-create tables (dev)
wiki_store_config:
dsn: ${DATABASE_URL}
bootstrap_schema: true
wiki_compile:
enabled: true
auto_start: true
entity_resolution:
enabled: true
async_tasks:
enabled: true
backend: pgqueuer
dsn: ${DATABASE_URL}
install_on_start: true
auto_start_worker: true

To add Neo4j for cross-bank relationship queries, add:

graph_store: neo4j
graph_store_config:
uri: bolt://localhost:7687
user: neo4j
password: ${NEO4J_PASSWORD}
KeyTypeDefaultDescription
dsnstringrequiredPostgreSQL connection URI
table_namestringastrocyte_vectorsTable name
embedding_dimensionsint128Vector width — must match your embedding model output
bootstrap_schemabooltrueAuto-create extension, table, and indexes on first use

Connection string format:

postgresql://user:password@host:port/database
postgresql://astrocyte:astrocyte@127.0.0.1:5433/astrocyte
postgresql://user:pass@host:5432/db?sslmode=require

For production, disable bootstrap_schema and run migrations explicitly:

Terminal window
export DATABASE_URL='postgresql://astrocyte:astrocyte@127.0.0.1:5433/astrocyte'
export ASTROCYTE_EMBEDDING_DIMENSIONS=1536 # match your embedding model
cd adapters-storage-py/astrocyte-postgres
./scripts/migrate.sh
vector_store_config:
dsn: ${DATABASE_URL}
embedding_dimensions: 1536
bootstrap_schema: false # migrations already applied

Migrations are plain SQL in migrations/:

FileWhat it does
001_extension.sqlInstall pgvector extension
002_astrocytes_vectors.sqlCreate vectors table
003_indexes.sqlB-tree on bank_id, HNSW on embeddings
004_memory_layer.sqlAdd memory layer column
005_banks_access.sqlAdd bank metadata and access grants
006_lifecycle_indexes.sqlAdd retained_at / forgotten_at lifecycle columns and time indexes
007_wiki_tables.sqlAdd durable wiki pages, revisions, provenance, links, and lint issues
008_entities_temporal.sqlAdd canonical entity/link tables and normalized temporal facts

Requires: psql client on PATH, PostgreSQL 15+.

migrate.sh defaults to vector(128). Set ASTROCYTE_EMBEDDING_DIMENSIONS=1536 for OpenAI text-embedding-3-small, or another positive integer matching your embedding provider.

  • Set bootstrap_schema: false and run migrate.sh before deploying
  • Match embedding_dimensions to your embedding model (OpenAI text-embedding-3-small = 1536)
  • Use ?sslmode=require in DSN for remote databases
  • Store DSN in env var or secrets manager, not in YAML

Cloud-native vector database with built-in collection management.

Terminal window
pip install astrocyte-qdrant
# or from source:
cd adapters-storage-py/astrocyte-qdrant && pip install -e .
Terminal window
docker run -d --name astrocyte-qdrant \
-p 6333:6333 \
qdrant/qdrant:v1.17.0
provider_tier: storage
vector_store: qdrant
vector_store_config:
url: http://localhost:6333
collection_name: astrocyte_mem
vector_size: 1536 # must match your embedding model
KeyTypeDefaultDescription
urlstringrequiredQdrant HTTP API URL
collection_namestringrequiredCollection name
vector_sizeintrequiredEmbedding dimension
api_keystringnullAPI key for authentication
timeoutfloat30.0Request timeout in seconds

Collections are created automatically on first use with cosine distance.

vector_store: qdrant
vector_store_config:
url: https://your-cluster.cloud.qdrant.io
collection_name: astrocyte_mem
vector_size: 1536
api_key: ${QDRANT_API_KEY}
  • Match vector_size to your embedding model
  • Use api_key if Qdrant is network-accessible
  • Monitor collection size and memory usage

Graph database for entity relationships and neighborhood-aware recall.

Terminal window
pip install astrocyte-neo4j
# or from source:
cd adapters-storage-py/astrocyte-neo4j && pip install -e .
Terminal window
docker run -d --name astrocyte-neo4j \
-p 7687:7687 -p 7474:7474 \
-e NEO4J_AUTH=neo4j/your-password \
neo4j:5

Web browser: http://localhost:7474

graph_store: neo4j
graph_store_config:
uri: bolt://localhost:7687
user: neo4j
password: ${NEO4J_PASSWORD}
database: neo4j
KeyTypeDefaultDescription
uristringrequiredBolt URI (bolt://host:port)
userstringrequiredNeo4j username
passwordstringrequiredNeo4j password
databasestringneo4jDatabase name

Astrocyte stores entities and relationships isolated by bank:

  • Nodes: AstrocyteEntity with properties entity_id, bank, name, entity_type, aliases
  • Relationships: ENTITY_LINK with link_type and metadata
  • Use Neo4j 5+ for best compatibility
  • Store credentials in env vars or secrets manager
  • Monitor transaction throughput and heap usage
  • Consider Neo4j Aura (managed) for production

BM25 full-text search for keyword-based recall. Complements vector search for hybrid retrieval.

Terminal window
pip install astrocyte-elasticsearch
# or from source:
cd adapters-storage-py/astrocyte-elasticsearch && pip install -e .
Terminal window
docker run -d --name astrocyte-es \
-p 9200:9200 \
-e discovery.type=single-node \
-e xpack.security.enabled=false \
-e ES_JAVA_OPTS="-Xms512m -Xmx512m" \
docker.elastic.co/elasticsearch/elasticsearch:8.15.3
document_store: elasticsearch
document_store_config:
url: http://localhost:9200
index_prefix: astrocyte_docs
KeyTypeDefaultDescription
urlstringrequiredElasticsearch HTTP URL
index_prefixstringastrocyte_docsIndex name prefix — one index per bank ({prefix}_{bank_id})

Indexes are created automatically on first use.

document_store: elasticsearch
document_store_config:
url: https://user:password@your-cluster.es.cloud.elastic.co:9243
index_prefix: astrocyte_docs
  • Use Elasticsearch 8.12+ with security enabled (xpack.security)
  • Configure index lifecycle management (ILM) for old indices
  • Size heap appropriately (50% of available RAM, max 32 GB)
  • Monitor disk usage — especially for high-volume ingestion

Combine vector, graph, and document stores for richer retrieval. Results are fused with reciprocal rank fusion (RRF).

provider_tier: storage
# Semantic search
vector_store: postgres
vector_store_config:
dsn: ${DATABASE_URL}
embedding_dimensions: 1536
bootstrap_schema: false
# Entity relationships
graph_store: neo4j
graph_store_config:
uri: bolt://localhost:7687
user: neo4j
password: ${NEO4J_PASSWORD}
# Keyword / full-text search
document_store: elasticsearch
document_store_config:
url: http://localhost:9200
# LLM for embedding + reflect
llm_provider: openai
llm_provider_config:
api_key: ${OPENAI_API_KEY}
model: gpt-4o-mini

Recall automatically queries all configured stores and fuses results. No additional configuration needed — just install the adapter packages and add the config sections.


pgvectorQdrantNeo4jElasticsearch
Store typeVectorVectorGraphDocument
SearchSemantic (HNSW)Semantic (HNSW)Neighborhood traversalBM25 keyword
Managed optionsAny managed PostgresQdrant CloudNeo4j AuraElastic Cloud
Best forDefault choice; existing PostgresDedicated vector DB; large scaleRelationship-heavy domainsKeyword recall alongside semantic
PersistenceSQL (full ACID)On-disk snapshotsOn-diskLucene segments
Python packageastrocyte-postgresastrocyte-qdrantastrocyte-neo4jastrocyte-elasticsearch
Config keyvector_store: postgresvector_store: qdrantgraph_store: neo4jdocument_store: elasticsearch

Start all backends for local development:

Terminal window
# pgvector
docker run -d --name pg -p 5433:5432 \
-e POSTGRES_USER=astrocyte -e POSTGRES_PASSWORD=astrocyte -e POSTGRES_DB=astrocyte \
pgvector/pgvector:pg16
# Qdrant
docker run -d --name qdrant -p 6333:6333 qdrant/qdrant:v1.17.0
# Neo4j
docker run -d --name neo4j -p 7687:7687 -p 7474:7474 \
-e NEO4J_AUTH=neo4j/testpass neo4j:5
# Elasticsearch
docker run -d --name es -p 9200:9200 \
-e discovery.type=single-node -e xpack.security.enabled=false \
-e ES_JAVA_OPTS="-Xms512m -Xmx512m" \
docker.elastic.co/elasticsearch/elasticsearch:8.15.3