# Give your LangChain agent live web search and real-time news

> Source: <https://nestdaddy.com/blog/langchain-live-web-search-news>
> Published: 2026-11-13 17:22:15.017496+00:00

# Give your LangChain agent live web search and real-time news

Your LangChain agent only knows what its model learned in training. Add three tools from langchain-nestdaddy and it can search the web, read today's news and open full articles. Agent and RAG examples, tested with LangChain 1.5.

A LangChain agent is only as current as the model behind it. Ask about something that happened this morning and the model either says it does not know or, worse, guesses with confidence.

The fix is to give the agent tools that reach today's internet. This guide uses [`langchain-nestdaddy`](https://pypi.org/project/langchain-nestdaddy/), a LangChain integration for NestDaddy's own search index and real-time news collection, to add:

| Class | What it gives the agent | 
|---|---|
| `NestDaddySearch` | Web search: title, url, snippet and domain of each result | 
| `NestDaddyNewsSearch` | Real-time news by key words, with an optional country and time window | 
| `NestDaddyReadPage` | The clean main text of any page or article, without menus or ads | 
| `NestDaddyNewsRetriever` | News as LangChain `Document` s for RAG, optionally with the full article text | 

Everything below was run against the live API with LangChain 1.5.

```
Press Run to call the API.
```

[Get your free API key](https://nestdaddy.com/mcp)

## Install

```
pip install -U langchain langchain-nestdaddy
export NESTDADDY_API_KEY="your-key"
```

Get a key from the [NestDaddy MCP page](https://nestdaddy.com/mcp) (there is a free trial). The same key works for the REST API, the MCP server and this package.

## Try the tools on their own

``` python
from langchain_nestdaddy import NestDaddyNewsSearch, NestDaddySearch

NestDaddySearch(max_results=2).invoke({"query": "model context protocol"})
{
  "query": "model context protocol",
  "count": 2,
  "results": [
    {"title": "Roadmap - Model Context Protocol",
     "url": "https://modelcontextprotocol.io/development/roadmap",
     "snippet": "Our plans for evolving Model Context Protocol",
     "domain": "modelcontextprotocol.io", "type": "web"},
    {"title": "Model Context Protocol",
     "url": "https://en.wikipedia.org/wiki/Model_Context_Protocol",
     "snippet": "Protocol for communicating between LLMs and applications: The Model Context Protocol (MCP) is an open standard...",
     "domain": "en.wikipedia.org", "type": "wiki"}
  ]
}
```

News works the same way. Keep the query to a few key words, the way a headline would say it:

```
NestDaddyNewsSearch(max_results=3, days=2).invoke({"query": "ChatGPT Wallet"})
```

That returned, a few hours after the announcement:

```
2026-11-13 23:06  cryptobriefing.com  OpenAI introduces ChatGPT wallet for Pro subscribers
2026-11-13 23:00  cnbc.com            OpenAI launches ChatGPT Wallet, allowing its 'dots' AI agents to make purchases for users
2026-11-13 23:48  investing.com       OpenAI launches ChatGPT Wallet, letting AI agents pay for purchases
```

Add `"country": "US"` (or GB, IN, SG, ID and others) to limit news to one country. Local news works in the local language, for example `{"query": "banjir Jakarta", "country": "ID"}`.

## Give an agent live search and news

``` python
from langchain.agents import create_agent
from langchain_nestdaddy import NestDaddyNewsSearch, NestDaddyReadPage, NestDaddySearch

agent = create_agent(
    "anthropic:claude-sonnet-5-5",
    tools=[NestDaddySearch(max_results=5), NestDaddyNewsSearch(days=7), NestDaddyReadPage()],
    system_prompt=(
        "Use news search for anything recent, web search for everything else. "
        "Read a page in full before you explain its details, and cite the urls you used."
    ),
)

result = agent.invoke({"messages": [{"role": "user", "content": "What did OpenAI announce this week?"}]})
print(result["messages"][-1].content)
```

Any chat model with tool calling works: swap the model string for OpenAI, Gemini, a local model through Ollama, and so on.

The system prompt matters more than it looks. Without it, many models never call a tool for "this week" questions, because they do not know their knowledge is out of date. One routing line ("news for recent, web for everything else") fixes most of those answers.

## RAG over today's news

When you want documents rather than a tool-calling loop, use the retriever:

``` python
from langchain_nestdaddy import NestDaddyNewsRetriever

retriever = NestDaddyNewsRetriever(k=3, days=2, full_text=True)
docs = retriever.invoke("ChatGPT Wallet")

for d in docs:
    print(d.metadata["source_domain"], d.metadata["full_text"], len(d.page_content))
cryptobriefing.com  True   2611
cnbc.com            True   4328
investing.com       False  67
```

With `full_text=True` each article is read in full (one extra API call per article). The third article could not be read as clean text, so the retriever kept its summary instead of dropping it: you still get `k` documents, and `metadata["full_text"]` tells you which ones are complete.

Feed `docs` into any LangChain chain or prompt as context. Because every document carries its `url` and `published_timestamp`, the model can cite sources and say how fresh they are.

## Async

Every tool and the retriever support `ainvoke`. The retriever reads full articles in parallel:

```
docs = await NestDaddyNewsRetriever(k=5, full_text=True).ainvoke("AI regulation")
```

## Errors you might see

API errors raise `NestDaddyAPIError` with the HTTP status and a hint: a bad key points you to the dashboard, a plan limit to the plans page. The key is stored as a `SecretStr`, so it never shows up in logs or reprs.

## Prefer MCP?

If you use Claude, Cursor, VS Code or n8n instead of LangChain, the same tools are available as one remote MCP server. Setup for each client is on the [NestDaddy MCP page](https://nestdaddy.com/mcp).

## Links

- Package: [pypi.org/project/langchain-nestdaddy](https://pypi.org/project/langchain-nestdaddy/)
- Source and tests: [github.com/nestdaddy/langchain-nestdaddy](https://github.com/nestdaddy/langchain-nestdaddy)
- REST API reference: [nestdaddy.com/apis](https://nestdaddy.com/apis)
