Sequential Agent Pipeline
flowchart TB
subgraph INPUT["User Input"]
Q["T-Code, Transaction Name,\nTransaction Type, Documents"]
end
subgraph GATHER["Phase 1 — Data Gathering"]
A1["integration_agent\ngemini-3.1-flash-lite"]
A2["uploaded_document_agent\ngemini-3.1-pro"]
A3["document_retrieval_agent\ngemini-3.1-flash-lite"]
end
subgraph ANALYSIS["Phase 2 — Analysis"]
A4["extraction_agent\ngemini-3.1-pro"]
end
subgraph DRAFTING["Phase 3 — Drafting"]
A5["section_summary_agent\ngemini-3.1-pro"]
A6["section_context_agent\ngemini-3.1-flash-lite"]
A7["strategic_rationale_agent\ngemini-3.1-pro"]
A8["risk_mitigation_agent\ngemini-3.1-pro"]
A9["section_financial_agent\ngemini-3.1-pro"]
end
subgraph QUALITY["Phase 4 — Quality & Publishing"]
A10["verification_agent\ngemini-3.1-pro"]
A11["publishing_agent\ngemini-3.1-flash-lite"]
end
subgraph TOOLS["Tools"]
T1["read_sheet_data\nGoogle Sheets API"]
T2["read_drive_document\nDrive API → Markdown"]
T3["search_vertex_ai\nVertex AI Search"]
T4["score_cp_document\nDeterministic scoring"]
T5["create_deal_sheet_doc\nDrive API → Google Doc"]
end
subgraph CALLBACKS["Callbacks"]
C1["_skip_vertex_search\nBypass if flag set"]
C2["_publish_document\nDeterministic HTML assembly"]
end
Q --> A1
Q --> A2
Q --> A3
A1 -- "sheet_data" --> A4
A2 -- "uploaded_doc_text" --> A4
A3 -- "vertex_search_results" --> A4
A4 -- "extracted_data" --> A5
A4 -- "extracted_data" --> A6
A4 -- "extracted_data" --> A7
A4 -- "extracted_data" --> A8
A4 -- "extracted_data" --> A9
A6 -- "sections_3_5" --> A7
A6 -- "sections_3_5" --> A8
A5 -- "sections_1_2" --> A10
A6 -- "sections_3_5" --> A10
A7 -- "strategic_rationale" --> A10
A8 -- "risk_mitigation" --> A10
A9 -- "sections_6_8" --> A10
A10 -- "verification_report" --> A11
A1 -.-> T1
A2 -.-> T2
A3 -.-> T3
A10 -.-> T4
A11 -.-> T5
C1 -.-> A3
C2 -.-> A11
A11 --> OUT["Controls Package\nGoogle Doc\n+\nVerification Report\nGoogle Doc"]
classDef agent fill:#1e293b,stroke:#334155,color:#f8fafc,rx:12
classDef tool fill:#3b82f6,stroke:#2563eb,color:#fff,rx:8
classDef callback fill:#f59e0b,stroke:#d97706,color:#fff,rx:8
classDef input fill:#e2e8f0,stroke:#94a3b8,color:#1e293b,rx:12
classDef output fill:#10b981,stroke:#059669,color:#fff,rx:12
classDef phase fill:#f8fafc,stroke:#e2e8f0,color:#64748b
class A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11 agent
class T1,T2,T3,T4,T5 tool
class C1,C2 callback
class Q input
class OUT output
Legend
Agent (LLM-powered)
Tool (API call)
Callback (deterministic)
Output
Data flow (state key)
Uses tool/callback
Agent Details
| # |
Agent |
Model |
Tool / Callback |
Output Key |
Purpose |
| 1 |
integration_agent |
3.1 Flash Lite |
read_sheet_data |
sheet_data |
Read CP_Template_WIP spreadsheet |
| 2 |
uploaded_document_agent |
3.1 Pro |
read_drive_document |
uploaded_doc_text |
Extract structured data from uploaded files |
| 3 |
document_retrieval_agent |
3.1 Flash Lite |
search_vertex_ai
_skip_vertex_search
|
vertex_search_results |
Search Vertex AI for lease details |
| 4 |
extraction_agent |
3.1 Pro |
— |
extracted_data |
Synthesize all sources into structured JSON |
| 5 |
section_summary_agent |
3.1 Pro |
— |
sections_1_2 |
Draft Executive Summary + Key IWF Points |
| 6 |
section_context_agent |
3.1 Flash Lite |
— |
sections_3_5 |
Draft Background, Risks, Compliance |
| 7 |
strategic_rationale_agent |
3.1 Pro |
— |
strategic_rationale |
Synthesize strategic rationale from data and market knowledge |
| 8 |
risk_mitigation_agent |
3.1 Pro |
— |
risk_mitigation |
Synthesize risk mitigation and exit strategy |
| 9 |
section_financial_agent |
3.1 Pro |
— |
sections_6_8 |
Draft Deal Terms, Financials, Attachments |
| 10 |
verification_agent |
3.1 Pro |
score_cp_document |
verification_report |
Score completeness and consistency |
| 11 |
publishing_agent |
3.1 Flash Lite |
create_deal_sheet_doc
_publish_document
|
— |
Assemble HTML and create Google Docs |
Data Source Priority (Extraction Agent)
1. Uploaded Documents
PRIMARY
2. Google Sheets
3. Vertex AI Search
SUPPLEMENTARY
flowchart LR
subgraph FRONTEND["Vite SPA (vanilla JS + Tailwind)"]
direction TB
AUTH["Google Sign-In\nsessionStorage token"]
FORM["Transaction Form\nT-Code, Name, Type, Docs"]
UPLOAD["File Upload\nXHR → /api/upload"]
VALIDATE["T-Code Validation\nfetch → /api/validate-tcode"]
SSE["SSE Stream\nfetch → /api/generate"]
STEPPER["Progress Stepper\n11-step agent tracker"]
OUTPUT["Output Display\nCP + Verification inline"]
end
subgraph BACKEND["FastAPI (:8080)"]
direction TB
API_CONF["/api/config\n/api/version"]
API_UP["/api/upload"]
API_VAL["/api/validate-tcode"]
API_GEN["/api/generate\nSSE stream"]
end
subgraph EXTERNAL["External Services"]
GIS["Google Identity Services"]
DRIVE["Google Drive\nShared Drive"]
AE["Vertex AI\nAgent Engine"]
end
AUTH -- "OAuth token" --> API_CONF
UPLOAD -- "multipart file" --> API_UP
VALIDATE -- "t_code query" --> API_VAL
SSE -- "POST JSON" --> API_GEN
API_UP --> DRIVE
API_GEN --> AE
GIS --> AUTH
AUTH --> FORM
FORM --> VALIDATE
FORM --> UPLOAD
FORM --> SSE
SSE --> STEPPER
STEPPER --> OUTPUT
classDef fe fill:#7c3aed,stroke:#6d28d9,color:#fff,rx:8
classDef be fill:#1e293b,stroke:#334155,color:#f8fafc,rx:8
classDef ext fill:#0891b2,stroke:#0e7490,color:#fff,rx:8
class AUTH,FORM,UPLOAD,VALIDATE,SSE,STEPPER,OUTPUT fe
class API_CONF,API_UP,API_VAL,API_GEN be
class GIS,DRIVE,AE ext
Frontend Files
| File |
Type |
Purpose |
| index.html |
Page |
Main SPA — transaction form, file upload, progress stepper, output display |
| pipeline.html |
Page |
Pipeline architecture visualization (this page) |
| main.js |
Module |
All frontend logic: Google Sign-In, file upload (XHR), T-Code validation, SSE streaming, progress stepper, output rendering |
| style.css |
Styles |
Custom CSS (Inter font, loader animation, document preview, print styles) |
| vite.config.js |
Config |
Vite dev server with /api proxy to :8080; multi-page build (index + pipeline) |
API Endpoints (FastAPI → main.py)
| Method |
Endpoint |
Auth |
Purpose |
| GET |
/api/config |
— |
Returns OAuth client ID for frontend sign-in |
| GET |
/api/version |
— |
Returns app version from pyproject.toml |
| GET |
/api/validate-tcode |
Bearer |
Checks if T-Code exists in source spreadsheet |
| POST |
/api/upload |
Bearer |
Uploads document to Shared Drive; returns file_id |
| POST |
/api/generate |
Bearer |
Streams SSE events from Agent Engine pipeline (agent_start, complete, error) |
Frontend Diagram Legend
Frontend Component
Backend Endpoint
External Service