MMOOZZGG.com

How to build an AI agent

Vector database for AI agents in plain words

6 min read11 sources

A vector database for AI agents stores pieces of your documents together with a record of their meaning and, for a question, finds the pieces closest in meaning. Below: 4 open databases you can install on your own server, the order of filling and updating, and access rights to the pieces.

On this page · 4 sections

Build it yourself in a week

Why a vector database

A vector database stores document pieces together with embeddings, a record of their meaning as a set of numbers. When a question comes in, the database finds pieces with a close meaning, even if the question uses different words.

RAG rests on this: before answering, the model searches the document base for pieces and answers from them. This is how the agent works with your documents without training the model. The setup is shown step by step on the page on how to build RAG.

How many pieces the database gives the model per question is set by the top K parameter, 4 by default in Flowise. A smaller value gives fewer but more precise pieces, and a larger one covers more.

The size of the vectors is set by the embedding model, and the database index must match it. The more dimensions, the more resources storage and comparison take: the Flowise documentation lists models with 768 and 3,072 dimensions.

You do not always need a separate database. If there is little reference data and it fits into the instruction, an agent without RAG is enough.

Open options

Below are open databases you can install on your own server. The licenses are free; you pay for the server and for the time of the person who maintains the database.

pgvector is an extension for PostgreSQL. Vectors sit next to the rest of the company’s data, and the usual Postgres features work with them: transactions, point-in-time recovery, table joins. The extension has the same license as PostgreSQL.

By default pgvector searches exactly and finds all the nearest pieces. For speed there are HNSW and IVFFlat indexes, which work for the vector type up to 2,000 dimensions. For large volumes the documentation advises compressing vectors through quantization.

Qdrant is a separate vector database written in Rust under the Apache 2.0 license. Each vector is stored with a payload, a set of fields such as department or date, and search can filter by these fields.

Chroma installs in Python with the command pip install chromadb, under the Apache 2.0 license. Pieces get metadata, such as their source, and search filters by it.

Milvus is built for large volumes. According to its developers, the distributed version handles tens of thousands of search requests over billions of vectors. The project is part of the LF AI & Data Foundation under the Apache 2.0 license, with a Standalone mode for one machine and the lightweight Milvus Lite for trying it in Python.

How many documents a database can hold depends not only on its name but also on the server and the index. It makes sense to start with a database your team can maintain: if you already have Postgres, that is pgvector.

How to fill and update it

A database is filled by one scheme: load the documents, cut them into pieces, compute the embeddings and write them to the database. In Flowise this is done in the “Document Stores” section without code.

1. Add a store and choose a loader for the file format, such as “PDF Loader”.

2. Give the set its own metadata label, such as the department name. You will use it later to select the pieces of this set, even if other documents sit in the same database.

3. Choose the splitting, the embedding model in the “Select Embeddings” card and the database in the “Select Vector Store” card.

4. Add a “Record Manager” and click “Upsert” to write the pieces to the database.

The Record Manager solves the main problem of updates: duplicates. It computes a SHA-1 fingerprint of each piece and skips those already in the database.

Choose the cleanup mode to match how you update. Incremental deletes old versions of changed documents and leaves the rest. Full deletes everything not in the current upload, and None deletes nothing.

For regular updates Flowise has an API: uploading new files and rebuilding the store can run on a schedule. Name a person responsible for the database: the agent will quote an outdated price list as confidently as a current one.

Access rights to pieces

One database often holds documents of different departments and clients. If the agent searches the whole database, it may show a sales manager a piece of an HR order.

OWASP, the international application security community, put vector database weaknesses on its 2025 list of top risks for AI applications as LLM08. They include access to pieces with sensitive data without rights and leaks between users of a shared database. OWASP advises controlling access at the storage level and separating data logically.

In Qdrant the recommended way is one collection with a group_id field on each vector and a filter by this field in every request. The documentation calls a separate collection for each group rarely justified and advises it only for a few groups that need strict isolation.

In PostgreSQL with pgvector, row security policies (Row-Level Security) do the job: the database itself decides which rows a user sees. If row security is on but no policy is set, a regular user sees no rows at all. The table owner is usually not subject to these rules.

The program sets the filter, not the model. Rights come from the user’s account and go into the database request before the pieces reach the model.

If the pieces contain customers’ personal data, 152-FZ, Russia’s personal data law, applies: databases with such data are located in Russia, and before data goes abroad the operator notifies Roskomnadzor, the Russian data protection regulator. A vector database with such pieces is installed on your server; more on the page on data security.

Sources and fact-checking

Checked by the editors on 16 October 2026.

  1. arXiv 2005.11401, 22 May 2020 (arxiv.org)
  2. Brace Law Firm, 9 July 2023 (brace-lf.com)
  3. Flowise Docs, 2026 (docs.flowiseai.com)
  4. GitHub, pgvector/pgvector, 2026 (github.com)
  5. GitHub, qdrant/qdrant, 2026 (github.com)
  6. GitHub, chroma-core/chroma, 2026 (github.com)
  7. GitHub, milvus-io/milvus, 2026 (github.com)
  8. Flowise Docs, 2026 (docs.flowiseai.com)
  9. Qdrant Docs, 2026 (qdrant.tech)
  10. PostgreSQL Documentation, 2026 (postgresql.org)
  11. OWASP GenAI Security Project, 2025 (genai.owasp.org)

Found a mistake? Tell us

Publications

Contact us