This example demonstrates how to use VoltAgent with Qdrant as the vector database for retrieval-augmented generation (RAG).
- Two agents:
- Assistant with Retriever: Uses semantic search on every interaction.
- Assistant with Tools: LLM decides when to search autonomously.
- Tracks sources and references for each answer.
-
Install dependencies:
$ docker run -p 6333:6333 qdrant/qdrant $ pnpm install
-
Set up environment variables in
.env(see.env.examplefor reference):QDRANT_URLOPENAI_API_KEY(required for embeddings)
-
Start the example:
pnpm run dev
You can manage your vectors from the Qdrant dashboard.
Try asking questions like:
- What is VoltAgent?
- Tell me about vector databases
- How does Qdrant work?
- What is RAG?
- What is TypeScript?
- The retriever will automatically populate the Qdrant collection with sample documents if empty.
- Both agents track which documents were used for answers. Check
context.get('references')for source IDs and scores.