Portal Community

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

FeatureQdrantPGVector
Index typeHNSW (fast approximate)IVFFlat (slower exact)
Max vectorsBillions (with sharding)~10M practical limit
Payload filteringNative, fastSQL WHERE — slower at scale
InfrastructureSeparate service (Docker)PostgreSQL extension
Managed cloudQdrant CloudSupabase, Neon, any PG host
BackupQdrant snapshots + S3Standard PostgreSQL backup