Appearance
Vector Database Connectors
To persist agent conversation histories, perform similarity searches, and manage long-term contexts, elsai provides a unified vector store interface under elsai.integrations.vectordb.
The database clients can be registered directly onto your MemoryConfig similarity search setup.
Installation
Install the elsai-vectordb extra when using vector database clients with elsai-agents:
bash
pip install --extra-index-url https://elsai-agents.elsai.ai/root/ "elsai-agents[elsai-vectordb]==0.3.0"For similarity retrieval or semantic memory you also need embedding models — use the convenience bundle instead:
bash
pip install --extra-index-url https://elsai-agents.elsai.ai/root/ "elsai-agents[elsai-memory]==0.3.0"See Memory Overview — Installation for the full extra-to-feature map.
Vector Clients Factory
You can initialize a vector store using explicit configurations or system environment variables:
1. build_vectordb_client(config: VectorBackendConfig)
Initializes a client explicitly using configuration parameters.
python
from elsai.integrations.vectordb import VectorBackendConfig, build_vectordb_client
config = VectorBackendConfig(
provider="chroma",
collection_name="chat_logs",
persist_directory="./chroma_data",
)
db_client = build_vectordb_client(config)2. build_vectordb_client_from_env(provider=None)
Loads database credentials and index configuration directly from environment variables.
python
import os
from elsai.integrations.vectordb import build_vectordb_client_from_env
# Configure environment
os.environ["VECTOR_DB_PROVIDER"] = "chroma"
os.environ["CHROMA_PERSIST_DIRECTORY"] = "./chroma_data"
db_client = build_vectordb_client_from_env()Supported Vector Databases
Chroma DB
Chroma is a lightweight, local vector database ideal for development, testing, and embedded setups.
- Client configuration attributes (
VectorBackendConfig):provider:"chroma"collection_name: Name of the Chroma collection.persist_directory: Local filesystem directory path to save vector indexes. Defaults toCHROMA_PERSIST_DIRECTORYenv var.
Example
python
from elsai.integrations.vectordb import VectorBackendConfig, build_vectordb_client
chroma_client = build_vectordb_client(
VectorBackendConfig(
provider="chroma",
collection_name="agent_history",
persist_directory="./chroma_db",
)
)Pinecone
Pinecone is a fully managed cloud vector database suitable for large-scale production setups.
- Client configuration attributes (
VectorBackendConfig):provider:"pinecone"pinecone_api_key: Your Pinecone API key. Defaults toPINECONE_API_KEYenv var.index_name: Pinecone index name. Defaults toPINECONE_INDEX_NAMEenv var.namespace: Optional Pinecone query namespace. Defaults toPINECONE_NAMESPACEenv var.dimension: Vector dimensions size (e.g.1536for OpenAI). Defaults toPINECONE_DIMENSIONenv var.
Example
python
import os
from elsai.integrations.vectordb import VectorBackendConfig, build_vectordb_client
pinecone_client = build_vectordb_client(
VectorBackendConfig(
provider="pinecone",
pinecone_api_key=os.environ.get("PINECONE_API_KEY"),
index_name="my-global-index",
dimension=1536,
)
)Weaviate
Weaviate is an open-source vector database supporting both self-hosted local hosts and cloud-hosted instances.
- Client configuration attributes (
VectorBackendConfig):provider:"weaviate"collection_name: Collection (or Class) name.connection_type:"local"(for self-hosted hosts) or"cloud"(for cloud instances).host/port: Host and port details (local connection).cluster_url: Cloud endpoint URL (cloud connection).auth_credentials: Authentication keys (cloud connection).use_default_vectorizer: Set toTrueif using Weaviate's native embedding module. Default:False.
Example (Local Weaviate)
python
from elsai.integrations.vectordb import VectorBackendConfig, build_vectordb_client
weaviate_client = build_vectordb_client(
VectorBackendConfig(
provider="weaviate",
collection_name="AgentMemory",
connection_type="local",
host="localhost",
port=8080,
)
)