Octopus
Vector Store Backends
Octopus supports two production-grade vector store backends — Qdrant (recommended for high performance) and PGVector (for teams with an existing PostgreSQL stack). Both implement the ISemanticMemoryStore interface.
Qdrant (Recommended)
Qdrant is a purpose-built vector database with native HNSW indexing, payload filtering, and horizontal scaling. It is the recommended backend for production Octopus deployments with large knowledge bases.
// Qdrant configuration
{
"Octopus": {
"VectorStore": {
"Backend": "Qdrant",
"Qdrant": {
"Host": "qdrant-server",
"Port": 6333,
"ApiKey": null, // use ICredentialResolver if auth required
"CredentialId": 44, // optional — for Qdrant Cloud
"VectorSize": 1536, // must match embedding model dimensions
"Distance": "Cosine", // Cosine, Dot, Euclid
"ReplicationFactor": 2,
"WriteConsistencyFactor": 1
}
}
}
}
// QdrantVectorStore implementation
public class QdrantVectorStore : ISemanticMemoryStore
{
public async Task<IReadOnlyList<MemoryRecord>> SearchAsync(
string collection, float[] queryEmbedding, int topK, float minScore,
MemoryFilter? filter, CancellationToken ct)
{
var request = new SearchRequest
{
Vector = queryEmbedding,
Limit = (ulong)topK,
ScoreThreshold = minScore,
Filter = BuildQdrantFilter(filter), // tenant + agent filter
WithPayload = true
};
var results = await _qdrantClient.SearchAsync(collection, request, ct);
return results.Select(r => new MemoryRecord
{
Id = r.Id.ToString(),
Collection = collection,
Content = r.Payload["content"].StringValue,
Metadata = DeserializeMetadata(r.Payload)
}).ToList();
}
}
PGVector (PostgreSQL Extension)
PGVector adds vector similarity search to PostgreSQL. Use this backend if you already operate a PostgreSQL cluster and want to avoid a separate infrastructure component:
-- PGVector table (created by OctopusDbContext migration)
CREATE TABLE octopus_semantic_memory (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
collection VARCHAR(200) NOT NULL,
content TEXT NOT NULL,
embedding vector(1536), -- dimension must match embedding model
metadata JSONB NOT NULL,
tenant_id VARCHAR(100) NOT NULL,
agent_id UUID NOT NULL,
indexed_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX ON octopus_semantic_memory USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 100);
CREATE INDEX ON octopus_semantic_memory (collection, tenant_id, agent_id);
Backend Comparison
| Feature | Qdrant | PGVector |
|---|---|---|
| Index type | HNSW (fast approximate) | IVFFlat (slower exact) |
| Max vectors | Billions (with sharding) | ~10M practical limit |
| Payload filtering | Native, fast | SQL WHERE — slower at scale |
| Infrastructure | Separate service (Docker) | PostgreSQL extension |
| Managed cloud | Qdrant Cloud | Supabase, Neon, any PG host |
| Backup | Qdrant snapshots + S3 | Standard PostgreSQL backup |