File size: 2,975 Bytes
bafc0b7
25108f8
bafc0b7
 
 
 
 
 
 
 
25108f8
bafc0b7
 
25108f8
0bfc0d3
43aecb1
0bfc0d3
43aecb1
0bfc0d3
43aecb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0bfc0d3
43aecb1
0bfc0d3
43aecb1
0bfc0d3
43aecb1
 
 
 
 
0bfc0d3
43aecb1
0bfc0d3
43aecb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0bfc0d3
43aecb1
0bfc0d3
43aecb1
0bfc0d3
43aecb1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
title: Report Writer Agent
emoji: ๐Ÿ†
colorFrom: indigo
colorTo: green
sdk: gradio
sdk_version: 5.28.0
app_file: app.py
pinned: false
license: mit
short_description: Report Writing Agent by Nader Afshar
---

# Research-Driven Report Writing Agent

# ๐Ÿ”Ž Research Agent

The **Research Agent** is an autonomous, multi-step research system built using [LangGraph](https://github.com/langchain-ai/langgraph), [Cohere](https://cohere.com), and [Tavily](https://www.tavily.com/). It mimics the behavior of a human research assistant โ€” planning, researching, drafting, critiquing, and revising โ€” to produce high-quality **research reports** on any topic the user provides.

---

## ๐Ÿง  What Sets It Apart?

Unlike typical AI content generators, this agent performs **real-time research** to ensure that reports are grounded in current, verifiable information.

### โœจ Highlights:
- Uses **Cohereโ€™s `command-a-03-2025` LLM** for language generation, outlining, and critique.
- Uses **Tavily** to perform real-time, internet-based research (not just LLM memory).
- Produces **structured, refined research reports**, not informal essays or chatbot replies.
- Streams its **research and reasoning process** live so users can follow along.

---

## ๐Ÿงฉ How It Works

1. **User provides a topic or research question** through the UI.
2. The agent:
   - **Plans** the structure of the research.
   - **Conducts multiple web searches** via Tavily.
   - **Drafts a full report** using retrieved content and context.
   - **Critiques** and **revises** the report internally.
3. The output includes:
   - A live, streaming **log of the research process**.
   - A clean, **final research report** as a separate result.

---

## โณ Why It Takes Time

The Research Agent behaves more like a human researcher than a chatbot:

- It may take **~30 seconds before the first visible output**, while:
  - Querying the web.
  - Organizing thoughts.
  - Planning the structure.
- It takes **1โ€“2 minutes or more** to complete a full research and writing cycle with critique + revision.

๐Ÿง  **This is intentional**: speed is traded for depth, accuracy, and reasoning.

---

## ๐Ÿ–ฅ Interface

Built with **Gradio**, the app includes:

- A **textbox** for entering a topic or question.
- A **streaming log** of research, planning, and revision steps.
- A **final output panel** for the completed research report.

---

## ๐Ÿ› ๏ธ Technologies Used

| Component      | Purpose                                  |
|----------------|------------------------------------------|
| LangGraph      | Agent state machine + step logic         |
| Cohere LLM     | `command-a-03-2025` model for text tasks |
| Tavily Search  | Real-time research via web search        |
| LangChain Core | Messaging and prompt orchestration       |
| Gradio         | Interactive web interface                |

---

## ๐Ÿš€ Getting Started

1. Install dependencies:

   ```bash
   pip install -r requirements.txt