AI Hints
Home›LangGraph Tutorial›Getting Started
LangGraph · Lesson 2 of 120

Setting Up

Packages and a key.

⏱ 2 min read▶ Video at 1:08🎓 Free
Watch this lesson in the LangGraph courseWatch on YouTube ↗Full LangGraph course

To follow along, you need Python, a few packages, and an API key for a model. We'll use Google's Gemini, which has a free tier, but every example works with other providers too.

Setting Up
From the video: Setting Up
  • Python
  • A few packages
  • An API key

Installing the packages

Install three packages with pip. LangGraph is the graph library. Lang chain gives us models and tools. Lang chain google gen AI connects to Gemini. Then get a free key from Google AI Studio, and store it in an environment variable.

terminalpython
pip install langgraph langchain langchain-google-genai

# get a key at aistudio.google.com, then:
export GOOGLE_API_KEY="your-key-here"

Checking the setup

Let's check everything is ready. We print the installed LangGraph version, and whether a key is set, without ever printing the key itself. Run it. Version one point two, and the key is there.

check_setup.pypython
import os
from importlib.metadata import version

print("LangGraph version:", version("langgraph"))
has_key = bool(os.environ.get("GOOGLE_API_KEY") or os.environ.get("GEMINI_API_KEY"))
print("API key set:", has_key)
Output
LangGraph version: 1.2.19
API key set: True

Summary

Install langgraph, langchain, and langchain google gen AI, and keep your key in an environment variable. Next, your very first graph.

Key takeaways
  • pip install langgraph
  • Key in an environment variable
  • Never in your code
Next up: Your First Graph — one node