# antonio9966/agente_4_en_1 architecture

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

- Interactive diagram: https://gitdiagram.com/antonio9966/agente_4_en_1
- Repository: https://github.com/antonio9966/agente_4_en_1

## Overview

This is a web application for academic literature review: users search scholarly sources or add PDFs, extract study details, compare evidence, compose a research document, and export it. The frontend coordinates the workflow through an API layer; the Express server routes requests to search, PDF, analysis, and export services. The evidence shows several backend calls directly, but not every frontend callback or route implementation, so uncertain UI composition links are dashed. External academic and LLM integrations are represented at the service boundary.

Main entry points: [`src/App.tsx`](https://github.com/antonio9966/agente_4_en_1/blob/main/src/App.tsx) (Workflow coordinator), [`server/index.ts`](https://github.com/antonio9966/agente_4_en_1/blob/main/server/index.ts) (Express routes), [`server/services/agent2Extractor.ts`](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/agent2Extractor.ts) (Study extraction), [`server/services/pdfProcessor.ts`](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/pdfProcessor.ts) (PDF processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Review workspace"]
  node_app["Workflow coordinator<br/>[App.tsx]"]
  node_search_ui["Search panel"]
  node_extract_ui["Extraction panel"]
  node_compare_ui["Comparison panel"]
  node_document_ui["Document panel"]
  node_settings["LLM settings<br/>[SettingsModal.tsx]"]
  node_stepper["Stage navigator<br/>[StepperHeader.tsx]"]
end

subgraph group_api["HTTP interface"]
  node_api_client["API client<br/>[api.ts]"]
  node_server["Express routes<br/>[index.ts]"]
end

subgraph group_research["Research pipeline"]
  node_search["Academic search<br/>[academicApis.ts]"]
  node_pdf["PDF processing<br/>[pdfProcessor.ts]"]
  node_pdf_store[("Private PDF store<br/>[pdfProcessor.ts]")]
  node_extract["Study extraction<br/>[agent2Extractor.ts]"]
end

subgraph group_support["Analysis and output"]
  node_compare["Evidence comparison"]
  node_compose["Document composition<br/>[agent4Composer.ts]"]
  node_apa["APA formatting<br/>[apa7.ts]"]
  node_llm["LLM client<br/>[llmClient.ts]"]
  node_export["Document export<br/>[exporter.ts]"]
  node_contracts["Shared data types<br/>[types.ts]"]
end

node_user(("Researcher"))
node_academic_sources{{"Scholarly APIs"}}
node_llm_providers{{"LLM providers"}}

node_user -.->|"uses"| node_app
node_app -.->|"presents"| node_search_ui
node_app -.->|"presents"| node_extract_ui
node_app -.->|"presents"| node_compare_ui
node_app -.->|"presents"| node_document_ui
node_app -.->|"presents"| node_settings
node_app -.->|"presents"| node_stepper
node_app -->|"requests"| node_api_client
node_api_client -.->|"HTTP requests"| node_server
node_server -->|"dispatches search"| node_search
node_search -->|"queries"| node_academic_sources
node_server -->|"parses uploads"| node_pdf
node_pdf -->|"stores PDFs"| node_pdf_store
node_server -->|"removes uploads"| node_pdf
node_server -->|"dispatches extraction"| node_extract
node_extract -->|"loads PDF content"| node_pdf
node_extract -->|"requests analysis"| node_llm
node_extract -->|"uses citations"| node_apa
node_server -->|"dispatches comparison"| node_compare
node_compare -->|"requests analysis"| node_llm
node_server -.->|"dispatches composition"| node_compose
node_compose -->|"requests composition"| node_llm
node_server -->|"exports document"| node_export
node_llm -->|"sends prompts"| node_llm_providers

click node_app "https://github.com/antonio9966/agente_4_en_1/blob/main/src/App.tsx"
click node_search_ui "https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/Stage1SearchPanel.tsx"
click node_extract_ui "https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/Stage2ExtractionPanel.tsx"
click node_compare_ui "https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/Stage3ComparisonPanel.tsx"
click node_document_ui "https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/Stage4DocumentPanel.tsx"
click node_settings "https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/SettingsModal.tsx"
click node_stepper "https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/StepperHeader.tsx"
click node_api_client "https://github.com/antonio9966/agente_4_en_1/blob/main/src/api.ts"
click node_server "https://github.com/antonio9966/agente_4_en_1/blob/main/server/index.ts"
click node_search "https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/academicApis.ts"
click node_pdf "https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/pdfProcessor.ts"
click node_pdf_store "https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/pdfProcessor.ts"
click node_extract "https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/agent2Extractor.ts"
click node_compare "https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/agent3Comparator.ts"
click node_compose "https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/agent4Composer.ts"
click node_apa "https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/apa7.ts"
click node_llm "https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/llmClient.ts"
click node_export "https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/exporter.ts"
click node_contracts "https://github.com/antonio9966/agente_4_en_1/blob/main/server/types.ts"

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_app,node_search_ui,node_extract_ui,node_compare_ui,node_document_ui,node_settings,node_stepper toneBlue
class node_api_client,node_server toneAmber
class node_search,node_pdf,node_pdf_store,node_extract,node_academic_sources toneMint
class node_compare,node_compose,node_apa,node_llm,node_export,node_contracts toneRose
class node_user,node_llm_providers toneIndigo
```

## Components

### Review workspace

- [Workflow coordinator](https://github.com/antonio9966/agente_4_en_1/blob/main/src/App.tsx): `src/App.tsx`
- [Search panel](https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/Stage1SearchPanel.tsx): `src/components/Stage1SearchPanel.tsx`
- [Extraction panel](https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/Stage2ExtractionPanel.tsx): `src/components/Stage2ExtractionPanel.tsx`
- [Comparison panel](https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/Stage3ComparisonPanel.tsx): `src/components/Stage3ComparisonPanel.tsx`
- [Document panel](https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/Stage4DocumentPanel.tsx): `src/components/Stage4DocumentPanel.tsx`
- [LLM settings](https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/SettingsModal.tsx): `src/components/SettingsModal.tsx`
- [Stage navigator](https://github.com/antonio9966/agente_4_en_1/blob/main/src/components/StepperHeader.tsx): `src/components/StepperHeader.tsx`

### HTTP interface

- [API client](https://github.com/antonio9966/agente_4_en_1/blob/main/src/api.ts): `src/api.ts`
- [Express routes](https://github.com/antonio9966/agente_4_en_1/blob/main/server/index.ts): `server/index.ts`

### Research pipeline

- [Academic search](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/academicApis.ts): `server/services/academicApis.ts`
- [PDF processing](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/pdfProcessor.ts): `server/services/pdfProcessor.ts`
- [Private PDF store](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/pdfProcessor.ts): `server/services/pdfProcessor.ts`
- [Study extraction](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/agent2Extractor.ts): `server/services/agent2Extractor.ts`

### Analysis and output

- [Evidence comparison](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/agent3Comparator.ts): `server/services/agent3Comparator.ts`
- [Document composition](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/agent4Composer.ts): `server/services/agent4Composer.ts`
- [APA formatting](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/apa7.ts): `server/services/apa7.ts`
- [LLM client](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/llmClient.ts): `server/services/llmClient.ts`
- [Document export](https://github.com/antonio9966/agente_4_en_1/blob/main/server/services/exporter.ts): `server/services/exporter.ts`
- [Shared data types](https://github.com/antonio9966/agente_4_en_1/blob/main/server/types.ts): `server/types.ts`

### Other components

- **Researcher**
- **Scholarly APIs**
- **LLM providers**

## Connections

- Researcher → Workflow coordinator: uses
- Workflow coordinator → Search panel: presents (evidence: `src/App.tsx`)
- Workflow coordinator → Extraction panel: presents (evidence: `src/App.tsx`)
- Workflow coordinator → Comparison panel: presents (evidence: `src/App.tsx`)
- Workflow coordinator → Document panel: presents (evidence: `src/App.tsx`)
- Workflow coordinator → LLM settings: presents (evidence: `src/App.tsx`)
- Workflow coordinator → Stage navigator: presents (evidence: `src/App.tsx`)
- Workflow coordinator → API client: requests (evidence: `src/App.tsx`)
- API client → Express routes: HTTP requests
- Express routes → Academic search: dispatches search (evidence: `server/index.ts`)
- Academic search → Scholarly APIs: queries (evidence: `server/services/academicApis.ts`)
- Express routes → PDF processing: parses uploads (evidence: `server/index.ts`)
- PDF processing → Private PDF store: stores PDFs (evidence: `server/services/pdfProcessor.ts`)
- Express routes → PDF processing: removes uploads (evidence: `server/index.ts`)
- Express routes → Study extraction: dispatches extraction (evidence: `server/index.ts`)
- Study extraction → PDF processing: loads PDF content (evidence: `server/services/agent2Extractor.ts`)
- Study extraction → LLM client: requests analysis (evidence: `server/services/agent2Extractor.ts`)
- Study extraction → APA formatting: uses citations (evidence: `server/services/agent2Extractor.ts`)
- Express routes → Evidence comparison: dispatches comparison (evidence: `server/index.ts`)
- Evidence comparison → LLM client: requests analysis (evidence: `server/services/agent3Comparator.ts`)
- Express routes → Document composition: dispatches composition (evidence: `server/index.ts`)
- Document composition → LLM client: requests composition (evidence: `server/services/agent4Composer.ts`)
- Express routes → Document export: exports document (evidence: `server/index.ts`)
- LLM client → LLM providers: sends prompts (evidence: `server/services/llmClient.ts`)
