inmemory.Store loses all history on restart and returns every message regardless of size. The Qdrant adapter gives you:
- Persistence — history survives process restarts.
- Semantic retrieval —
Getreturns the most recent turns;Searchfinds the most relevant turns for a query. - Scale — only the top-K messages enter the context window, so sessions can grow indefinitely.
core.MemoryStore interface. The agent loop, orchestrator, and providers need zero changes.
Installation
github.com/qdrant/go-client) is pulled in automatically.
Quick constructors
Two one-call constructors handle the most common configurations:...Option arguments (e.g. WithCollectionName, WithTopK) applied after the defaults.
Quick start
Qdrant setup
- Docker (local)
- Qdrant Cloud
Embedders
OpenAI (text-embedding-3-small, 1536 dims)
Ollama (no new dependencies)
Get vs Search
| Method | What it returns | When to use |
|---|---|---|
Get(ctx, sessionID) | Most recent TopK messages, ordered oldest→newest | Default agent loop — feed the LLM a recent window |
Search(ctx, sessionID, query, topK) | Most semantically similar messages to query | Explicit retrieval (e.g. “find what the user said about X”) |
Get uses a Qdrant scroll ordered by sequence_num DESC — no embedding call needed.
Search is only available on the concrete *Store type (not on core.MemoryStore):
Configuration reference
| Option | Default | Description |
|---|---|---|
WithURL(rawURL) | "localhost:6334" | Parse host, port, and TLS from a URL string |
WithHost(host, port) | — | Set host and port directly |
WithAPIKey(key) | — | Qdrant Cloud API key |
WithCollectionName(name) | "chainforge_memory" | Qdrant collection name |
WithTopK(k) | 20 | Max messages returned by Get |
WithEmbedder(e) | — | Required. Embedding backend |
WithTLS(enabled) | auto-detected from URL | Force TLS on/off |
Clearing a session
Custom embedder
Implement the two-method interface to use any embedding API:WithEmbedder(myEmbedder).
Full example
Seeexamples/qdrant-memory-agent/ for a runnable interactive agent that persists memory across restarts.