A Python library and runnable Jupyter textbook implementing 35 agentic AI architectures, from Reflexion and ReAct to MemGPT and BrowserAgent, on LangGraph.
Moh4696/build-ai-agents-free
A free, step-by-step tutorial for building a Python AI agent with LangChain and LangGraph using free-tier Groq and Gemini models.
- Stars
- 369
- Forks
- 115
- Open issues
- 2
- Last commit
- 3 months ago
What is it?
This is a beginner tutorial for building an AI agent in Python without paying for any API. It walks through the plan, act, observe loop that separates an agent from a plain chatbot, and shows how to run that loop on LangChain's create_agent with Groq's free Llama 3.3 70B model.
The guide builds up in steps. It starts with a minimal agent, then adds a prebuilt DuckDuckGo web search tool and a custom word_count tool defined with the @tool decorator. Next it adds conversation memory through an InMemorySaver checkpointer and thread_id, and finally a fallback that switches from Groq to Google Gemini when the primary provider fails. Each step has a matching script in the repository's src folder, and a combined agent.py ties everything together.
The tutorial is aimed at readers with no prior agent experience who want to avoid paid keys. It also notes limits of the free setup, such as rate limits on the search tool, memory that is lost when the script stops, and free-tier providers that may use prompts for training.
Key features
- 01Builds a working agent with LangChain's create_agent and Groq's free Llama 3.3 70B model.
- 02Adds a DuckDuckGo web search tool that requires no API key.
- 03Shows how to turn any Python function into a tool with the @tool decorator.
- 04Adds multi-turn memory using an InMemorySaver checkpointer and thread_id.
- 05Demonstrates provider fallback from Groq to Google Gemini on failure.
- 06Includes a runnable script for each step plus a combined agent.py.
Use cases
- Learning the plan, act, observe loop of AI agents from scratch.
- Prototyping a tool-using agent without a paid API key.
- Teaching a beginner workshop on LangChain and LangGraph basics.
- Building a side project that needs a fallback when one free provider is unavailable.
Quick start
- 1
Check that Python 3.10 or newer is installed
python3 --version - 2
Create and enter a project folder
mkdir my-agent cd my-agent - 3
Install langchain with the groq connector and python-dotenv
pip install -U "langchain[groq]" python-dotenv - 4
Get a free Groq API key from console.groq.com and save it in a .env file, then run the first agent script
python3 agent.py
Things to know
- The free model tiers change without warning and most providers may train on your prompts, so keep sensitive data off them.
- The DuckDuckGo search tool rate-limits heavy use and can fail intermittently.
- InMemorySaver keeps conversation memory only in RAM, so it is lost when the script stops.
Topics
FAQ
- What is build-ai-agents-free?
- A free, step-by-step tutorial for building a Python AI agent with LangChain and LangGraph using free-tier Groq and Gemini models. This is a beginner tutorial for building an AI agent in Python without paying for any API. It walks through the plan, act, observe loop that separates an agent from a plain chatbot, and shows how to run that loop on LangChain's create_agent with Groq's free Llama 3.3 70B model.
- Is build-ai-agents-free free to use? What license does it have?
- build-ai-agents-free is open source under the MIT license. Check the license terms before using it in commercial products.
- Is build-ai-agents-free still maintained?
- Updated within 6 months. The last commit to build-ai-agents-free was on Jul 8, 2026.
- What can I use build-ai-agents-free for?
- Learning the plan, act, observe loop of AI agents from scratch. Prototyping a tool-using agent without a paid API key. Teaching a beginner workshop on LangChain and LangGraph basics. Building a side project that needs a fallback when one free provider is unavailable.
- How do I install build-ai-agents-free?
- Check that Python 3.10 or newer is installed: python3 --version Create and enter a project folder: mkdir my-agent cd my-agent Install langchain with the groq connector and python-dotenv: pip install -U "langchain[groq]" python-dotenv Get a free Groq API key from console.groq.com and save it in a .env file, then run the first agent script: python3 agent.py
- Where can I get build-ai-agents-free?
- The source code and installation instructions are on GitHub: https://github.com/Moh4696/build-ai-agents-free
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A free, MIT-licensed course of 542 lessons that builds AI engineering concepts from scratch in Python, TypeScript, Rust and Julia.
A hands-on tutorial that teaches AI agent building from scratch with local LLMs via node-llama-cpp, covering function calling, memory and ReAct.
A low-level Python framework for building stateful, long-running agents with durable execution, human-in-the-loop and memory.
TypeScript and Python SDK giving AI agents 1000+ pre-authenticated app toolkits, per-user sessions, and a sandbox to take actions.
An opinionated, batteries-included agent harness for Python that runs long multi-step tasks out of the box on LangGraph.