{"slug": "give-your-langchain-agent-live-web-search-and-real-time-news", "title": "Give your LangChain agent live web search and real-time news", "summary": "NestDaddy released langchain-nestdaddy, a LangChain integration that adds four tools — NestDaddySearch, NestDaddyNewsSearch, NestDaddyReadPage and NestDaddyNewsRetriever — letting LangChain agents run live web search, real-time news queries with optional country and time-window filters, and full-page article extraction. The package, tested against the live API with LangChain 1.5, installs via pip and uses a single NestDaddy API key that also works for the company's REST API and MCP server, with a free trial available. NestDaddy's guide notes that a system prompt directing the agent to use news search for recent queries and to cite URLs matters, because without it many models never call a tool for time-sensitive questions like 'this week'.", "body_md": "# Give your LangChain agent live web search and real-time news\n\nYour 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.\n\nA 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.\n\nThe 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:\n\n| Class | What it gives the agent | \n|---|---|\n| `NestDaddySearch` | Web search: title, url, snippet and domain of each result | \n| `NestDaddyNewsSearch` | Real-time news by key words, with an optional country and time window | \n| `NestDaddyReadPage` | The clean main text of any page or article, without menus or ads | \n| `NestDaddyNewsRetriever` | News as LangChain `Document` s for RAG, optionally with the full article text | \n\nEverything below was run against the live API with LangChain 1.5.\n\n```\nPress Run to call the API.\n```\n\n[Get your free API key](https://nestdaddy.com/mcp)\n\n## Install\n\n```\npip install -U langchain langchain-nestdaddy\nexport NESTDADDY_API_KEY=\"your-key\"\n```\n\nGet 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.\n\n## Try the tools on their own\n\n``` python\nfrom langchain_nestdaddy import NestDaddyNewsSearch, NestDaddySearch\n\nNestDaddySearch(max_results=2).invoke({\"query\": \"model context protocol\"})\n{\n  \"query\": \"model context protocol\",\n  \"count\": 2,\n  \"results\": [\n    {\"title\": \"Roadmap - Model Context Protocol\",\n     \"url\": \"https://modelcontextprotocol.io/development/roadmap\",\n     \"snippet\": \"Our plans for evolving Model Context Protocol\",\n     \"domain\": \"modelcontextprotocol.io\", \"type\": \"web\"},\n    {\"title\": \"Model Context Protocol\",\n     \"url\": \"https://en.wikipedia.org/wiki/Model_Context_Protocol\",\n     \"snippet\": \"Protocol for communicating between LLMs and applications: The Model Context Protocol (MCP) is an open standard...\",\n     \"domain\": \"en.wikipedia.org\", \"type\": \"wiki\"}\n  ]\n}\n```\n\nNews works the same way. Keep the query to a few key words, the way a headline would say it:\n\n```\nNestDaddyNewsSearch(max_results=3, days=2).invoke({\"query\": \"ChatGPT Wallet\"})\n```\n\nThat returned, a few hours after the announcement:\n\n```\n2026-11-13 23:06  cryptobriefing.com  OpenAI introduces ChatGPT wallet for Pro subscribers\n2026-11-13 23:00  cnbc.com            OpenAI launches ChatGPT Wallet, allowing its 'dots' AI agents to make purchases for users\n2026-11-13 23:48  investing.com       OpenAI launches ChatGPT Wallet, letting AI agents pay for purchases\n```\n\nAdd `\"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\"}`.\n\n## Give an agent live search and news\n\n``` python\nfrom langchain.agents import create_agent\nfrom langchain_nestdaddy import NestDaddyNewsSearch, NestDaddyReadPage, NestDaddySearch\n\nagent = create_agent(\n    \"anthropic:claude-sonnet-5-5\",\n    tools=[NestDaddySearch(max_results=5), NestDaddyNewsSearch(days=7), NestDaddyReadPage()],\n    system_prompt=(\n        \"Use news search for anything recent, web search for everything else. \"\n        \"Read a page in full before you explain its details, and cite the urls you used.\"\n    ),\n)\n\nresult = agent.invoke({\"messages\": [{\"role\": \"user\", \"content\": \"What did OpenAI announce this week?\"}]})\nprint(result[\"messages\"][-1].content)\n```\n\nAny chat model with tool calling works: swap the model string for OpenAI, Gemini, a local model through Ollama, and so on.\n\nThe 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.\n\n## RAG over today's news\n\nWhen you want documents rather than a tool-calling loop, use the retriever:\n\n``` python\nfrom langchain_nestdaddy import NestDaddyNewsRetriever\n\nretriever = NestDaddyNewsRetriever(k=3, days=2, full_text=True)\ndocs = retriever.invoke(\"ChatGPT Wallet\")\n\nfor d in docs:\n    print(d.metadata[\"source_domain\"], d.metadata[\"full_text\"], len(d.page_content))\ncryptobriefing.com  True   2611\ncnbc.com            True   4328\ninvesting.com       False  67\n```\n\nWith `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.\n\nFeed `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.\n\n## Async\n\nEvery tool and the retriever support `ainvoke`. The retriever reads full articles in parallel:\n\n```\ndocs = await NestDaddyNewsRetriever(k=5, full_text=True).ainvoke(\"AI regulation\")\n```\n\n## Errors you might see\n\nAPI 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.\n\n## Prefer MCP?\n\nIf 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).\n\n## Links\n\n- Package: [pypi.org/project/langchain-nestdaddy](https://pypi.org/project/langchain-nestdaddy/)\n- Source and tests: [github.com/nestdaddy/langchain-nestdaddy](https://github.com/nestdaddy/langchain-nestdaddy)\n- REST API reference: [nestdaddy.com/apis](https://nestdaddy.com/apis)", "url": "https://wpnews.pro/news/give-your-langchain-agent-live-web-search-and-real-time-news", "canonical_source": "https://nestdaddy.com/blog/langchain-live-web-search-news", "published_at": "2026-11-13 17:22:15.017496+00:00", "updated_at": "2026-11-13 17:22:17.822336+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "agent-protocols", "ai-search"], "entities": ["NestDaddy", "LangChain", "langchain-nestdaddy", "NestDaddySearch", "NestDaddyNewsSearch", "NestDaddyReadPage", "NestDaddyNewsRetriever", "Model Context Protocol"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/give-your-langchain-agent-live-web-search-and-real-time-news", "markdown": "https://wpnews.pro/news/give-your-langchain-agent-live-web-search-and-real-time-news.md", "text": "https://wpnews.pro/news/give-your-langchain-agent-live-web-search-and-real-time-news.txt", "jsonld": "https://wpnews.pro/news/give-your-langchain-agent-live-web-search-and-real-time-news.jsonld"}}