# Add web search and real-time news to the Vercel AI SDK (npm package, 2026)

> Source: <https://nestdaddy.com/blog/vercel-ai-sdk-web-search-news>
> Published: 2026-12-04 00:00:00+00:00

**Key takeaway:** @nestdaddy/ai-sdk adds webSearch, newsSearch and readPage as plain AI SDK tools, and in a 4 December 2026 test with ai 7.1 and local qwen2.5:7b the model answered with three current AI headlines and links by calling newsSearch instead of guessing.

# Add web search and real-time news to the Vercel AI SDK (npm package, 2026)

A model on its own only knows its training data. How to give a Vercel AI SDK agent web search, news by country and age, and full-page reading with one npm package, with a tested TypeScript example.

A model called through the Vercel AI SDK answers from its training data. Ask it what happened in AI this morning and it either guesses or says it does not know. The fix is a tool: a function the model can call to search the web, read the result, and then answer from what it found.

`@nestdaddy/ai-sdk` is that tool, ready to use. It adds three tools to any `generateText` or `streamText` call.

## Quick answers

**What does it add?** `webSearch` (results with title, url, snippet and domain), `newsSearch` (real-time news filtered by age and country, newest and best match first) and `readPage` (the clean full text of a page, so the model reads the source before it states details).

**Which models does it work with?** Any model the AI SDK supports, because the tools are plain AI SDK tools. We tested it with a local `qwen2.5:7b` through Ollama.

**Do I need a key?** Yes, a NestDaddy API key in `NESTDADDY_API_KEY`. There is a 7-day free trial.

## Install

```
npm install @nestdaddy/ai-sdk ai
export NESTDADDY_API_KEY="your-key"
```

## Use it

``` js
import { generateText, isStepCount } from "ai";
import { nestdaddyTools } from "@nestdaddy/ai-sdk";

const { text } = await generateText({
  model: "openai/gpt-5-mini",
  prompt: "What happened in AI today? Give 3 headlines with links.",
  tools: nestdaddyTools({ country: "US", newsDays: 2 }),
  stopWhen: isStepCount(4),
});

console.log(text);
```

`nestdaddyTools()` returns all three tools. To pass only some, use `webSearch()`, `newsSearch()` and `readPage()` one by one. Options are `numResults`, `newsDays`, `country`, `maxChars`, `apiKey`, `baseUrl`, `timeoutMs` and `fetch`.

## What happens when it runs

We ran this on 4 December 2026 with the package installed from npm, `ai` 7.1 and a local `qwen2.5:7b`. The model called `newsSearch` with `{"query":"AI","numResults":3}` and answered with three of that day's AI headlines, each with its link. It did not need to guess the date or the news: the tool result had both.

## Things that make it safe to ship

- **Arguments are checked first.** The tools validate input with zod before any request, so a one-character query, a bad country code or a URL without a scheme never reaches the API.
- **Errors reach the model.** A bad key, a used-up quota or a network problem throws a`NestDaddyError` with the status and message, which the AI SDK hands back to the model as a tool error instead of crashing your route.
- **Compact results.** Tools return small objects, never raw API payloads, so they do not eat your context window.

## Read the source before answering

Search results are headlines and snippets. For details, tell the model to read the best result with `readPage` before it states facts, and to cite the URL. Adding "check the web, don't guess" to the system prompt does the rest.

## Pricing

The **[Search & News API](https://nestdaddy.com/serp-api)** covers web search, news search and financial and tech news with one key, from USD 5 a month for 200,000 searches, with a 7-day free trial: [plans](https://nestdaddy.com/serp-api#pricing). The package is open source (MIT). The full guide is at [Vercel AI SDK integration](https://nestdaddy.com/integrations/vercel-ai-sdk).

Prefer MCP? The [NestDaddy MCP server](https://nestdaddy.com/mcp) works with the AI SDK's MCP client too. Using Python? See the [Pydantic AI guide](https://nestdaddy.com/blog/pydantic-ai-web-search-news).
