This workshop will walk you through building your very first AI agent using LangGraph, a framework built on top of LangChain for creating agentic applications.
We’ll cover:
- Setting up your environment
- Running Jupyter notebooks for experimentation
- Using LangGraph Studio and LangSmith to visualize and debug your agents
- Exploring APIs and integrations like GroqCloud, Google AI Studio and Tavily
By the end of this workshop, you’ll have a working understanding of LangGraph, as well as a few custom-built agents you can extend further.
To get the most out of this course, please ensure you're using Python 3.11 or later. This version is required for optimal compatibility with LangGraph. If you're on an older version, upgrading will ensure everything runs smoothly.
python3 --version
git clone https://github.com/nazakun021/build-your-first-ai-agent-langgraph.git
cd build-your-first-ai-agent-langgraph
python3 -m venv langgraph-workshop-env
source langgraph-workshop-env/bin/activate
pip install -r requirements.txt
python3 -m venv langgraph-workshop-env
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
langgraph-workshop-env\Scripts\Activate.ps1
pip install -r requirements.txt
jupyter notebook
You’ll need an API key to connect to the service.
Make sure to store your API keys somewhere safe—for example, in a password manager or a .env
file (if you’re using something like the python-dotenv
library).
Never hardcode your API keys directly into your code or share them publicly.
- If you don't have a GroqCloud API key, you can sign up here.
- Set
GROQ_API_KEY
in your.env
file.
- If you don't have a Google AI Studio API key, you can sign up here.
- Set
GOOGLE_API_KEY
in your.env
file.
- Sign up for LangSmith here.
- Learn more about LangSmith here and check the docs.
- Store the following in your
.env
file:
LANGCHAIN_API_KEY=your-key-here
LANGCHAIN_TRACING_V2=true
- Tavily Search API is a search engine optimized for LLMs and RAG, aimed at efficient, quick, and persistent search results.
- You can sign up for an API key here. It's easy to sign up and offers a very generous free tier. Some notebooks later will use Tavily.
- Set
TAVILY_API_KEY
in your.env
file.
Create a .env
file in your project root directory and add all your API keys there. Example:
GROQ_API_KEY=your-groqcloud-key
GOOGLE_API_KEY=your-google-key
LANGCHAIN_API_KEY=your-langsmith-key
LANGCHAIN_TRACING_V2=true
TAVILY_API_KEY=your-tavily-key
- LangGraph Studio is a custom IDE for viewing and testing agents.
- Studio can be run locally and opened in your browser on Mac, Windows, and Linux.
- See documentation here on the local Studio development server and here.
- Graphs for LangGraph Studio are in the
x-topic/studio/
folders. - To start the local development server, run the following command in your terminal in the
/studio
directory:
langgraph dev
You should see the following output:
- 🚀 API: http://127.0.0.1:2024
- 🎨 Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
- 📚 API Docs: http://127.0.0.1:2024/docs
Open your browser and navigate to the Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
.
- To use Studio, you will need to create a
.env
file with the relevant API keys
To configure Application Default Credentials (ADC) with a Google Account, you can use the Google Cloud CLI:
- Install the Google Cloud CLI
Download and install it from Google Cloud CLI installation docs. - Authenticate your account and set up local ADC
Run the following in your terminal or PowerShell:
gcloud auth application-default login