Give a local Ollama model live web search and news
A local model knows nothing after its training date. Give it NestDaddy tools with function calling and it can search the web and read today's news, still running on your own computer.
Ollama runs open models on your own machine, free and private. What it cannot do is look anything up. With tool calling you can give the model NestDaddy's search and news, and keep everything else local.
What you need
ollama pull qwen2.5:7b # any model with tool support
pip install openai requests
export NESTDADDY_API_KEY="your-key" # free plan: 1,000 calls a month, no card
Get the key at nestdaddy.com/mcp.
The tool
import os, requests
HEADERS = {"X-API-Key": os.environ["NESTDADDY_API_KEY"]}
def news_search(query, days=3):
r = requests.get("https://nestdaddy.com/api/v1/news/search", headers=HEADERS, timeout=30,
params={"q": query, "days": days, "limit": 5})
r.raise_for_status()
return [{"title": a["title"], "source": a.get("source_domain"),
"date": a.get("published_timestamp"), "url": a["url"]}
for a in r.json().get("results", [])]
Describe it to the model with a JSON schema, send it with tools= through Ollama's OpenAI-compatible endpoint (http://localhost:11434/v1), run the tools the model asks for, and loop until it answers. The full agent is about 60 lines: nestdaddy-examples/python/ai-agent-from-scratch.
What we saw
With qwen2.5:7b and the question "What happened in AI today?", the model called news_search({'query': 'AI', 'days': 1}) and answered with that day's headlines and links. Without the tool, the same model answered "As of my last update in October 2023...".
One rule in the system message matters: tell the model that search results are only headlines and that it must read the article (a read_page tool) before giving details. Without it, small models tend to invent the details.
Learn more
- Video: How to build an AI agent from scratch
- Guide: How to build an AI agent from scratch in Python
- Template repo with web search, news and page reading: ollama-web-search
