Spaces:
Sleeping
π Discover Agent
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.
π Project Overview
This project creates a Discover Agent that:
- Accepts natural language queries via a web UI,
- Uses DeepSeek-R1 LLaMA 70B Distill (hosted on Groq) as the reasoning LLM,
- Employs tools such as:
- DuckDuckGo Search for real-time web lookup,
- Datetime tool to fetch current date/time if needed,
- Routes the conversation intelligently via LangGraph,
- Displays real-time, concise answers.
β¨ Features
- π Real-time Web Search (DuckDuckGo)
- π Current Date & Time Tool
- π§ deepseek-r1-distill-llama-70b via Groq for planning and response generation
- π§± LangGraph Agent with tool invocation and conditional logic
- π Stateful and flexible architecture
- π₯οΈ Streamlit-based user interface
- β‘ FastAPI backend
π§ What is an AI Agent?
An AI Agent is a self-directed system that:
- Interprets complex input (e.g., human questions),
- Perceives its environment (e.g., user queries and tools),
- Decides what actions (e.g., tools to use) to take independently,
- Acts autonomously (e.g., fetches and processes information),
- And adapts based on feedback or reasoning loops.
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.
π LangGraph vs. LangChain: Why LangGraph?
| Feature | LangGraph | LangChain (Core) |
|---|---|---|
| Execution Model | Graph-based execution | Linear or chain-of-tools |
| Tool Decision Logic | Built-in conditional routing (agents) | Requires manual logic or chains |
| State Persistence | Explicit state tracking | Implicit through variables |
| Flexibility | Better for multi-step, dynamic logic | Suitable for simple tool chains |
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.
π§ Discover Agent vs. Discover (Workflow)
Here is a link to the previous version "Discover" for your reference
| Feature | Discover Agent (LangGraph) | Discover Workflow (Earlier Version) |
|---|---|---|
| Tool Decision | Dynamic & Conditional | Predefined Steps |
| Extensibility | Easy to plug in new tools / logic | Hardcoded path |
| Autonomy | Agent decides next step | Linear, no adaptive logic |
| Complexity Handling | Better for multi-turn or tool-heavy tasks | Suitable for simple single-step tasks |
| Maintenance | Modular and easier to extend | Less flexible, more code change needed |
Drawbacks of agent-based approach:
- Slightly more overhead to set up initially
- Graph logic can be overkill for very simple tasks
βοΈ Installation
1. Clone the repository
git clone https://github.com/harshith-77/discover-agent.git
cd discover-agent
2. Install dependencies
pip install -r requirements.txt
3. Set up environment variables
Create a .env file with:
GEMINI_API_KEY=your_google_genai_key
βΆοΈ Run the App
Start the FastAPI backend:
python main.py
Launch the Streamlit UI:
streamlit run main_ui.py
π§° Tech Stack
| Layer | Technology |
|---|---|
| LLM | DeepSeek-R1 LLaMA 70B Distill via Groq API |
| Agent | LangGraph |
| Tool | DuckDuckGoSearchRun, Custom Datetime Tool |
| UI | Streamlit |
| Backend | FastAPI + Uvicorn |
| Env Manager | python-dotenv |
π File Structure
βββ main.py # FastAPI backend
βββ main_ui.py # Streamlit UI
βββ helper.py # Agent logic with LangGraph
βββ .env # API keys (not checked into git)
βββ requirements.txt # Python dependencies
π£ Example Usage
- Open the Streamlit app.
- Type a query like: "Who won the IPL 2025 final?"
- The agent provides a concise response to the query by fetching from web if needed.
π License
MIT License
