# wajih1234/ai-research-team architecture

> Architecture diagram of the GitHub repository wajih1234/ai-research-team, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wajih1234/ai-research-team
- Repository: https://github.com/wajih1234/ai-research-team

## Overview

AI Research Team accepts a topic in the React UI, streams agent progress from a FastAPI endpoint, and displays a cited Markdown report. The LangGraph workflow plans questions, researches each with web search, critiques findings, then writes the report. Gemini supports the agents; DuckDuckGo supplies search results. The excerpts show the graph’s sequence and agent calls, though the critic’s reviews are not passed into report generation. The README documents the UI-to-SSE connection and deployed capabilities; unsampled implementation details are not inferred.

Main entry points: [`backend/graph.py`](https://github.com/wajih1234/ai-research-team/blob/main/backend/graph.py) (LangGraph workflow), [`frontend/src/App.jsx`](https://github.com/wajih1234/ai-research-team/blob/main/frontend/src/App.jsx) (Research UI), [`backend/main.py`](https://github.com/wajih1234/ai-research-team/blob/main/backend/main.py) (FastAPI endpoints), [`backend/researcher.py`](https://github.com/wajih1234/ai-research-team/blob/main/backend/researcher.py) (Researcher agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Research UI"]
  node_ui["Research UI<br/>[App.jsx]"]
  node_report["Markdown report<br/>[App.jsx]"]
end

subgraph group_service["API and Orchestration"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_flow["LangGraph workflow<br/>[graph.py]"]
end

subgraph group_research["Research Agents"]
  node_planner["Planner<br/>[planner.py]"]
  node_researcher["Researcher agent<br/>[researcher.py]"]
  node_critic["Critic<br/>[critic.py]"]
  node_writer["Report writer<br/>[writer.py]"]
end

subgraph group_outputs["Search and Generation"]
  node_search["Search tool<br/>[search_tool.py]"]
  node_duckduckgo{{"DuckDuckGo"}}
  node_gemini{{"Gemini API"}}
end

node_user(("Researcher"))

node_user -->|"enters topic"| node_ui
node_ui -->|"opens SSE stream"| node_api
node_api -->|"invokes or streams"| node_flow
node_flow -->|"dispatches"| node_planner
node_flow -->|"dispatches"| node_researcher
node_flow -->|"dispatches"| node_critic
node_flow -->|"dispatches"| node_writer
node_planner -->|"generates questions"| node_gemini
node_researcher -->|"searches questions"| node_search
node_search -->|"queries web"| node_duckduckgo
node_researcher -->|"drafts answers"| node_gemini
node_critic -->|"reviews findings"| node_gemini
node_writer -->|"writes report"| node_gemini
node_writer -->|"produces Markdown"| node_report
node_flow -->|"returns updates"| node_api
node_api -->|"streams agent events"| node_ui
node_ui -->|"renders report"| node_report

click node_ui "https://github.com/wajih1234/ai-research-team/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/wajih1234/ai-research-team/blob/main/backend/main.py"
click node_flow "https://github.com/wajih1234/ai-research-team/blob/main/backend/graph.py"
click node_planner "https://github.com/wajih1234/ai-research-team/blob/main/backend/planner.py"
click node_researcher "https://github.com/wajih1234/ai-research-team/blob/main/backend/researcher.py"
click node_critic "https://github.com/wajih1234/ai-research-team/blob/main/backend/critic.py"
click node_writer "https://github.com/wajih1234/ai-research-team/blob/main/backend/writer.py"
click node_search "https://github.com/wajih1234/ai-research-team/blob/main/backend/search_tool.py"
click node_report "https://github.com/wajih1234/ai-research-team/blob/main/frontend/src/App.jsx"

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_ui,node_report toneBlue
class node_api,node_flow toneAmber
class node_planner,node_researcher,node_critic,node_writer toneMint
class node_search,node_duckduckgo,node_gemini toneRose
class node_user toneIndigo
```

## Components

### Research UI

- [Research UI](https://github.com/wajih1234/ai-research-team/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Markdown report](https://github.com/wajih1234/ai-research-team/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### API and Orchestration

- [FastAPI endpoints](https://github.com/wajih1234/ai-research-team/blob/main/backend/main.py): `backend/main.py`
- [LangGraph workflow](https://github.com/wajih1234/ai-research-team/blob/main/backend/graph.py): `backend/graph.py`

### Research Agents

- [Planner](https://github.com/wajih1234/ai-research-team/blob/main/backend/planner.py): `backend/planner.py`
- [Researcher agent](https://github.com/wajih1234/ai-research-team/blob/main/backend/researcher.py): `backend/researcher.py`
- [Critic](https://github.com/wajih1234/ai-research-team/blob/main/backend/critic.py): `backend/critic.py`
- [Report writer](https://github.com/wajih1234/ai-research-team/blob/main/backend/writer.py): `backend/writer.py`

### Search and Generation

- [Search tool](https://github.com/wajih1234/ai-research-team/blob/main/backend/search_tool.py): `backend/search_tool.py`
- **DuckDuckGo**
- **Gemini API**

### Other components

- **Researcher**

## Connections

- Researcher → Research UI: enters topic (evidence: `README.md`)
- Research UI → FastAPI endpoints: opens SSE stream (evidence: `README.md`)
- FastAPI endpoints → LangGraph workflow: invokes or streams (evidence: `backend/main.py`)
- LangGraph workflow → Planner: dispatches (evidence: `backend/graph.py`)
- LangGraph workflow → Researcher agent: dispatches (evidence: `backend/graph.py`)
- LangGraph workflow → Critic: dispatches (evidence: `backend/graph.py`)
- LangGraph workflow → Report writer: dispatches (evidence: `backend/graph.py`)
- Planner → Gemini API: generates questions (evidence: `backend/planner.py`)
- Researcher agent → Search tool: searches questions (evidence: `backend/researcher.py`)
- Search tool → DuckDuckGo: queries web (evidence: `backend/search_tool.py`)
- Researcher agent → Gemini API: drafts answers (evidence: `backend/researcher.py`)
- Critic → Gemini API: reviews findings (evidence: `backend/critic.py`)
- Report writer → Gemini API: writes report (evidence: `backend/writer.py`)
- Report writer → Markdown report: produces Markdown (evidence: `backend/writer.py`)
- LangGraph workflow → FastAPI endpoints: returns updates (evidence: `backend/main.py`)
- FastAPI endpoints → Research UI: streams agent events (evidence: `README.md`)
- Research UI → Markdown report: renders report (evidence: `frontend/src/App.jsx`)
