Repository

groq-agent

AI Agent powered by Groq, LangChain & LangGraph with web search and Hebrew RTL support

Command
Description
quit , exit , q
Exit the agent
Any question
Get an AI-powered response
Questions with "search", "who is", "what is", etc.
Triggers web search

Specs

  • CommandDescription
  • quit , exit , qExit the agent
  • Any questionGet an AI-powered response
  • Questions with "search", "who is", "what is", etc.Triggers web search
  • ModelContext
  • llama-3.3-70b-versatile128k
  • llama-3.1-8b-instant128k
  • mixtral-8x7b-3276832k

README

🚀 YUV.AI Agent Demo

A conversational AI agent powered by Groq's ultra-fast inference with LangChain and LangGraph.

Python
License
Groq

██╗   ██╗██╗   ██╗██╗   ██╗   █████╗ ██╗
╚██╗ ██╔╝██║   ██║██║   ██║  ██╔══██╗██║
 ╚████╔╝ ██║   ██║██║   ██║  ███████║██║
  ╚██╔╝  ██║   ██║╚██╗ ██╔╝  ██╔══██║██║
   ██║   ╚██████╔╝ ╚████╔╝ ██╗██║  ██║██║
   ╚═╝    ╚═════╝   ╚═══╝  ╚═╝╚═╝  ╚═╝╚═╝
        ═══ Agent Demo ═══

✨ Features

  • 🔥 Ultra-fast responses - Powered by Groq's LPU inference
  • 🔍 Web search - Real-time DuckDuckGo search integration
  • 🌐 Hebrew support - Full RTL language support with proper display
  • 📊 LangSmith tracing - Optional observability and debugging
  • 🎨 Beautiful CLI - Colored terminal output with token usage display
  • 📚 Source citations - Shows references for grounded answers

🛠️ Installation

Prerequisites

Setup

  1. Clone the repository

    git clone https://github.com/hoodini/groq-agent.git
    cd groq-agent
  2. Create virtual environment

    python -m venv .venv
    
    # Windows
    .venv\Scripts\activate
    
    # macOS/Linux
    source .venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment variables

    cp .env.example .env

    Edit .env and add your API keys:

    GROQ_API_KEY=your_groq_api_key_here
    LANGSMITH_API_KEY=your_langsmith_api_key_here  # optional
    LANGSMITH_TRACING=true
    LANGSMITH_PROJECT=groq-agent

🚀 Usage

Run the agent:

python agent.py

Example Interactions

You: What is the latest news about AI?
🔍 Searching: latest news about AI
⏳ Thinking...

Agent: Based on my search, here are the latest AI developments...
(1523 in → 156 out)

📚 Sources:
   1. TechCrunch - AI News...
      https://techcrunch.com/ai

Commands

Command Description
quit, exit, q Exit the agent
Any question Get an AI-powered response
Questions with "search", "who is", "what is", etc. Triggers web search

🏗️ Architecture

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│   User Input    │────▶│   LangGraph     │────▶│   Groq LLM      │
│   (CLI)         │     │   StateGraph    │     │   (llama-3.3)   │
└─────────────────┘     └────────┬────────┘     └─────────────────┘
                                 │
                                 ▼
                        ┌─────────────────┐
                        │   DuckDuckGo    │
                        │   Web Search    │
                        └─────────────────┘

Key Components

  • LangChain - LLM orchestration framework
  • LangGraph - Stateful agent workflow management
  • Groq - Ultra-fast LLM inference (llama-3.3-70b-versatile)
  • DuckDuckGo - Free web search API
  • LangSmith - Observability and tracing (optional)

📁 Project Structure

groq-agent/
├── agent.py          # Main agent code
├── requirements.txt  # Python dependencies
├── .env.example      # Environment variables template
├── .gitignore        # Git ignore rules
└── README.md         # This file

🔧 Configuration

Model Selection

You can change the model in agent.py:

MODEL = "llama-3.3-70b-versatile"  # Default - fast and capable
# MODEL = "llama-3.1-8b-instant"   # Faster, smaller
# MODEL = "mixtral-8x7b-32768"     # Alternative option

Available Groq Models

Model Context Best For
llama-3.3-70b-versatile 128k General purpose
llama-3.1-8b-instant 128k Fast responses
mixtral-8x7b-32768 32k Complex reasoning

🌍 Language Support

The agent supports:

  • English - Full support with web search
  • Hebrew - Full RTL support with automatic text direction
  • Other languages - Basic support (web search may vary)

📊 LangSmith Integration

When enabled, you can view:

  • Full conversation traces
  • Tool calls and results
  • Token usage metrics
  • Response latencies

Visit smith.langchain.com to view your traces.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments


Made with ❤️ by YUV.AI