# vaibhavv-labs/ai-research-agent architecture

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

- Interactive diagram: https://gitdiagram.com/vaibhavv-labs/ai-research-agent
- Repository: https://github.com/vaibhavv-labs/ai-research-agent

## Overview

AI Research Agent is a small command-line research application. A user supplies a topic; the agent prompts Groq, follows SEARCH instructions by querying DuckDuckGo, feeds observations back into the reasoning loop, and displays a final Markdown report in the terminal. The graph separates orchestration, live search, and report presentation while keeping their shared implementation path. The README documents the ReAct workflow; the source excerpt confirms the calls and loop. There is no separate persistence layer or web-scraping subsystem shown.

Main entry points: [`research_agent.py`](https://github.com/vaibhavv-labs/ai-research-agent/blob/main/research_agent.py) (Research agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Research workflow"]
  node_cli["Topic input<br/>[research_agent.py]"]
  node_agent["Research agent<br/>[research_agent.py]"]
  node_groq{{"Groq LLM"}}
end

subgraph group_search["Live web search"]
  node_search_fn["Search function<br/>[research_agent.py]"]
  node_ddg{{"DuckDuckGo Search"}}
end

subgraph group_presentation["Terminal presentation"]
  node_report["Report rendering<br/>[research_agent.py]"]
  node_terminal(("Terminal output"))
end

node_user(("Research user"))

node_user -->|"enters topic"| node_cli
node_cli -->|"starts agent"| node_agent
node_agent -->|"requests completion"| node_groq
node_groq -->|"returns response"| node_agent
node_agent -->|"searches query"| node_search_fn
node_search_fn -->|"queries web"| node_ddg
node_search_fn -->|"returns results"| node_agent
node_agent -->|"renders report"| node_report
node_report -->|"prints report"| node_terminal

click node_cli "https://github.com/vaibhavv-labs/ai-research-agent/blob/main/research_agent.py"
click node_agent "https://github.com/vaibhavv-labs/ai-research-agent/blob/main/research_agent.py"
click node_search_fn "https://github.com/vaibhavv-labs/ai-research-agent/blob/main/research_agent.py"
click node_report "https://github.com/vaibhavv-labs/ai-research-agent/blob/main/research_agent.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_cli,node_agent,node_groq,node_user toneBlue
class node_search_fn,node_ddg toneAmber
class node_report,node_terminal toneMint
```

## Components

### Research workflow

- [Topic input](https://github.com/vaibhavv-labs/ai-research-agent/blob/main/research_agent.py): `research_agent.py`
- [Research agent](https://github.com/vaibhavv-labs/ai-research-agent/blob/main/research_agent.py): `research_agent.py`
- **Groq LLM**

### Live web search

- [Search function](https://github.com/vaibhavv-labs/ai-research-agent/blob/main/research_agent.py): `research_agent.py`
- **DuckDuckGo Search**

### Terminal presentation

- [Report rendering](https://github.com/vaibhavv-labs/ai-research-agent/blob/main/research_agent.py): `research_agent.py`
- **Terminal output**

### Other components

- **Research user**

## Connections

- Research user → Topic input: enters topic (evidence: `README.md`)
- Topic input → Research agent: starts agent (evidence: `research_agent.py`)
- Research agent → Groq LLM: requests completion (evidence: `research_agent.py`)
- Groq LLM → Research agent: returns response (evidence: `research_agent.py`)
- Research agent → Search function: searches query (evidence: `research_agent.py`)
- Search function → DuckDuckGo Search: queries web (evidence: `research_agent.py`)
- Search function → Research agent: returns results (evidence: `research_agent.py`)
- Research agent → Report rendering: renders report (evidence: `research_agent.py`)
- Report rendering → Terminal output: prints report (evidence: `research_agent.py`)
