# rominirani/doc-reviewer-101 architecture

> Architecture diagram of the GitHub repository rominirani/doc-reviewer-101, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rominirani/doc-reviewer-101
- Repository: https://github.com/rominirani/doc-reviewer-101

## Overview

Google Docs AI Reviewer is a web application that reviews a user-selected document and writes anchored comments and suggested edits into that document. The main flow is browser selection and criteria entry, authenticated review submission, ADK agent orchestration, then Google Docs reads and writes; Vertex AI supplies the model. The FastAPI app also exposes A2A routes, and shared ADK session/artifact services support serving surfaces. The README documents the picker and cloud integrations; sampled source confirms the review tools and route setup, but not every runtime wiring detail.

Main entry points: [`app/agent.py`](https://github.com/rominirani/doc-reviewer-101/blob/main/app/agent.py) (Review Agent), [`app/fast_api_app.py`](https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py) (FastAPI Routes), [`app/tools.py`](https://github.com/rominirani/doc-reviewer-101/blob/main/app/tools.py) (Read Document), [`app/app_utils/services.py`](https://github.com/rominirani/doc-reviewer-101/blob/main/app/app_utils/services.py) (Session and Artifacts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser and Web"]
  node_browser["Reviewer UI<br/>[fast_api_app.py]"]
  node_picker["Drive Picker<br/>[fast_api_app.py]"]
  node_oauth["OAuth Flow<br/>[fast_api_app.py]"]
  node_api["FastAPI Routes<br/>[fast_api_app.py]"]
end

subgraph group_review["Review Runtime"]
  node_runner["ADK Runner<br/>[fast_api_app.py]"]
  node_agent["Review Agent<br/>[agent.py]"]
end

subgraph group_docs["Document Operations"]
  node_read["Read Document<br/>[tools.py]"]
  node_comments["Insert Comments<br/>[tools.py]"]
  node_edits["Suggested Edits<br/>[tools.py]"]
end

subgraph group_runtime["Agent Interfaces"]
  node_session[("Session and Artifacts<br/>[services.py]")]
  node_a2a["A2A Routes<br/>[a2a.py]"]
end

node_user(("Reviewer"))
node_google(("Google Account"))
node_drive["Google Drive and Picker APIs"]
node_docsapi["Google Docs API"]
node_vertex["Vertex AI Gemini"]

node_user -->|"uses"| node_browser
node_browser -->|"selects document"| node_picker
node_picker -->|"browses Drive"| node_drive
node_browser -->|"submits review"| node_api
node_browser -->|"loads templates"| node_api
node_user -->|"signs in"| node_oauth
node_oauth -->|"exchanges code"| node_google
node_api -->|"runs review"| node_runner
node_runner -->|"invokes"| node_agent
node_agent -->|"reasons with"| node_vertex
node_agent -->|"calls"| node_read
node_agent -->|"calls"| node_comments
node_agent -->|"calls"| node_edits
node_read -->|"reads document"| node_docsapi
node_comments -->|"writes comments"| node_docsapi
node_edits -->|"writes suggestions"| node_docsapi
node_api -->|"shares services"| node_session
node_api -->|"attaches routes"| node_a2a

click node_browser "https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py"
click node_picker "https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py"
click node_oauth "https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py"
click node_api "https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py"
click node_runner "https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py"
click node_agent "https://github.com/rominirani/doc-reviewer-101/blob/main/app/agent.py"
click node_read "https://github.com/rominirani/doc-reviewer-101/blob/main/app/tools.py"
click node_comments "https://github.com/rominirani/doc-reviewer-101/blob/main/app/tools.py"
click node_edits "https://github.com/rominirani/doc-reviewer-101/blob/main/app/tools.py"
click node_session "https://github.com/rominirani/doc-reviewer-101/blob/main/app/app_utils/services.py"
click node_a2a "https://github.com/rominirani/doc-reviewer-101/blob/main/app/app_utils/a2a.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_browser,node_picker,node_oauth,node_api,node_user toneBlue
class node_runner,node_agent toneAmber
class node_read,node_comments,node_edits,node_drive,node_docsapi toneMint
class node_session,node_a2a toneRose
class node_google,node_vertex toneIndigo
```

## Components

### Browser and Web

- [Reviewer UI](https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py): `app/fast_api_app.py`
- [Drive Picker](https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py): `app/fast_api_app.py`
- [OAuth Flow](https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py): `app/fast_api_app.py`
- [FastAPI Routes](https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py): `app/fast_api_app.py`

### Review Runtime

- [ADK Runner](https://github.com/rominirani/doc-reviewer-101/blob/main/app/fast_api_app.py): `app/fast_api_app.py`
- [Review Agent](https://github.com/rominirani/doc-reviewer-101/blob/main/app/agent.py): `app/agent.py`

### Document Operations

- [Read Document](https://github.com/rominirani/doc-reviewer-101/blob/main/app/tools.py): `app/tools.py`
- [Insert Comments](https://github.com/rominirani/doc-reviewer-101/blob/main/app/tools.py): `app/tools.py`
- [Suggested Edits](https://github.com/rominirani/doc-reviewer-101/blob/main/app/tools.py): `app/tools.py`

### Agent Interfaces

- [Session and Artifacts](https://github.com/rominirani/doc-reviewer-101/blob/main/app/app_utils/services.py): `app/app_utils/services.py`
- [A2A Routes](https://github.com/rominirani/doc-reviewer-101/blob/main/app/app_utils/a2a.py): `app/app_utils/a2a.py`

### Other components

- **Reviewer**
- **Google Account**
- **Google Drive and Picker APIs**
- **Google Docs API**
- **Vertex AI Gemini**

## Connections

- Reviewer → Reviewer UI: uses (evidence: `README.md`)
- Reviewer UI → Drive Picker: selects document (evidence: `README.md`)
- Drive Picker → Google Drive and Picker APIs: browses Drive (evidence: `README.md`)
- Reviewer UI → FastAPI Routes: submits review (evidence: `README.md`)
- Reviewer UI → FastAPI Routes: loads templates (evidence: `app/fast_api_app.py`)
- Reviewer → OAuth Flow: signs in (evidence: `README.md`)
- OAuth Flow → Google Account: exchanges code (evidence: `app/fast_api_app.py`)
- FastAPI Routes → ADK Runner: runs review (evidence: `app/fast_api_app.py`)
- ADK Runner → Review Agent: invokes (evidence: `README.md`)
- Review Agent → Vertex AI Gemini: reasons with (evidence: `README.md`)
- Review Agent → Read Document: calls (evidence: `app/agent.py`)
- Review Agent → Insert Comments: calls (evidence: `app/agent.py`)
- Review Agent → Suggested Edits: calls (evidence: `app/agent.py`)
- Read Document → Google Docs API: reads document (evidence: `app/tools.py`)
- Insert Comments → Google Docs API: writes comments (evidence: `app/tools.py`)
- Suggested Edits → Google Docs API: writes suggestions (evidence: `app/tools.py`)
- FastAPI Routes → Session and Artifacts: shares services (evidence: `app/fast_api_app.py`)
- FastAPI Routes → A2A Routes: attaches routes (evidence: `app/fast_api_app.py`)
