Skip to content
ViqusViqus
Navigate
Company
Blog
About Us
Contact
System Status
Enter Viqus Hub

How to Build a Local, Tool-Calling AI Agent in Python with Ollama and Qwen3

Tool Calling Ollama Qwen3 AI Agents Local LLM Deployment Python Agent Memory
November 23, 2026

This summary and analysis were generated by AI from the original article at Machine Learning Mastery and may contain errors (how Viqus works). Read the source for full details.

Viqus Verdict Logo Viqus Verdict Logo 3
Useful Tutorial, Not News
Media Hype 2/10
Real Impact 3/10

Article Summary

This Machine Learning Mastery tutorial shows how to build a project assistant that runs entirely on a local machine using Ollama, the Ollama Python package, and the open Qwen3-4B model. The guide covers installing Ollama and the model, setting a 32K-token context length suited to agent workflows, and explaining the tool-calling exchange, in which the model requests a function, the code executes it, and the result returns as a message. It then defines five plain-Python tools (list_files, search_files, read_file, recent_files, remember) with path-safety checks, size limits on results, and error messages returned as text. An agent loop runs tools until the model answers, and short-term memory (a trimmed message history) and long-term memory (a JSON facts file outside the project) complete the design. The article is a practical how-to with no new model or product announcement.

Key Points

  • Ollama with Qwen3-4B, set to a 32K context window, can run a tool-calling agent entirely on a local machine without an API key.
  • Tools written as plain Python functions with docstrings, path checks against a root folder, and output limits keep the agent read-only except for a single memory file.
  • An agent loop that appends tool results to the message history, plus a JSON memory file, provides short-term and long-term memory.

Why It Matters

This is a routine, instructional piece rather than news. It is useful for developers who want a concrete local agent pattern, but it announces no new model, product, or industry shift. The safety practices it shows (path containment, bounded outputs, errors returned as text) are good general patterns for tool-using agents.


You might also be interested in