An AI-powered chatbot with agentic web search capabilities, built with Node.js, Express, and the Groq API.
- Conversational AI powered by LLM (Groq API)
- Agentic tool use — the model autonomously decides when to search the web for real-time information
- Per-thread conversation history with 24-hour caching
- Web frontend with a clean dark UI
- Command-line interface for terminal-based chat
| Layer | Technology |
|---|---|
| Runtime | Node.js (ES Modules) |
| Backend | Express.js |
| LLM | Groq API ("openai/gpt-oss-20b") |
| Web Search | Tavily API |
| Caching | node-cache (24h TTL) |
| Frontend | Vanilla HTML/CSS/JS + Tailwind CSS |
- Node.js v18+
- pnpm package manager
- A Groq API key
- A Tavily API key
-
Install dependencies
cd backend pnpm install -
Configure environment variables
cp .env.example .env
Edit
.envand add your API keys:GROQ_API_KEY=your_groq_api_key TAVILY_API_KEY=your_tavily_api_key -
Run the web server
pnpm dev
The server starts on
http://localhost:3001. -
Open the frontend
Open
frontend/index.htmlin your browser.
Run the chatbot directly in the terminal:
pnpm cliType your message and press Enter. Type bye to exit.
chatllm/
├── backend/
│ ├── src/
│ │ ├── server.js # Express HTTP server
│ │ ├── chatbot.js # Core agentic chatbot logic
│ │ └── commandline-chatllm.js # CLI chat interface
│ ├── .env.example # Environment variable template
│ └── package.json
├── frontend/
│ ├── index.html # Chat UI
│ └── script.js # Client-side logic
└── README.md
- User sends a message via the web UI or CLI
- The backend forwards the message to the Groq LLM with a system prompt and a
webSearchtool definition - If the model determines it needs real-time information, it calls the
webSearchtool - The backend executes the search via the Tavily API and returns results to the model
- The model synthesizes an answer and sends it back to the user
- Conversation history is cached per thread for context continuity