Skip to main content
Store and retrieve text embeddings so your agent can recall relevant content instantly.
The user asks about indexed docs; the agent retrieves matching chunks from the vector store.

Quick Start

1

Agent with Knowledge

Give your agent a knowledge base — it automatically indexes and searches it for every question.
2

Choose a Persistent Backend

Switch to a database backend so knowledge survives restarts.
3

Direct Registry Usage

Access the in-memory store directly to add and query vectors.
get_vector_store_registry is not re-exported from the top-level package — use the full module path below.

Which Backend Should I Use?

qdrant, milvus, and pgvector are mem0 inner backends, not top-level Knowledge providers. To use them, set the Knowledge vector_store.provider to mem0 and nest the store under mem0’s own config. Setting them at the Knowledge top level raises ValueError. See Knowledge Backends → Supported Providers.


Registering the Chroma / Pinecone adapters

Importing praisonai.adapters.vector_stores no longer auto-registers ChromaVectorStore / PineconeVectorStore into the core SDK vector-store registry. If you want these adapters wired in — for example so KnowledgeConfig(vector_store={"provider": "chroma"}) picks up the wrapper’s Chroma implementation — call the explicit hook once:
This was previously a side effect of import praisonai.adapters.vector_stores. Removing it means the wrapper no longer mutates a core-SDK registry as an import side effect, and does not probe for chromadb / pinecone on disk unless the caller explicitly asks. The change is backward-compatible for callers that already use praisonaiagents.knowledge directly with their own VectorStoreProtocol implementations.

How It Works

A user question flows through the agent to the vector store, which finds the closest matching content using cosine similarity.

Configuration Options

Vector Store API Reference

Full API reference for VectorRecord, VectorStoreProtocol, VectorStoreRegistry, and InMemoryVectorStore

VectorRecord Fields

VectorStoreProtocol Methods


Common Patterns

Plug into an Agent’s Knowledge

Wire a registered custom store into an agent via KnowledgeConfig.
Set the embedder independently of the vector store via KnowledgeConfig(embedder=...) / embedder_config=.... See Knowledge → Use a non-OpenAI embedder.

Custom Backend: Minimum Viable Adapter

Any class with these five methods and a name attribute works as a drop-in backend.

Filter by Metadata

Narrow query results to records that match specific metadata fields.

Multi-Tenant Namespaces

Isolate data for different users or projects within the same store.

Delete Vectors

Remove specific records, filter-matched records, or all records in a namespace.
For ChromaVectorStore, before v4.6.162 delete_all=True always rebuilt the default namespace — silently dropping other tenants’ collections. Always pass an explicit namespace= so the delete is scoped to the tenant you intend.

Best Practices

InMemoryVectorStore (registered as "memory") is ideal for development, testing, and short-lived agents. It requires no external dependencies and resets on process restart. Switch to a persistent backend when you need data to survive restarts or to scale beyond a single process.
Upgrade when any of these apply: data must survive a process restart, multiple processes need the same store, you have more than ~100k vectors, you need filtered queries at scale, or you are running in a multi-user environment. Chroma and LanceDB are good first steps — they write to disk with no server required.
Use namespaces to isolate data by user, project, or run — "user:alice", "project:docs-v2", "run:abc123". A well-chosen namespace strategy lets you share a single store instance while keeping data strictly separated, and makes bulk deletion straightforward with delete_all=True.
InMemoryVectorStore ranks results by cosine similarity. Cosine similarity measures angle, not magnitude, so two vectors pointing in the same direction score 1.0 regardless of length. If your embedding model already normalises output vectors (most do), results will be reliable. If not, normalise manually before calling add and query to avoid misleading scores. Mismatched embedding lengths return score 0.0.
Three ChromaVectorStore behaviors changed in v4.6.162.Cosine on every namespace. Every namespace — the default and any ad-hoc one — is now created with {"hnsw:space": "cosine"}. Before the fix, ad-hoc namespaces defaulted to L2 and produced negative or incomparable scores. If a legacy collection still uses L2, the wrapper logs a one-time warning per collection so you know its scores are incomparable to cosine namespaces. No destructive auto-migration runs — recreate the collection to adopt cosine.query() returns stored embeddings. query() now returns each record’s stored embedding (via include=[..., "embeddings"]), not the query vector. Downstream MMR, re-rank, and hybrid-search consumers that read VectorRecord.embedding now get the correct value.delete_all=True is namespace-scoped. delete_all=True deletes and recreates the caller’s namespace. Before the fix it always rebuilt default, silently dropping other tenants’ collections — always pass an explicit namespace=.
Any object that satisfies VectorStoreProtocol can be registered. Implement the five methods (add, query, delete, count, get) and a name attribute, then call registry.register("my_backend", factory). The registry caches instances per name:namespace key, so the factory is called only once per combination. Failures during initialization are logged and return None rather than raising.

Knowledge Base

How agents load and search knowledge sources

Knowledge Backends

Choose Chroma, LanceDB, Pinecone, and other backends