cd /news/ai-agents/give-a-pydantic-ai-agent-live-web-se… · home › topics › ai-agents › article
[ARTICLE · art-180426] src=nestdaddy.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Give a Pydantic AI agent live web search and news with one capability

NestDaddy published pydantic-ai-nestdaddy, an MIT-licensed Pydantic AI capability that adds three tools — search_web, search_news and read_page — to an agent in one line, installable via pip with a NESTDADDY_API_KEY. In a test run on 3 December 2026 with Pydantic AI 2.78 and the local qwen2.5:7b model via Ollama, the agent made a single search_news call with num_results set to 3 and returned three linked headlines; the capability's country filter (set to US) was needed because the same query without it returned mostly Chinese-language articles. The toolset catches malformed arguments locally and retries up to three times without spending an API call, while bad keys, exhausted quota and network failures raise NestDaddyError.

key takeaway

pydantic-ai-nestdaddy bundles search_web, search_news and read_page into one Pydantic AI capability, and setting country="US" on search_news changed results from mostly Chinese-language articles to US outlets on the 3 December 2026 test.

read4 min views13 publishedDec 2, 2026
Give a Pydantic AI agent live web search and news with one capability
Image: Nestdaddy (auto-discovered)

pydantic-ai-nestdaddy adds web search, news search by country and page reading to a Pydantic AI agent in one line. Install, run it with a free local model, use it in an agent spec, or take just the toolset.

A language model knows what it was trained on. It does not know what happened this morning, and it cannot read the page behind a headline. Pydantic AI has a clean answer for extending an agent: a capability that bundles tools and the instructions for using them.

We published one for NestDaddy: pydantic-ai-nestdaddy (source on GitHub, MIT). It gives an agent three tools and a short instruction on when to use each.

Tool What it does
search_web Web results with title, url, snippet and domain.
search_news Real-time news, newest and best match first, filtered by age in days and by a two-letter country code.
read_page The clean full text of a page or article, so the agent reads the source before it states details.

Install #

pip install pydantic-ai-nestdaddy "pydantic-ai-slim[openai]"
export NESTDADDY_API_KEY="your-key"

Get a key at nestdaddy.com/dashboard (a free plan is available).

One line #

This runs a free local model through Ollama (ollama pull qwen2.5:7b). For a hosted model, pass a name such as "openai:gpt-5" instead.

from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.ollama import OllamaProvider
from pydantic_ai_nestdaddy import NestDaddyCapability

model = OpenAIChatModel("qwen2.5:7b", provider=OllamaProvider(base_url="http://localhost:11434/v1"))
agent = Agent(model, capabilities=[NestDaddyCapability(country="US", news_days=2)])

result = agent.run_sync("What happened in AI today? Give 3 headlines with links.")
print(result.output)

What we got #

We ran exactly this on 3 December 2026 with Pydantic AI 2.78 and qwen2.5:7b. The agent made one call, search_news {"query": "AI", "num_results": 3}, and answered with three headlines, each linked to its source:

  1. What Healthcare's AI Leaders Can Teach About Checking AI's Work (Forbes)
  2. AI Has So Many Problems. Local AI Might Solve Them All (Wired)
  3. Suno Tries to Tie Christmas to AI With Holiday Remixes (Variety)

Without country="US" the same question returns the world's news, which on that day was mostly Chinese-language articles. That is the point of the country filter: say where the news should come from.

Options #

All optional: api_key (otherwise NESTDADDY_API_KEY), num_results (default 10), news_days (default 30), country, max_chars for read_page (default 8000) and timeout.

Only the tools #

If you prefer a plain toolset to a capability:

from pydantic_ai import Agent
from pydantic_ai_nestdaddy import nestdaddy_toolset

agent = Agent("openai:gpt-5", toolsets=[nestdaddy_toolset(country="US")])

Agent specs #

Every field is serializable, so the capability works in a YAML agent spec. This needs PyYAML (pip install "pydantic-ai-slim[spec]").

model: openai:gpt-5
capabilities:
  - NestDaddy:
      country: GB
      news_days: 7
python
from pydantic_ai import Agent
from pydantic_ai_nestdaddy import NestDaddyCapability

agent = Agent.from_file("agent.yaml", custom_capability_types=[NestDaddyCapability])

How it behaves when something goes wrong #

  • A one-character query, a malformed country code or a URL without http is caught locally and sent back to the model as a retry, without spending an API call.
  • A 400 or 422 from the API is also a retry, so the model can fix its own arguments. The toolset allows three retries.
  • A bad key, a used-up quota or a network failure raises NestDaddyError with a clear message, because the model cannot fix those.

The tests run offline through httpx.MockTransport, so you can read them as documentation of the exact requests the tools send.

Why a capability and not just functions #

You can always write two plain functions, and we show that in our Pydantic AI guide. A capability adds the part people forget: the instruction that tells the model when to search news, when to search the web, and to read a page before relying on its details. Small local models in particular get this wrong without it. If the agent builds on a model with a short memory of the world, how to build an AI agent from scratch explains why the reading step matters.

Next #

The package and its PyPI page are live now. If you build agents in another framework, the same search, news and page reading come as an MCP server for Claude, Cursor and VS Code, and as plain REST calls in the API docs.

── more in #ai-agents 4 stories · sorted by recency
── more on @nestdaddy 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/give-a-pydantic-ai-a…] indexed:0 read:4min 2026-12-02 · —