Ollama and Qwen 3: local LangGraph agent setup
Learn to switch a Python LangGraph agent to Qwen 3 8B with ChatOllama and compare its word-selection task results with GPT-4o.
Player not loading? Watch on YouTube
This tutorial moves an existing Python LangGraph AI agent from an OpenAI model to Qwen 3 through Ollama. It covers installation, model selection and the code changes needed to run models locally. The example assumes an agent workflow already exists rather than building one from scratch.
The speaker selects Qwen 3 8B after experimenting with models on their computer and describes it as about the largest variant that still responds near real time on that machine. The download shown is roughly 5 GB. Hardware specifications are not supplied, so this is a machine-specific observation rather than a general requirement. An explanation of quantization describes how reducing weight precision can lower memory use.
The walkthrough uses ollama list to inspect installed models, then gets the desired variant's name from the Ollama website and downloads it with ollama pull. In PyCharm's AI Playground, the speaker compares Qwen 3 with GPT-4o using the same language-learning prompt. Both identify the requested language and word count; Qwen's response is more verbose. The speaker's assessment of similar performance applies to this narrow task.
The integration replaces ChatOpenAI with ChatOllama from the LangChain Ollama package and selects Qwen 3 8B. A final request for ten random German words demonstrates argument extraction, a tool call and termination after the agent receives the results.