Skip to content

Is it for me? ​

Is duckdb-vectors adapted to your use case? This page gathers the fit decision, the reasons behind the package, and the alternatives, so that you can decide in a few minutes. If the answer is yes, go on with the five-minute quickstart.

When does in-process semantic search fit? ​

Most agents are specialists, not oracles. The honest requirement is small: semantic search over a modest, mostly-static corpus. Yet the reflex answer is large: stand up a vector database, run it as a service, wire the agent to it over the network. For a few thousand documents, that is a lot of moving parts to own, pay for, and keep alive.

Two ways to add semantic search to an agent: the usual external vector database with a network round trip, versus a DuckDB file baked into the agent's own container.

For the common case, you can skip the external vector database entirely. Index the corpus into a single DuckDB file, bake that file into the agent's container image, and answer semantic queries with a local function call in milliseconds. No MCP, no network round trip.

In-process semantic search fits when the corpus is in the thousands of items, mostly static, and travels with a single agent, and when a local function call beating a network round trip matters more than elastic write throughput. It does not replace a managed vector database for large multi-tenant corpora, high-churn write workloads, or sustained high-concurrency serving. Naming the boundary is part of the pitch: the smaller scope is exactly what buys the simplicity.

The mismatch is easiest to see side by side:

FacetSeparate vector databaseduckdb-vectors
Corpus sizemillions of vectors, shardeda few thousand items, in one file
Write patternhigh-churn, live updatesread-mostly, re-indexed on build
Deploymenta separate service to runa file baked into the agent image
Query pathMCP or network round triplocal call, in-process execution
Concurrencyscalable back-end servicescale-out by design
You operatedeploy, secure, monitor, paypip install and Dockerfile

Pick the left column when you genuinely have that scale. For the right column, the left column is machinery you do not need.

When is a network vector database the better fit? ​

When the corpus outgrows what an exact scan serves well, far beyond the hundred-thousand-chunk range measured in the performance workbook. Below that, a hosted vector database pays a network round trip on every query, while in-process retrieval answers in about 26 ms at 1,000 chunks and about 105 ms at 100,000, with no hop at all. The sweet spot is thousands to tens of thousands of chunks, integrated directly into the agent. The figures and their method are in the performance workbook. For where "a few thousand items" actually tops out, see How does query time grow with the corpus?.

Why? ​

You are right, trillions of solutions exist for semantic search. So, why bother?

Because we are frugal.

  • We won't embrace a fat framework, but limit our code base and dependencies to the strict minimum. We just want to install and import a dedicated PyPI package that does one thing well.
  • We won't delegate via the network a search across some thousands of items. A local function call is by far the fastest path to relevant answers. DuckDB is a perfect fit for such in-process use case. See src/skill-registry/skill_registry.py.
  • We won't use stemming search at all. Semantic search for sentences and exact matches for keywords cover our needs.
  • We won't externalize a read-only vector database or knowledge store for some thousands of items. This should be baked into the file system of the agent itself. DuckDB just needs a single database file, this is just what we need.
  • We won't introduce separate baking for the code and for data, since modern agents rely on Docker images anyway. See fixtures/docker-template/Dockerfile.
  • We won't invest on non-differentiating features. Trusted harnessing will come from boring technologies.

We did our homework, as reflected in the alternatives. It appears, in the end, that no python package was available to cover our frugal needs.

Alternatives ​

duckdb-vectors is not the only way to put vectors in DuckDB. The projects below overlap with it; each is a reasonable choice if its shape fits your need better than ours. Our goal is narrow on purpose: a small, framework-agnostic, read-mostly utility that bakes an index into a container image and answers in tens of milliseconds, with pluggable embedding and chunking and an S3-Vectors-flavored surface. Where a project pulls in a framework, a service, or a broader scope, we point you to it rather than compete with it.

  • llama-index-vector-stores-duckdb — the official LlamaIndex integration that stores embeddings in DuckDB. Great if you are already building on LlamaIndex, because it plugs into that data model, retrievers, and query engines. We stay framework-agnostic: no LlamaIndex Node/Document types to adopt and no framework runtime to carry into the container.
  • vectorwrap — a universal wrapper that switches one vector API across Postgres, MySQL, SQLite, DuckDB, and ClickHouse. Pick it when backend portability is the point. We go the opposite way: one backend (DuckDB), chosen deliberately, so we can lean on DuckDB-specific features (ARRAY columns, injectable ranking SQL) instead of a lowest-common-denominator API. It also expects you to bring your own embedding function; we ship pluggable embedders and markdown chunking.
  • microrag — the closest neighbour: a universal RAG library with ONNX-backed embeddings and DuckDB storage. If you want an end-to-end RAG library, it is a strong fit. We are not a RAG library. We deliberately stop at retrieval (store, index, search) and leave generation, prompting, and LLM orchestration to the harness, so the component composes into any framework rather than owning the pipeline.
  • Docker Agent RAG toolset — the built-in rag toolset of Docker Agent (cagent): declare a knowledge base under rag: in the agent config and any agent searches your documents before answering, no separate retrieval package. Reach for it when Docker Agent is already your harness and you want retrieval wired in-runtime. We stay harness-agnostic: duckdb-vectors is a standalone library you call from any framework (or from Docker Agent itself via duckdb-vectors mcp, see the Docker Agent guide), so the index and the retrieval surface are not tied to one agent runtime.
  • duckdb ai community extension — an extension that calls embedding and chat providers from inside SQL. Reach for it when you want embeddings generated in the database and don't mind the provider wiring living in SQL. We keep embedding in Python so the same code runs offline in CI and against a cloud provider in production without SQL-level credentials.
  • sqlrooms-rag — prepares and queries DuckDB-stored embeddings for RAG, primarily for the SQLRooms framework (usable standalone too). A good fit inside that ecosystem; outside it, our standalone, dependency-light surface and container lifecycle are a closer match.
  • raghilda — a DuckDB-backed RAG store (from Posit) that can run fully in memory and search with BM25 when no embedding model is configured. Pleasant for quick local experiments. Our focus is the frozen, read-only, image-baked serving path and an S3-Vectors-flavored API rather than an in-memory exploration store.
  • dvs — a DuckDB + OpenAI vector similarity search service. Choose it if an OpenAI-tied service is what you want. We default to local, offline embeddings and treat cloud providers as an opt-in, keeping the base install slim and CI-friendly.

Next steps ​