Architecture

LlamaIndex and LangGraph are wired as complementary layers.

LangGraph should own the state machine, retries, and tool routing. LlamaIndex belongs inside the retrieval node so the orchestration loop can query domain knowledge without collapsing application logic into the retriever.

flowchart LR
    A["User Request"] --> B["Next.js Concierge / Agent UI"]
    B --> C["FastAPI Gateway"]
    C --> D["LangGraph Supervisor"]
    D --> E["Planner Agent"]
    D --> F["Retriever Agent"]
    D --> G["Delivery Agent"]
    F --> H["LlamaIndex Query Engine"]
    H --> I["Vector Store / Knowledge Base"]
    H --> J["Structured Sources: Docs, Sheets, CRM, APIs"]
    E --> K["Tool Router"]
    K --> L["Excel Automation"]
    K --> M["SaaS / Internal APIs"]
    K --> N["Analytics / BI"]
    G --> O["Streaming Response"]
    O --> B