This repo provides a Python-based guide to building a free AI agent using LangChain and GROQ, including optional tools, memory, and fallback configurations. It contains example code snippets and setup steps.
What it is
A Python-supported guide and reference implementation for building an AI agent that can think, act via tools, and optionally remember or fallback between providers, all using free tiers.
How it works
The repository demonstrates an agent loop consisting of plan, act, and observe steps via LangChain and a GROQ-backed brain. It shows creating an agent with tools (e.g., web search, user-defined functions), a memory option via InMemorySaver, and a fallback mechanism to Gemini if GROQ is unavailable. It includes code examples for loading environment keys, initializing the brain, and running the agent loop.
Getting started
a. python. if you don't have it, get python 3.10 or newer from Python.org. to check what you've got, open a terminal and run (anything 3.10+ works):
python3 --version
b. make a project folder.
mkdir my-agent
cd my-agent
c. install langchain + groq. one line:
pip install -U "langchain[groq]" python-dotenv
d. grab your free groq key. go to console.groq.com, sign in, and open the API Keys tab. click create, copy the key. no card, no trial clock — it's free to start.
e. make your .env file. this is where the key lives — a plain text file named exactly .env:
# mac / linux
touch .env
# windows
type nul > .env
paste your key:
GROQ_API_KEY=your_key_here
never share this file, and never commit it to github.
f. run the first agent script.
python3 agent.py
Recent releases
- none
Traction
153 stars, 39 forks, 0 open issues
