Skip to main content
The local backend stores knowledge in an in-memory vector index from LlamaIndex. Knowledge text is embedded by an embedding model, written to an in-process vector index, and retrieved by similarity. It requires no external database but does require an embedding service, is the default backend for KnowledgeBase, and is ideal for local debugging and quick validation.
Data lives only in process memory and is lost when the program exits. Use a persistent backend in production.

When to use

  • Local debugging, teaching, or quickly validating a RAG flow;
  • No external vector store required — only an embedding model.

Dependencies

Usage

Before running, configure MODEL_EMBEDDING_NAME, MODEL_EMBEDDING_DIM, MODEL_EMBEDDING_API_BASE, and MODEL_EMBEDDING_API_KEY. The extensions extra includes llama-index, embedding adapters, and vector-store connectors. Text is sent to the configured embedding service. For BytePlus or another provider, explicitly set the matching endpoint, model, and credentials; the default Ark endpoint does not automatically switch
You can also pass embedding config explicitly via backend_config:

Parameters

KnowledgeBase parameters

Constructor parameters

backend_config supports the following settings:

Embedding config

embedding_config is an EmbeddingModelConfig with env prefix MODEL_EMBEDDING_:

Environment variables

The local backend depends only on an embedding model and requires no database connection config. Text is automatically split into chunks by file type before embedding.
The example search should return the annual-leave policy. For empty results, check successful ingestion, matching embedding dimensions, completed server processing, network access, and permissions. Managed ingestion may not be immediately searchable. Running the configured Agent also requires model credentials
Last modified on September 19, 2026