How to Build a Local, Tool-Calling AI Agent in Python with Ollama and Qwen3
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.
3
What is the Viqus Verdict?
We evaluate each news story based on its real impact versus its media hype to offer a clear and objective perspective.
AI Analysis:
The hype is minimal and the content is a how-to built on existing open tools; its real value is practical know-how for developers rather than any change to the industry.
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.

