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
Document storeBM25 full-text / keyword searchelasticsearchWhen you need keyword recall alongside semantic

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. Stores embeddings in PostgreSQL with the pgvector extension.

Terminal window
pip install astrocyte-pgvector
# or from source:
cd adapters-storage-py/astrocyte-pgvector && pip install -e .
Terminal window
# Docker (quickest)
docker run -d --name astrocyte-pg \
-e POSTGRES_USER=astrocyte \
-e POSTGRES_PASSWORD=astrocyte \
-e POSTGRES_DB=astrocyte \
-p 5433:5432 \
pgvector/pgvector:pg16

Or use the included Docker Compose stack:

Terminal window
cd astrocyte-services-py
cp .env.example .env
docker compose up -d postgres
provider_tier: storage
vector_store: pgvector
vector_store_config:
dsn: ${DATABASE_URL}
embedding_dimensions: 1536 # must match your embedding model
bootstrap_schema: true # auto-create tables (dev)
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'
cd adapters-storage-py/astrocyte-pgvector
./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

Requires: psql client on PATH, PostgreSQL 15+.

  • 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: pgvector
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-pgvectorastrocyte-qdrantastrocyte-neo4jastrocyte-elasticsearch
Config keyvector_store: pgvectorvector_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