KnowledgeBase) is an agent’s external source of knowledge — a place to store static material such as product docs, FAQs, and articles. Attach it to an agent and VeADK automatically injects a retrieval tool, so the agent retrieves relevant snippets before answering and produces more accurate, better-grounded responses (RAG).
Unified entry point: KnowledgeBase
Regardless of the backend, everything goes through the unified veadk.knowledgebase.KnowledgeBase. It selects the storage backend through backend and exposes a consistent ingestion and retrieval interface. Ingestion supports three sources:
- From files:
kb.add_from_files([...]); - From a directory:
kb.add_from_directory("./docs"); - From text:
kb.add_from_text([...]).
Common parameters
The fields ofKnowledgeBase are common to all backends:
Vector backends (
local, opensearch, redis, tos_vector) embed the knowledge text and require the extensions dependency pip install "veadk-python[extensions]" plus an embedding model configured (env prefix MODEL_EMBEDDING_, falling back to MODEL_AGENT_API_KEY). viking and context_search are managed services that embed on the server side, so no local embedding is needed.Choosing a backend
Uselocal for debugging; for production prefer the managed viking or context_search. If you already run a vector store, choose opensearch, redis, or tos_vector.
Binding to an agent
Passknowledgebase to Agent and the agent automatically gains a load_knowledgebase tool, deciding on its own whether to search the knowledge base when answering.
Direct retrieval
Besides automatic retrieval at agent runtime, you can callsearch directly for semantic search, useful for debugging or custom RAG. A top_k of 0 uses the value set at construction.