RAG agent
A flow diagram. An agent loop between the LLM, a retriever over a vector database, and a tool runner.






╭──────╮
│ User │
╰──────╯
│
│ question
│
┌─ Index Time ───────┐ ┌─ Query Time ───────────┼───────────────────────────┐
│ │ │ │ │
│ ┌──────────────┐ │ │ │ │
│ │ Docs / Wiki │ │ │ ▼ │
│ └──────────────┘ │ │ ┌────────────┐ │
│ │ │ │ │ Agent Loop │ │
│ │ │ │ └────────────┘ │
│ ▼ │ │ prompt + context ▲ │ │ tool calls │
│ ┌──────────┐ │ │ │ │ │ │
│ │ Chunker │ │ │ ┌─────────────┘ ┌─┘ └──────────────┐ │
│ └──────────┘ │ │ ▼ ▼ search ▼ │
│ │ │ │ ┌──────┐ ┌────────────┐ ┌──────────────┐ │
│ │ │ │ │ LLM │ │ Retriever │ │ Tool Runner │ │
│ ▼ │ │ └──────┘ └────────────┘ └──────────────┘ │
│ ┌──────────┐ │ │ │ ╎ │
│ │ Embedder │ │ │ │ ╎ │
│ └──────────┘ │ │ │ kNN ╎ │
└──────────┼─────────┘ └──────────────────────┼───────────────────┼─────────┘
│ upsert │ ╎
│ │ ╎
└────────────────┐ ┌────────────────┘ ╎
▼ ▼ ▼
╒════════════╕ ╭──────────╮
│ Vector DB │ │ Web APIs │
└────────────┘ ╰──────────╯
Spec
{ "type": "flow", "direction": "DOWN", "nodes": [ {"id": "user", "label": "User", "shape": "rounded"}, {"id": "agent", "label": "Agent Loop", "color": "blue"}, {"id": "llm", "label": "LLM", "shape": "hexagon", "color": "purple"}, {"id": "retriever", "label": "Retriever"}, {"id": "vectordb", "label": "Vector DB", "shape": "cylinder", "color": "green"}, {"id": "tools", "label": "Tool Runner"}, {"id": "web", "label": "Web APIs", "shape": "rounded", "color": "gray"}, {"id": "docs", "label": "Docs / Wiki", "shape": "parallelogram"}, {"id": "chunker", "label": "Chunker"}, {"id": "embedder", "label": "Embedder"} ], "edges": [ {"id": "e-user-agent", "from": "user", "to": "agent", "label": "question"}, { "id": "e-agent-llm", "from": "agent", "to": "llm", "label": "prompt + context", "direction": "both" }, {"id": "e-agent-retriever", "from": "agent", "to": "retriever", "label": "search"}, {"id": "e-retriever-vectordb", "from": "retriever", "to": "vectordb", "label": "kNN"}, {"id": "e-agent-tools", "from": "agent", "to": "tools", "label": "tool calls"}, {"id": "e-tools-web", "from": "tools", "to": "web", "style": "dashed"}, {"id": "e-docs-chunker", "from": "docs", "to": "chunker"}, {"id": "e-chunker-embedder", "from": "chunker", "to": "embedder"}, {"id": "e-embedder-vectordb", "from": "embedder", "to": "vectordb", "label": "upsert"} ], "groups": [ {"id": "runtime", "label": "Query Time", "contains": ["agent", "llm", "retriever", "tools"]}, {"id": "indexing", "label": "Index Time", "contains": ["docs", "chunker", "embedder"]} ]}Draw it yourself
diago render rag-agent.json > rag-agent.svgOpen it in the playground to edit it in your browser.