RAG chatbot example
This walkthrough runs vector memory retrieval in a single-agent workflow. You configure hybrid dense and sparse retrieval, run a query, and confirm MemoryRetrieved events in the trace. The primary script is RAG chatbot walkthrough.
What this example demonstrates
ArcFlow vector memory attaches to an agent via MemoryConfig. Chunking, embedding model selection, and hybrid retrieval weights live in workflow configuration. The sample uses stub embeddings for local runs; production swaps to real embedding providers and Qdrant.
A domain-heavy variant lives at RAG chatbot walkthrough for support-ticket Q&A patterns.
Prerequisites
| Item | Required for stub path | Required for full RAG |
|---|---|---|
| Python SDK | Yes | Yes |
ARCFLOW_QDRANT_URL | No | Yes (e.g. http://localhost:6333) |
| Embedding provider env | No (uses stub/8) | Yes per provider configuration |
| Docker Qdrant | No | Recommended via dev compose |
| Tutorial track | Track C | Same |
Step 1: Review memory configuration
From RAG chatbot walkthrough:
Step 2: Run with stub embeddings
Stub mode exercises the workflow and trace path without Qdrant. Output includes a reminder to ingest documents when Qdrant is configured.
Step 3: Run with Qdrant (optional full path)
Start Qdrant (dev stack or standalone), then export:
Ingest the sample document in the script (SAMPLE_DOC) through vector ingest APIs or dashboard knowledge upload before expecting grounded answers. See vector RAG pipeline and knowledge ingestion.
Step 4: Verify trace events
After run(), inspect events:
With populated vector store and matching namespace, expect MemoryRetrieved with chunk counts and scores (metadata only, no chunk text in trace export).
Expected output
Stub run prints stub answer text plus:
(Ingest SAMPLE_DOC via vector APIs when Qdrant is configured.)
Full RAG run prints an answer grounded on ingested content. Pass criteria: non-empty result.output, status == "completed", and MemoryRetrieved when the store contains matching namespace data.
Trace events you should see
| Event kind | When |
|---|---|
WorkflowStarted | Run begins |
MemoryRetrieved | Vector query returns chunks (when store populated) |
StepCompleted | Agent step finishes |
WorkflowCompleted | Success |
Optional: MemoryIngested during separate ingest operations, not during query-only runs.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
No MemoryRetrieved events | Empty namespace or stub-only run without ingest | Ingest documents into doc_qa namespace or accept stub-only lifecycle events |
| Qdrant connection errors | Wrong URL or service down | Verify ARCFLOW_QDRANT_URL and container health |
| Generic answers despite ingest | Namespace mismatch | Align MemoryConfig.namespace with ingest key |
WorkflowConfigurationError on memory | Invalid retrieval weights | Ensure dense and sparse weights sum reasonably; see guide |
Related
| Resource | Link |
|---|---|
| Tutorial track | Track C |
| Static landing-page RAG | static-chat-widget.md |
| Hybrid retrieval guide | hybrid retrieval and reranking |