# https-deeplearning-ai/agentic-ai-public architecture

> Architecture diagram of the GitHub repository https-deeplearning-ai/agentic-ai-public, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/https-deeplearning-ai/agentic-ai-public
- Repository: https://github.com/https-deeplearning-ai/agentic-ai-public

## Overview

This is a FastAPI research-reporting app: a user submits a topic, the API creates a task and plan, then a background thread executes research, writing, and editing steps and stores the final report in PostgreSQL. Users can poll in-memory step progress or retrieve persisted task status and results. Research uses web, arXiv, and Wikipedia tools; arXiv results can include extracted PDF text. The README documents the UI and polling capabilities. Source excerpts show the API and agent calls; tool-to-provider behavior is documented or visible in the tool module, while some UI wiring is not sampled.

Main entry points: [`main.py`](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py) (Task API), [`src/agents.py`](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/agents.py) (Research agent), [`src/planning_agent.py`](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/planning_agent.py) (Step executor), [`src/research_tools.py`](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/research_tools.py) (arXiv search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_ui["Research form<br/>[index.html]"]
end

subgraph group_api["API and tasks"]
  node_api_routes["Task API<br/>[main.py]"]
  node_workflow_runner["Workflow runner<br/>[main.py]"]
  node_progress["Live progress<br/>[main.py]"]
end

subgraph group_workflow["Agent workflow"]
  node_planner["Research planner<br/>[planning_agent.py]"]
  node_step_executor["Step executor<br/>[planning_agent.py]"]
  node_research_agent["Research agent<br/>[agents.py]"]
  node_writer_agent["Report writer<br/>[agents.py]"]
  node_editor_agent["Report editor<br/>[agents.py]"]
end

subgraph group_research["Research sources"]
  node_web_search["Web search<br/>[research_tools.py]"]
  node_arxiv_search["arXiv search<br/>[research_tools.py]"]
  node_pdf_text["PDF extraction<br/>[research_tools.py]"]
  node_wikipedia_search["Wikipedia search<br/>[research_tools.py]"]
end

subgraph group_persistence["Task persistence"]
  node_task_state["Task progress state<br/>[main.py]"]
  node_postgres[("PostgreSQL tasks<br/>[main.py]")]
end

node_user(("Research user"))
node_llm{{"LLM service"}}
node_tavily{{"Tavily service"}}
node_arxiv{{"arXiv service"}}
node_wikipedia{{"Wikipedia service"}}
node_pdf_host{{"PDF hosts"}}

node_user -->|"opens"| node_ui
node_user -->|"submits task"| node_api_routes
node_ui -.->|"starts research"| node_api_routes
node_api_routes -->|"creates task"| node_postgres
node_api_routes -->|"plans task"| node_planner
node_api_routes -->|"initializes progress"| node_task_state
node_api_routes -->|"starts thread"| node_workflow_runner
node_api_routes -->|"reads task result"| node_postgres
node_api_routes -->|"serves progress"| node_task_state
node_workflow_runner -->|"executes steps"| node_step_executor
node_workflow_runner -->|"updates progress"| node_task_state
node_workflow_runner -->|"stores report"| node_postgres
node_planner -->|"requests plan"| node_llm
node_step_executor -->|"dispatches research"| node_research_agent
node_step_executor -->|"dispatches writing"| node_writer_agent
node_step_executor -->|"dispatches editing"| node_editor_agent
node_research_agent -->|"requests tool use"| node_llm
node_writer_agent -->|"generates draft"| node_llm
node_editor_agent -->|"revises report"| node_llm
node_research_agent -->|"offers tool"| node_web_search
node_research_agent -->|"offers tool"| node_arxiv_search
node_research_agent -->|"offers tool"| node_wikipedia_search
node_web_search -->|"searches web"| node_tavily
node_arxiv_search -->|"queries papers"| node_arxiv
node_arxiv_search -->|"extracts full text"| node_pdf_text
node_pdf_text -->|"fetches PDFs"| node_pdf_host
node_wikipedia_search -->|"searches pages"| node_wikipedia

click node_ui "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/templates/index.html"
click node_api_routes "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py"
click node_workflow_runner "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py"
click node_progress "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py"
click node_planner "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/planning_agent.py"
click node_step_executor "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/planning_agent.py"
click node_research_agent "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/agents.py"
click node_writer_agent "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/agents.py"
click node_editor_agent "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/agents.py"
click node_web_search "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/research_tools.py"
click node_arxiv_search "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/research_tools.py"
click node_pdf_text "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/research_tools.py"
click node_wikipedia_search "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/research_tools.py"
click node_task_state "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py"
click node_postgres "https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.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_ui,node_user toneBlue
class node_api_routes,node_workflow_runner,node_progress toneAmber
class node_planner,node_step_executor,node_research_agent,node_writer_agent,node_editor_agent toneMint
class node_web_search,node_arxiv_search,node_pdf_text,node_wikipedia_search toneRose
class node_task_state,node_postgres,node_llm,node_tavily,node_arxiv,node_wikipedia,node_pdf_host toneIndigo
```

## Components

### Web interface

- [Research form](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/templates/index.html): `templates/index.html`

### API and tasks

- [Task API](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py): `main.py`
- [Workflow runner](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py): `main.py`
- [Live progress](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py): `main.py`

### Agent workflow

- [Research planner](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/planning_agent.py): `src/planning_agent.py`
- [Step executor](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/planning_agent.py): `src/planning_agent.py`
- [Research agent](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/agents.py): `src/agents.py`
- [Report writer](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/agents.py): `src/agents.py`
- [Report editor](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/agents.py): `src/agents.py`

### Research sources

- [Web search](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/research_tools.py): `src/research_tools.py`
- [arXiv search](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/research_tools.py): `src/research_tools.py`
- [PDF extraction](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/research_tools.py): `src/research_tools.py`
- [Wikipedia search](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/src/research_tools.py): `src/research_tools.py`

### Task persistence

- [Task progress state](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py): `main.py`
- [PostgreSQL tasks](https://github.com/https-deeplearning-ai/agentic-ai-public/blob/main/main.py): `main.py`

### Other components

- **Research user**
- **LLM service**
- **Tavily service**
- **arXiv service**
- **Wikipedia service**
- **PDF hosts**

## Connections

- Research user → Research form: opens (evidence: `README.md`)
- Research user → Task API: submits task (evidence: `README.md`)
- Research form → Task API: starts research (evidence: `README.md`)
- Task API → PostgreSQL tasks: creates task (evidence: `main.py`)
- Task API → Research planner: plans task (evidence: `main.py`)
- Task API → Task progress state: initializes progress (evidence: `main.py`)
- Task API → Workflow runner: starts thread (evidence: `main.py`)
- Task API → PostgreSQL tasks: reads task result (evidence: `main.py`)
- Task API → Task progress state: serves progress (evidence: `main.py`)
- Workflow runner → Step executor: executes steps (evidence: `main.py`)
- Workflow runner → Task progress state: updates progress (evidence: `main.py`)
- Workflow runner → PostgreSQL tasks: stores report (evidence: `main.py`)
- Research planner → LLM service: requests plan (evidence: `src/planning_agent.py`)
- Step executor → Research agent: dispatches research (evidence: `src/planning_agent.py`)
- Step executor → Report writer: dispatches writing (evidence: `src/planning_agent.py`)
- Step executor → Report editor: dispatches editing (evidence: `src/planning_agent.py`)
- Research agent → LLM service: requests tool use (evidence: `src/agents.py`)
- Report writer → LLM service: generates draft (evidence: `src/agents.py`)
- Report editor → LLM service: revises report (evidence: `src/agents.py`)
- Research agent → Web search: offers tool (evidence: `src/agents.py`)
- Research agent → arXiv search: offers tool (evidence: `src/agents.py`)
- Research agent → Wikipedia search: offers tool (evidence: `src/agents.py`)
- Web search → Tavily service: searches web (evidence: `src/research_tools.py`)
- arXiv search → arXiv service: queries papers (evidence: `src/research_tools.py`)
- arXiv search → PDF extraction: extracts full text (evidence: `src/research_tools.py`)
- PDF extraction → PDF hosts: fetches PDFs (evidence: `src/research_tools.py`)
- Wikipedia search → Wikipedia service: searches pages (evidence: `src/research_tools.py`)
