# abhipal76/autonomous_research_agent architecture

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

- Interactive diagram: https://gitdiagram.com/abhipal76/autonomous_research_agent
- Repository: https://github.com/abhipal76/autonomous_research_agent

## Overview

This is a single-file Streamlit research assistant. A user submits a question through the chat UI; the agent executor coordinates Gemini reasoning with live search and optional page scraping, then the UI cleans and displays the response while retaining chat messages in session state. The README also highlights source citations, which the prompt directs the agent to include. All implementation paths are main.py; the graph reflects the sampled source and documented capabilities.

Main entry points: [`main.py`](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py) (Streamlit chat UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Chat interface"]
  node_chat_ui["Streamlit chat UI<br/>[main.py]"]
  node_chat_state[("Chat history<br/>[main.py]")]
end

subgraph group_research["Research workflow"]
  node_executor["Agent executor<br/>[main.py]"]
  node_agent["Tool-calling agent<br/>[main.py]"]
  node_prompt["Research prompt<br/>[main.py]"]
  node_gemini["Gemini model<br/>[main.py]"]
end

subgraph group_sources["Web sources"]
  node_search_tool["Web search tool<br/>[main.py]"]
  node_duckduckgo(("DuckDuckGo"))
  node_scrape_tool["Page scraper<br/>[main.py]"]
  node_web_loader["WebBaseLoader<br/>[main.py]"]
  node_websites(("Web pages"))
end

subgraph group_results["Response handling"]
  node_cleaner["Output cleaner<br/>[main.py]"]
  node_report["Cited report<br/>[main.py]"]
end

node_user(("Research user"))

node_user -->|"submits query"| node_chat_ui
node_chat_ui -->|"invokes research"| node_executor
node_chat_ui -->|"reads and writes"| node_chat_state
node_executor -->|"runs agent"| node_agent
node_agent -->|"uses instructions"| node_prompt
node_agent -->|"requests reasoning"| node_gemini
node_executor -->|"dispatches search"| node_search_tool
node_search_tool -->|"searches web"| node_duckduckgo
node_executor -->|"dispatches scraping"| node_scrape_tool
node_scrape_tool -->|"loads page"| node_web_loader
node_web_loader -->|"fetches content"| node_websites
node_executor -->|"returns response"| node_chat_ui
node_chat_ui -->|"cleans output"| node_cleaner
node_cleaner -->|"produces text"| node_report
node_chat_ui -->|"displays report"| node_user

click node_chat_ui "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_chat_state "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_executor "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_agent "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_prompt "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_gemini "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_search_tool "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_scrape_tool "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_web_loader "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_cleaner "https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py"
click node_report "https://github.com/abhipal76/autonomous_research_agent/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_chat_ui,node_chat_state,node_user toneBlue
class node_executor,node_agent,node_prompt,node_gemini toneAmber
class node_search_tool,node_duckduckgo,node_scrape_tool,node_web_loader,node_websites toneMint
class node_cleaner,node_report toneRose
```

## Components

### Chat interface

- [Streamlit chat UI](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`
- [Chat history](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`

### Research workflow

- [Agent executor](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`
- [Tool-calling agent](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`
- [Research prompt](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`
- [Gemini model](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`

### Web sources

- [Web search tool](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`
- **DuckDuckGo**
- [Page scraper](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`
- [WebBaseLoader](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`
- **Web pages**

### Response handling

- [Output cleaner](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`
- [Cited report](https://github.com/abhipal76/autonomous_research_agent/blob/main/main.py): `main.py`

### Other components

- **Research user**

## Connections

- Research user → Streamlit chat UI: submits query
- Streamlit chat UI → Agent executor: invokes research
- Streamlit chat UI → Chat history: reads and writes
- Agent executor → Tool-calling agent: runs agent
- Tool-calling agent → Research prompt: uses instructions
- Tool-calling agent → Gemini model: requests reasoning
- Agent executor → Web search tool: dispatches search
- Web search tool → DuckDuckGo: searches web
- Agent executor → Page scraper: dispatches scraping
- Page scraper → WebBaseLoader: loads page
- WebBaseLoader → Web pages: fetches content
- Agent executor → Streamlit chat UI: returns response
- Streamlit chat UI → Output cleaner: cleans output
- Output cleaner → Cited report: produces text
- Streamlit chat UI → Research user: displays report
