{
  "schemaVersion": "1.0.0",
  "workflowVersion": 1,
  "workflow": {
    "id": "wf-rag-knowledge-base-flow",
    "name": "RAG with Knowledge Base",
    "description": "Text Input -> RAG Retrieve (built-in persistent KB) -> Prompt Template -> LLM -> Output. Demonstrates Phase 9.1 — query a long-lived KB without re-ingesting on every run. Replace `<your-kb-id>` with the id returned by POST /api/knowledge-bases. Ingest documents up front via POST /api/knowledge-bases/<id>/ingest (or the Studio UI in Phase 9.2). The same `embedderId` and `embedderConfig` used to create the KB must match here.",
    "schemaVersion": "1.0.0",
    "workflowVersion": 1,
    "nodes": [
      {
        "id": "text_1",
        "type": "text_input",
        "name": "Question",
        "position": { "x": 70, "y": 220 },
        "config": {
          "text": "How do I reset my password?"
        }
      },
      {
        "id": "rag_1",
        "type": "rag_retrieve",
        "name": "RAG Retrieve (KB)",
        "position": { "x": 360, "y": 220 },
        "config": {
          "queryTemplate": "{{user_prompt}}",
          "topK": 3,
          "embedderId": "token-embedder",
          "vectorStoreId": "knowledge-base",
          "vectorStoreConfig": {
            "knowledgeBaseId": "<your-kb-id>"
          }
        }
      },
      {
        "id": "template_1",
        "type": "prompt_template",
        "name": "Grounded Prompt",
        "position": { "x": 670, "y": 220 },
        "config": {
          "template": "Use the context to answer the question. Cite the chunkId for every claim.\n\nContext:\n{{context}}\n\nQuestion:\n{{user_prompt}}",
          "outputKey": "prompt"
        }
      },
      {
        "id": "llm_1",
        "type": "llm_call",
        "name": "LLM",
        "position": { "x": 980, "y": 220 },
        "config": {
          "provider": {
            "providerId": "echo",
            "model": "echo-1"
          },
          "promptKey": "prompt"
        }
      },
      {
        "id": "output_1",
        "type": "output",
        "name": "Output",
        "position": { "x": 1290, "y": 220 },
        "config": {
          "responseTemplate": "{{answer}}",
          "outputKey": "result"
        }
      }
    ],
    "edges": [
      { "id": "edge_1", "source": "text_1", "target": "rag_1" },
      { "id": "edge_2", "source": "rag_1", "target": "template_1" },
      { "id": "edge_3", "source": "text_1", "target": "template_1" },
      { "id": "edge_4", "source": "template_1", "target": "llm_1" },
      { "id": "edge_5", "source": "llm_1", "target": "output_1" }
    ]
  },
  "exportedAt": "2026-05-08T00:00:00.000Z"
}
