In this article, you will learn how to build a local AI agent in Python that uses Ollama and Qwen3 to call tools that search, read, and remember information in a project folder.
Topics we will cover include:
How to set up Ollama with a tool-capable model and a context length large enough for agent workflows.
How the tool-calling exchange works, and how to write safe, size-limited tools as plain Python functions.
How to build the agent loop and add short-term and long-term memory to the assistant.
Introduction
A language model can generate text, reason through a problem, and follow instructions. To work with files on your computer, though, it needs a way to interact with them. Tool calling provides that connection. It lets a model request an action, such as searching a folder or reading a document, and use the result to decide what to do next.
Put that capability inside a loop, and you have the foundation of an AI agent .…