Installation and setup
LangGraph installs from PyPI with pip. You need three packages: langgraph runs your graphs, langchain provides models, message types and tools, and a provider package such as langchain-groq connects to a hosted model. python-dotenv, optional, loads your key from a file.
Last updated: 29 Sep, 2026 · LangGraph 1.2 · Python 3.10+
Installing LangGraph with pip, uv or Colab
The crash course sets the project up with uv, a fast Python package and project manager written in Rust. uv init turns the folder into a project: it writes pyproject.toml, a .python-version file (3.13 in the video) and a starter main.py. The video lists the libraries in requirements.txt, starting with langgraph, langchain and langsmith, creates the environment with uv venv, activates it, and installs everything with uv add -r requirements.txt.
Pick the tab that fits how you work. pip is the plain way, uv follows the video, and Colab needs nothing installed on your machine. Unlike the video, the tabs pin each version, the ones every lesson was run with.
pip install "langgraph==1.2.12" "langchain==1.4.2" "langchain-groq==1.1.3" "python-dotenv==1.2.3"Check the install
from importlib.metadata import version
print("langgraph", version("langgraph"))
print("langchain", version("langchain"))
print("langchain-groq", version("langchain-groq"))langgraph 1.2.12 langchain 1.4.2 langchain-groq 1.1.3
What each package does
langgraphis the orchestration layer: graphs, state, edges, checkpointers.langchainsupplies the chat models, message types and tools that graphs use later.- langchain-groq connects
init_chat_modelto Groq's hosted models. Any other provider LangChain supports works the same way with its own package. - The first lessons are plain Python. The model lessons call a real model, which needs an API key (below).
Get an API keyNeeded for the model lessons
The model lessons call a real hosted model, and the output you see is its real reply. Groq's free tier is what this course uses; the others work the same way with their own package and model string.
| Provider | Key | Variable | Package and model string |
|---|---|---|---|
| Groq | Free, console.groq.com/keys | GROQ_API_KEY | langchain-groq, "groq:openai/gpt-oss-120b" |
| Gemini | Free, aistudio.google.com/apikey | GOOGLE_API_KEY | langchain-google-genai, "google_genai:gemini-2.5-flash" |
| OpenRouter | Free models end in :free, openrouter.ai/keys | OPENROUTER_API_KEY | langchain-openrouter, "openrouter:google/gemma-4-31b-it:free" |
| OpenAI | Paid, platform.openai.com/api-keys | OPENAI_API_KEY | langchain-openai, "openai:gpt-4.1-mini" |
The clips use Groq models such as llama3-8b-8192, which Groq has since retired; every example here runs on openai/gpt-oss-120b.
Set the key as an environment variable before you run the model lessons.
export GROQ_API_KEY=gsk_...Keeping the key in a .env file
The video keeps its keys in a file named .env in the project folder and loads them with python-dotenv, installed above. export and $env: set the key for one terminal window only; the file keeps it:
GROQ_API_KEY=gsk_...Start each script with these two lines, before any model is created. The examples in later lessons leave them out, so add them at the top if you keep your key in .env. Add .env to your .gitignore so the key never reaches a Git repository. In Colab the Secrets panel above does this job.
from dotenv import load_dotenv
load_dotenv() # copies the keys in .env into the environmentCheck the key with a real call
With the key set, one call reaches the model and comes back with a real reply. init_chat_model is explained in the chat-models lesson.
from langchain.chat_models import init_chat_model
model = init_chat_model("groq:openai/gpt-oss-120b", temperature=0) # uses your GROQ_API_KEY
print(model.invoke("In one sentence, what is LangGraph?").content)LangGraph is a Python library that lets developers construct, visualize, and run state‑ful, multi‑step LLM applications as directed graphs of modular nodes and edges.
A Tavily key for web searchOptional
The crash course gives its chatbot a web search tool, TavilySearch from the langchain-tavily package, which needs a TAVILY_API_KEY. The examples from the video that search the web use it, starting in ToolNode and tools_condition, which installs the package and sets up the key. The free plan needs no card. The course's own shop examples run with the Groq key alone.
Related
- Previous: LangGraph overview
- Next: State
- Reference: Install LangGraph
- Run the version check. Do your versions match 1.x?
- Import
from langgraph.graph import StateGraph, START, ENDand confirm no error.
Little by little, you're building something great.