Skip to content

Latest commit

Β 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Python Groq Llama LangChain AI Agents DuckDuckGo BeautifulSoup Markdown

πŸ” AI Research Assistant

An AI-powered Research Assistant built using Groq API, Llama 3.3, and LangChain that autonomously researches topics by searching the web, reading webpages, and generating structured research reports using tool-calling AI agents.

Instead of answering solely from the LLM's knowledge, the agent dynamically decides when to use external tools, retrieves up-to-date information from the web, and synthesizes information into professional markdown reports.

This project demonstrates the fundamentals of AI Agents, Tool Calling, LLM Orchestration, Prompt Engineering, and Web-Augmented Generation.


πŸš€ Features

  • πŸ”Ž AI Agent with Tool Calling
  • 🌐 DuckDuckGo Web Search Integration
  • πŸ“„ Automatic Webpage Reading
  • 🧹 HTML Content Extraction using BeautifulSoup
  • πŸ€– Groq + Llama 3.3 Integration
  • 🧠 Prompt Engineering
  • πŸ”„ Multi-Step Agent Reasoning Loop
  • πŸ“‘ Professional Markdown Report Generation
  • πŸ“‚ Automatic Report Saving
  • ⚑ Ultra-fast Inference using Groq
  • πŸ” Secure API Key Management using Environment Variables
  • πŸ—οΈ Modular Production-Style Project Structure

πŸ—οΈ Architecture

                    User Query
                         β”‚
                         β–Ό
                Llama 3.3 (Groq)
                         β”‚
             Determines Required Tool
                         β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό                                  β–Ό
 DuckDuckGo Search Tool             Read Webpage Tool
        β”‚                                  β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β–Ό
                 Tool Execution
                         β”‚
                         β–Ό
                 Tool Observations
                         β”‚
                         β–Ό
              LLM Reasoning Loop
                         β”‚
                         β–Ό
          Professional Research Report
                         β”‚
                         β–Ό
           Markdown File (.md)

πŸ“‚ Project Structure

research-assistant/
β”‚
β”œβ”€β”€ app.py                  # Entry point
β”œβ”€β”€ agent.py                # Agent reasoning loop
β”œβ”€β”€ llm.py                  # Groq model configuration
β”œβ”€β”€ prompts.py              # Prompt templates
β”œβ”€β”€ tools.py                # AI tools
β”‚
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ scraper.py          # Webpage reader
β”‚   └── report.py           # Markdown report generator
β”‚
β”œβ”€β”€ outputs/                # Generated reports
β”‚
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env.example
β”œβ”€β”€ .gitignore
└── README.md

πŸ› οΈ Tech Stack

Component Technology
Language Python
LLM Provider Groq API
Model Llama 3.3 70B Versatile
Framework LangChain
Agent Pattern Tool Calling
Search Engine DuckDuckGo
Web Scraping BeautifulSoup + Requests
Output Markdown Report
Environment Variables python-dotenv

πŸ“¦ Installation

1. Clone Repository

git clone https://github.com/your-username/research-assistant.git

cd research-assistant

2. Create Virtual Environment

python -m venv venv

Windows

venv\Scripts\activate

Linux / Mac

source venv/bin/activate

3. Install Dependencies

pip install -r requirements.txt

πŸ”‘ Environment Setup

Create a .env file.

GROQ_API_KEY=your_groq_api_key

▢️ Run the Project

python app.py

Example:

Research Topic:

AI Agents

The application automatically:

  • Searches the web
  • Reads relevant webpages
  • Extracts useful content
  • Performs multi-step reasoning
  • Generates a professional markdown research report

πŸ’‘ How It Works

  1. User enters a research topic.
  2. The LLM determines whether external knowledge is required.
  3. The AI agent calls the Web Search tool.
  4. Search results are returned.
  5. The AI agent decides which webpages to read.
  6. HTML content is cleaned and converted into plain text.
  7. Tool observations are returned to the LLM.
  8. The reasoning loop continues until sufficient information has been gathered.
  9. The LLM generates a structured research report.
  10. The report is saved as a Markdown file.

🧠 Key Concepts Learned

πŸ€– AI Agents

Building autonomous LLM applications capable of reasoning and interacting with external tools.

πŸ”§ Tool Calling

Allowing LLMs to dynamically decide which tools to invoke during problem solving.

πŸ”„ Agent Reasoning Loop

Implementing iterative reasoning using the cycle:

Think β†’ Tool β†’ Observation β†’ Think β†’ Answer

🌐 Web-Augmented Generation

Combining real-time web search with LLM reasoning to produce current and factual responses.

🧹 HTML Parsing

Extracting clean textual content from webpages using BeautifulSoup.

🧠 Prompt Engineering

Designing prompts that guide the LLM to generate structured, high-quality research reports.

πŸ“‘ Markdown Report Generation

Automatically exporting research findings into reusable Markdown documents.

πŸ—οΈ Modular AI Application Design

Separating the application into independent modules for tools, prompts, agent logic, LLM configuration, and utilities.


πŸš€ Future Improvements

  • 🧠 Multi-Agent Research System
  • πŸ“š Tavily Search Integration
  • πŸ“„ PDF Export
  • πŸ“‘ DOCX Export
  • 🎯 Research Planning Agent
  • 🧠 Memory for Previous Research
  • 🌍 Multi-language Support
  • πŸ“ˆ Research Quality Evaluation
  • ⚑ Streaming Responses
  • ☁️ FastAPI REST API
  • 🐳 Docker Support
  • ☁️ Cloud Deployment (Render / AWS)

⚠️ Limitations

  • Webpages may block scraping.
  • Research quality depends on publicly available information.
  • No persistent memory between sessions.
  • Limited by the LLM context window for very large webpages.

πŸ“š Learning Outcomes

After completing this project, you will understand:

  • AI Agent Architecture
  • Tool Calling
  • LangChain Tools
  • Agent Loops
  • Groq API Integration
  • Web Search Integration
  • Web Scraping
  • Prompt Engineering
  • Markdown Report Generation
  • Modular AI Application Design
  • Production-Ready Project Organization

🀝 Contributing

Contributions are welcome!

Possible improvements:

  • Better planning strategies
  • Additional search providers
  • Improved prompts
  • Better error handling
  • More export formats
  • Memory support
  • Multi-agent workflows

⭐ Acknowledgements

  • Groq for ultra-fast LLM inference
  • Meta for the Llama models
  • LangChain for agent abstractions
  • DuckDuckGo for web search
  • BeautifulSoup for HTML parsing

πŸ‘¨β€πŸ’» Author

Built as a hands-on learning project while exploring Generative AI, AI Agents, Tool Calling, Prompt Engineering, LLM Applications, and Production-Ready AI Systems.

About

AI-powered Research Assistant using Groq, Llama 3.1, LangChain, and Tool Calling to autonomously search the web, read webpages, and generate structured research reports.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages