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

> Source: <https://nestdaddy.com/blog/pydantic-ai-web-search-news>
> Published: 2026-12-02 18:45:36.534830+00:00

**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.

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

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`](https://pypi.org/project/pydantic-ai-nestdaddy/) ([source on GitHub](https://github.com/nestdaddy-ai/pydantic-ai-nestdaddy), 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](https://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.

``` python
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:

``` python
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](https://nestdaddy.com/integrations/pydantic-ai). 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](https://nestdaddy.com/blog/how-to-build-an-ai-agent-from-scratch) explains why the reading step matters.

## Next

The package and its [PyPI page](https://pypi.org/project/pydantic-ai-nestdaddy/) are live now. If you build agents in another framework, the same search, news and page reading come as an [MCP server](https://nestdaddy.com/mcp) for Claude, Cursor and VS Code, and as plain REST calls in the [API docs](https://nestdaddy.com/apis).
