# manthan89-py/multi-agent-query-resolution architecture

> Architecture diagram of the GitHub repository manthan89-py/multi-agent-query-resolution, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manthan89-py/multi-agent-query-resolution
- Repository: https://github.com/manthan89-py/multi-agent-query-resolution

## Overview

This is a FastAPI-backed customer-query resolution system. A client submits a query to the API, which runs a workflow: a routing team selects product knowledge or customer support, then a personality agent rewrites the specialist response and the API returns structured output. Product questions use a website-derived vector knowledge base, with optional Tavily search; support tools look up customer records and manage tickets in in-memory stores. The graph follows the sampled API, workflow, agent, and knowledge code; README-described details without sampled implementation are represented only where their module path is supported.

Main entry points: [`api.py`](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/api.py) (FastAPI endpoints), [`agents/workflow.py`](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/workflow.py) (Query workflow), [`agents/router_agent.py`](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/router_agent.py) (Routing team), [`agents/knowledge_agent.py`](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/knowledge_agent.py) (Knowledge specialist)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_api["FastAPI endpoints<br/>[api.py]"]
  node_request["Request and response models<br/>[models.py]"]
  node_workflow_storage[("Workflow JSON storage<br/>[api.py]")]
end

subgraph group_orchestration["Query orchestration"]
  node_workflow["Query workflow<br/>[workflow.py]"]
  node_router["Routing team<br/>[router_agent.py]"]
  node_personality["Personality layer<br/>[workflow.py]"]
end

subgraph group_specialists["Specialist agents"]
  node_knowledge_agent["Knowledge specialist<br/>[knowledge_agent.py]"]
  node_support_agent["Support specialist"]
end

subgraph group_knowledge["Knowledge and support data"]
  node_knowledge_base["Website knowledge base<br/>[knowledge_agent.py]"]
  node_vector_db[("Knowledge vector store<br/>[knowledge_agent.py]")]
  node_customer_records[("Customer records")]
  node_tickets[("Support tickets")]
end

subgraph group_services["External services"]
  node_website["InfinitePay website"]
  node_mistral["Mistral API"]
  node_tavily["Tavily search"]
end

node_client(("Query client"))

node_client -->|"submits query"| node_api
node_api -->|"validates request"| node_request
node_api -->|"runs query"| node_workflow
node_api -->|"configures storage"| node_workflow_storage
node_workflow -->|"routes query"| node_router
node_router -->|"dispatches"| node_knowledge_agent
node_router -->|"dispatches"| node_support_agent
node_workflow -->|"enhances response"| node_personality
node_workflow -->|"builds final output"| node_request
node_knowledge_agent -->|"searches knowledge"| node_knowledge_base
node_knowledge_base -->|"retrieves chunks"| node_vector_db
node_api -->|"loads knowledge"| node_knowledge_base
node_knowledge_base -->|"extracts content"| node_website
node_support_agent -->|"looks up customer"| node_customer_records
node_support_agent -->|"checks or creates tickets"| node_tickets
node_router -->|"classifies queries"| node_mistral
node_knowledge_agent -->|"generates answers"| node_mistral
node_personality -->|"rewrites response"| node_mistral
node_support_agent -->|"generates support response"| node_mistral
node_knowledge_agent -.->|"searches web"| node_tavily

click node_api "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/api.py"
click node_request "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/utils/models.py"
click node_workflow "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/workflow.py"
click node_router "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/router_agent.py"
click node_personality "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/workflow.py"
click node_knowledge_agent "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/knowledge_agent.py"
click node_support_agent "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/customer_support_agent.py"
click node_knowledge_base "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/knowledge_agent.py"
click node_vector_db "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/knowledge_agent.py"
click node_customer_records "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/customer_support_agent.py"
click node_tickets "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/customer_support_agent.py"
click node_workflow_storage "https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/api.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_request,node_workflow_storage,node_client toneBlue
class node_workflow,node_router,node_personality toneAmber
class node_knowledge_agent,node_support_agent toneMint
class node_knowledge_base,node_vector_db,node_customer_records,node_tickets toneRose
class node_website,node_mistral,node_tavily toneIndigo
```

## Components

### API entry

- [FastAPI endpoints](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/api.py): `api.py`
- [Request and response models](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/utils/models.py): `utils/models.py`
- [Workflow JSON storage](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/api.py): `api.py`

### Query orchestration

- [Query workflow](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/workflow.py): `agents/workflow.py`
- [Routing team](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/router_agent.py): `agents/router_agent.py`
- [Personality layer](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/workflow.py): `agents/workflow.py`

### Specialist agents

- [Knowledge specialist](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/knowledge_agent.py): `agents/knowledge_agent.py`
- [Support specialist](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/customer_support_agent.py): `agents/customer_support_agent.py`

### Knowledge and support data

- [Website knowledge base](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/knowledge_agent.py): `agents/knowledge_agent.py`
- [Knowledge vector store](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/knowledge_agent.py): `agents/knowledge_agent.py`
- [Customer records](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/customer_support_agent.py): `agents/customer_support_agent.py`
- [Support tickets](https://github.com/manthan89-py/multi-agent-query-resolution/blob/main/agents/customer_support_agent.py): `agents/customer_support_agent.py`

### External services

- **InfinitePay website**
- **Mistral API**
- **Tavily search**

### Other components

- **Query client**

## Connections

- Query client → FastAPI endpoints: submits query
- FastAPI endpoints → Request and response models: validates request
- FastAPI endpoints → Query workflow: runs query
- FastAPI endpoints → Workflow JSON storage: configures storage
- Query workflow → Routing team: routes query
- Routing team → Knowledge specialist: dispatches
- Routing team → Support specialist: dispatches
- Query workflow → Personality layer: enhances response
- Query workflow → Request and response models: builds final output
- Knowledge specialist → Website knowledge base: searches knowledge
- Website knowledge base → Knowledge vector store: retrieves chunks
- FastAPI endpoints → Website knowledge base: loads knowledge
- Website knowledge base → InfinitePay website: extracts content
- Support specialist → Customer records: looks up customer
- Support specialist → Support tickets: checks or creates tickets
- Routing team → Mistral API: classifies queries
- Knowledge specialist → Mistral API: generates answers
- Personality layer → Mistral API: rewrites response
- Support specialist → Mistral API: generates support response
- Knowledge specialist → Tavily search: searches web
