harshith-7 commited on
Commit
6a0806d
Β·
verified Β·
1 Parent(s): be0aabb

Upload ReadMe.md

Browse files
Files changed (1) hide show
  1. ReadMe.md +146 -0
ReadMe.md ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸ”Ž Discover Agent
2
+
3
+ Discover Agent is an AI-powered web search application that utilizes **LangGraph Agents**, **DuckDuckGo** search, and Groq-hosted **DeepSeek-R1 Distill LLaMA 70B** to dynamically fetch and synthesize information. Unlike traditional workflows, this project dynamically decides when, how and whether to use tools during execution, showcasing the power of autonomous **AI agents** in navigating uncertain tasks.
4
+
5
+ ![img.png](img.png)
6
+
7
+ ---
8
+
9
+ ## πŸš€ Project Overview
10
+
11
+ This project creates a **Discover Agent** that:
12
+
13
+ * Accepts natural language queries via a web UI,
14
+ * Uses DeepSeek-R1 LLaMA 70B Distill (hosted on Groq) as the reasoning LLM,
15
+ * Employs tools such as:
16
+ * DuckDuckGo Search for real-time web lookup,
17
+ * Datetime tool to fetch current date/time if needed,
18
+ * Routes the conversation intelligently via LangGraph,
19
+ * Displays real-time, concise answers.
20
+
21
+ ## ✨ Features
22
+
23
+ * 🌐 Real-time Web Search (DuckDuckGo)
24
+ * πŸ•“ Current Date & Time Tool
25
+ * 🧭 deepseek-r1-distill-llama-70b via Groq for planning and response generation
26
+ * 🧱 LangGraph Agent with tool invocation and conditional logic
27
+ * πŸ”„ Stateful and flexible architecture
28
+ * πŸ–₯️ Streamlit-based user interface
29
+ * ⚑ FastAPI backend
30
+
31
+ ---
32
+
33
+ ## 🧠 What is an AI Agent?
34
+
35
+ An **AI Agent** is a self-directed system that:
36
+
37
+ * Interprets complex input (e.g., human questions),
38
+ * Perceives its environment (e.g., user queries and tools),
39
+ * Decides what actions (e.g., tools to use) to take independently,
40
+ * Acts autonomously (e.g., fetches and processes information),
41
+ * And adapts based on feedback or reasoning loops.
42
+
43
+ LangGraph provides a framework to build these agents with dynamic, branching logic and persistent memory, surpassing traditional workflows. LangGraph agents go beyond static workflows by supporting conditional branching, autonomous tool use decisions, and persistent state handling.
44
+
45
+ ## πŸ”„ LangGraph vs. LangChain: Why LangGraph?
46
+
47
+ | Feature | LangGraph | LangChain (Core) |
48
+ | ------------------- | ---------------------------------------- | ----------------------------------- |
49
+ | Execution Model | **Graph-based execution** | Linear or chain-of-tools |
50
+ | Tool Decision Logic | Built-in conditional routing (agents) | Requires manual logic or chains |
51
+ | State Persistence | **Explicit state tracking** | Implicit through variables |
52
+ | Flexibility | Better for **multi-step, dynamic logic** | Suitable for **simple tool chains** |
53
+
54
+ **LangGraph** is ideal when you need an agent that decides *when* to use a tool and *how* to proceed after tool outputβ€”like in this project.
55
+
56
+ ## 🧠 Discover Agent vs. Discover (Workflow)
57
+
58
+ Here is a [link](https://github.com/harshith-77/discover) to the previous version "Discover" for your reference
59
+
60
+ | Feature | Discover Agent (LangGraph) | Discover Workflow (Earlier Version) |
61
+ | ------------------- | ----------------------------------------- | -------------------------------------- |
62
+ | Tool Decision | Dynamic & Conditional | Predefined Steps |
63
+ | Extensibility | Easy to plug in new tools / logic | Hardcoded path |
64
+ | Autonomy | Agent decides next step | Linear, no adaptive logic |
65
+ | Complexity Handling | Better for multi-turn or tool-heavy tasks | Suitable for simple single-step tasks |
66
+ | Maintenance | Modular and easier to extend | Less flexible, more code change needed |
67
+
68
+ **Drawbacks of agent-based approach:**
69
+
70
+ * Slightly more overhead to set up initially
71
+ * Graph logic can be overkill for very simple tasks
72
+
73
+ ---
74
+
75
+ ## βš™οΈ Installation
76
+
77
+ ### 1. Clone the repository
78
+
79
+ ```bash
80
+ git clone https://github.com/harshith-77/discover-agent.git
81
+ cd discover-agent
82
+ ```
83
+
84
+ ### 2. Install dependencies
85
+
86
+ ```bash
87
+ pip install -r requirements.txt
88
+ ```
89
+
90
+ ### 3. Set up environment variables
91
+
92
+ Create a `.env` file with:
93
+
94
+ ```
95
+ GEMINI_API_KEY=your_google_genai_key
96
+ ```
97
+
98
+ ## ▢️ Run the App
99
+
100
+ ### Start the FastAPI backend:
101
+
102
+ ```bash
103
+ python main.py
104
+ ```
105
+
106
+ ### Launch the Streamlit UI:
107
+
108
+ ```bash
109
+ streamlit run main_ui.py
110
+ ```
111
+
112
+ ## 🧰 Tech Stack
113
+
114
+ | Layer | Technology |
115
+ | ----------- |--------------------------------------------|
116
+ | LLM | DeepSeek-R1 LLaMA 70B Distill via Groq API |
117
+ | Agent | LangGraph |
118
+ | Tool | DuckDuckGoSearchRun, Custom Datetime Tool |
119
+ | UI | Streamlit |
120
+ | Backend | FastAPI + Uvicorn |
121
+ | Env Manager | python-dotenv |
122
+
123
+ ---
124
+
125
+ ## πŸ“ File Structure
126
+
127
+ ```
128
+ β”œβ”€β”€ main.py # FastAPI backend
129
+ β”œβ”€β”€ main_ui.py # Streamlit UI
130
+ β”œβ”€β”€ helper.py # Agent logic with LangGraph
131
+ β”œβ”€β”€ .env # API keys (not checked into git)
132
+ β”œβ”€β”€ requirements.txt # Python dependencies
133
+ ```
134
+
135
+ ## πŸ—£ Example Usage
136
+
137
+ 1. Open the Streamlit app.
138
+ 2. Type a query like:
139
+ **"Who won the IPL 2025 final?"**
140
+ 3. The agent provides a concise response to the query by fetching from web if needed.
141
+
142
+ ---
143
+
144
+ ## πŸ“œ License
145
+
146
+ MIT License