Step-by-step guide to building a local AI web research agent using Ollama, the Qwen3.5:4b model, and Python. The agent accepts a research prompt, fetches the top 5 web results via Ollama's web search API, extracts readable text with BeautifulSoup, and sends everything to a locally running Qwen model for summarization. The result is saved as a timestamped Markdown file. The setup runs entirely on-device with no API costs and preserves privacy. Full working code is provided along with setup instructions for macOS, Windows, and Linux.

10m read timeFrom freecodecamp.org
Post cover image
Table of contents
BackgroundMotivation and ArchitectureStep 1: Install Ollama and Get an API KeyStep 2: Pull the Qwen ModelStep 3: Install Python DependenciesStep 4: Write the Agent CodeStep 5: Run the AgentConclusion
2K Impressions