Local AI Agent with LangGraph + Ollama (Full Tutorial, Qwen3)

Sun, 24 May 2026 23:57:18 +0000

🚀 Code:
https://github.com/langchain-ai/langchain-academy/

Tired of API bills and vendor lock-in? In this tutorial, you’ll learn how to adapt a LangGraph agent to run entirely locally using the free, open-source Qwen3 model with Ollama. We'll take a standard LangChain Academy example built for GPT-4o and show you how to swap it out for a powerful local alternative, giving you full control over your data and costs.

// WHAT YOU'LL LEARN
Setting up a Python development environment with UV, a blazingly fast package manager.
Installing and running powerful open-source models like Qwen3 locally with Ollama.
Building a conversational agent with memory using LangGraph's StateGraph.
Defining and binding tools (like a calculator) to your local LLM.
Adapting existing LangChain code from proprietary to open-source models.
Launching and interacting with your agent using LangGraph Studio.
Observing and debugging your agent's thought process with LangSmith.
Understanding the core components of an agentic graph: nodes, edges, and state.

// RESOURCES
LangChain Academy Course:
https://academy.langchain.com/

LangGraph Docs:
https://docs.langchain.com/oss..../python/langgraph/ov

Ollama & Qwen3 Model:
https://ollama.com/
https://ollama.com/library/qwen3

UV Package Manager:
https://github.com/astral-sh/uv

// CHAPTERS
00:00 - Intro: Moving Beyond Proprietary Models
01:03 - The Stack: LangGraph, Ollama, and UV
01:14 - Environment Setup with UV Package Manager
01:50 - Installing Ollama & Pulling the Qwen3 Model
04:01 - Creating a Virtual Environment & Project Dependencies
05:35 - Code Deep Dive: From OpenAI to Ollama
06:21 - Building the Agent Graph (Nodes & Edges)
11:00 - Configuring LangSmith for Tracing
12:12 - Running the Agent in LangGraph Studio
12:46 - Live Demo: Testing the Agent's Memory
13:56 - Recap & Next Steps

// NEXT STEPS
If this helped, give the video a like and subscribe! What should we build next with this local stack? Let me know in the comments below.

Discord: discord.gg/KpnJQbgpjt