NaderAfshar commited on
Commit
43aecb1
·
1 Parent(s): 664e9ba

Updated the README file

Browse files
Files changed (1) hide show
  1. README.md +64 -28
README.md CHANGED
@@ -13,41 +13,77 @@ short_description: Report Writing Agent by Nader Afshar
13
 
14
  # Research-Driven Report Writing Agent
15
 
16
- ## Description
17
 
18
- This LangGraph-based agent is designed to generate well-researched, multi-draft reports based on a user-provided topic. Unlike typical language models that rely solely on their inherent knowledge, this agent leverages a research component to gather external information, aiming for more comprehensive and accurate essays. LangGraph is a framework for building stateful, multi-agent applications. It is designed to build, deploy and manage complex generative AI agent workflows.
19
 
20
- ## Key Features
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- * **Autonomous Research:** The agent actively formulates search queries and retrieves information from external sources to supplement its writing process. This ensures that the generated essays are grounded in factual data and diverse perspectives.
23
- * **Iterative Drafting and Critique:** The agent follows a structured workflow of planning, drafting, self-critiquing, and revising the essay. This iterative process, driven by the LangGraph framework, leads to progressively refined outputs.
24
- * **Multi-Source Integration:** The agent synthesizes information from multiple research sources, enriching the report with a broader range of content.
25
- * **Structured Output Logging:** The agent provides detailed logs of its internal processes, including planning steps, search queries, retrieved information, drafts, and critiques. This transparency allows users to understand the agent's reasoning and research methodology.
26
- * **Customizable Revisions:** Users can control the number of report revisions, enabling a trade-off between generation speed and essay quality.
27
 
28
- ## Workflow
29
 
30
- 1. **Planning:** The agent creates a high-level outline of the report based on the user's topic.
31
- 2. **Research (Planning):** The agent formulates search queries to gather relevant information for the initial report draft.
32
- 3. **Drafting:** The agent generates the first draft of the report, incorporating the research findings and the initial outline.
33
- 4. **Critique:** The agent self-evaluates the report, identifying areas for improvement.
34
- 5. **Research (Critique):** The agent formulates new search queries to gather information that can aid in revising the essay based on the critique.
35
- 6. **Revision:** The agent revises the report based on the critique and the newly acquired information.
36
- 7. Steps 3-6 repeat for a specified number of revisions.
37
 
38
- ## Expected Behavior & Usage Notes
39
 
40
- * **Initial Delay:** Due to the research component, expect an initial delay (can vary, but typically within 30 seconds to a minute) before the agent begins generating output. This is the time taken for the agent to formulate and execute its initial search queries.
41
- * **Streaming Output:** The agent provides a streaming output of its process log, allowing you to observe the planning, research, and drafting stages in real-time.
42
- * **Gradual Refinement:** The report draft will evolve over time as the agent performs multiple research and revision cycles. The final draft is presented after all the revision steps are completed.
43
- * **Resource Intensive:** The research-driven approach can be more time-consuming than simple LLM text generation. The overall generation time depends on the complexity of the topic and the number of revisions.
44
- * **Dependencies:** Ensure you have the necessary API keys (Cohere, Tavily) and Python libraries installed as specified in the code.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
- ## How to Run
47
 
48
- 1. Provide a research or an report topic in the input field.
49
- 2. Specify the desired number of revisions.
50
- 3. Click the "Generate Report" button.
51
- 4. Observe the agent's progress in the "Agent Process Log" and the final report in the "Final Report Draft" box.
52
 
53
- This agent aims to produce higher-quality, more informative reports by integrating external research into the generation process. Please be patient during the generation process, as the research and revision steps contribute to a more thorough and refined final output.
 
 
13
 
14
  # Research-Driven Report Writing Agent
15
 
16
+ # 🔎 Research Agent
17
 
18
+ 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.
19
 
20
+ ---
21
+
22
+ ## 🧠 What Sets It Apart?
23
+
24
+ Unlike typical AI content generators, this agent performs **real-time research** to ensure that reports are grounded in current, verifiable information.
25
+
26
+ ### ✨ Highlights:
27
+ - Uses **Cohere’s `command-a-03-2025` LLM** for language generation, outlining, and critique.
28
+ - Uses **Tavily** to perform real-time, internet-based research (not just LLM memory).
29
+ - Produces **structured, refined research reports**, not informal essays or chatbot replies.
30
+ - Streams its **research and reasoning process** live so users can follow along.
31
+
32
+ ---
33
+
34
+ ## 🧩 How It Works
35
+
36
+ 1. **User provides a topic or research question** through the UI.
37
+ 2. The agent:
38
+ - **Plans** the structure of the research.
39
+ - **Conducts multiple web searches** via Tavily.
40
+ - **Drafts a full report** using retrieved content and context.
41
+ - **Critiques** and **revises** the report internally.
42
+ 3. The output includes:
43
+ - A live, streaming **log of the research process**.
44
+ - A clean, **final research report** as a separate result.
45
+
46
+ ---
47
 
48
+ ## Why It Takes Time
 
 
 
 
49
 
50
+ The Research Agent behaves more like a human researcher than a chatbot:
51
 
52
+ - It may take **~30 seconds before the first visible output**, while:
53
+ - Querying the web.
54
+ - Organizing thoughts.
55
+ - Planning the structure.
56
+ - It takes **1–2 minutes or more** to complete a full research and writing cycle with critique + revision.
 
 
57
 
58
+ 🧠 **This is intentional**: speed is traded for depth, accuracy, and reasoning.
59
 
60
+ ---
61
+
62
+ ## 🖥 Interface
63
+
64
+ Built with **Gradio**, the app includes:
65
+
66
+ - A **textbox** for entering a topic or question.
67
+ - A **streaming log** of research, planning, and revision steps.
68
+ - A **final output panel** for the completed research report.
69
+
70
+ ---
71
+
72
+ ## 🛠️ Technologies Used
73
+
74
+ | Component | Purpose |
75
+ |----------------|------------------------------------------|
76
+ | LangGraph | Agent state machine + step logic |
77
+ | Cohere LLM | `command-a-03-2025` model for text tasks |
78
+ | Tavily Search | Real-time research via web search |
79
+ | LangChain Core | Messaging and prompt orchestration |
80
+ | Gradio | Interactive web interface |
81
+
82
+ ---
83
 
84
+ ## 🚀 Getting Started
85
 
86
+ 1. Install dependencies:
 
 
 
87
 
88
+ ```bash
89
+ pip install -r requirements.txt