Quick Start
Agent with Knowledge
Give your agent a knowledge base — it automatically indexes and searches it for every question.
Which Backend Should I Use?
Registering the Chroma / Pinecone adapters
Importingpraisonai.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 InMemoryVectorStoreVectorRecord Fields
| Field | Type | Default | Description |
|---|---|---|---|
id | str | — | Unique identifier |
text | str | — | Text content |
embedding | List[float] | — | Vector embedding |
metadata | Dict[str, Any] | {} | Optional metadata |
score | Optional[float] | None | Similarity score (set on query results) |
VectorStoreProtocol Methods
| Method | Description |
|---|---|
add(texts, embeddings, metadatas, ids, namespace) | Add vectors; returns list of IDs |
query(embedding, top_k, namespace, filter) | Find similar vectors; returns List[VectorRecord] |
delete(ids, namespace, filter, delete_all) | Remove vectors; returns count deleted |
count(namespace) | Number of stored vectors |
get(ids, namespace) | Retrieve vectors by ID |
Common Patterns
Plug into an Agent’s Knowledge
Wire a registered custom store into an agent viaKnowledgeConfig.
Custom Backend: Minimum Viable Adapter
Any class with these five methods and aname 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.Best Practices
When to use the in-memory store
When to use the in-memory store
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.When to upgrade from memory to a persistent backend
When to upgrade from memory to a persistent backend
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.
Namespace strategy
Namespace strategy
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.Cosine similarity and vector normalisation
Cosine similarity and vector normalisation
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.Registering custom backends
Registering custom backends
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.Related
Knowledge Base
How agents load and search knowledge sources
Knowledge Backends
Choose Chroma, LanceDB, Pinecone, and other backends

