Live web search and real-time news for the OpenAI Agents SDK
Add NestDaddy news search and page reading to an OpenAI Agents SDK agent with function_tool, on OpenAI models or any OpenAI-compatible model such as a local one in Ollama.
The OpenAI Agents SDK wraps any Python function as a tool with function_tool. Two small functions give your agent today's news and the full text of any article.
Install
pip install openai-agents requests
export NESTDADDY_API_KEY="your-key"
Get a key at nestdaddy.com/mcp (free plan: 1,000 calls a month, no card).
The tools
import os, requests
API = "https://nestdaddy.com/api/v1"
HEADERS = {"X-API-Key": os.environ["NESTDADDY_API_KEY"]}
def news_search(query: str, days: int = 3) -> list[dict]:
"""Search the latest news. Use it for anything that happened recently.
Args:
query: Short key words, like a search box.
days: How many days back to search, 1 to 30.
"""
r = requests.get(f"{API}/news/search", headers=HEADERS, timeout=30,
params={"q": query, "days": days, "limit": 5})
r.raise_for_status()
return [{"title": a["title"], "source": a.get("source_domain"),
"date": a.get("published_timestamp"), "url": a["url"]}
for a in r.json().get("results", [])]
def read_page(url: str) -> str:
"""Read the full text of a web page, for example a news article.
Args:
url: The full URL.
"""
r = requests.get(f"{API}/extract", headers=HEADERS, timeout=30, params={"url": url})
r.raise_for_status()
return r.json().get("text", "")[:4000]
The agent
With OpenAI models, leave out model= and set OPENAI_API_KEY. The example below runs a free local model through Ollama instead:
from datetime import date
from agents import Agent, AsyncOpenAI, OpenAIChatCompletionsModel, Runner, function_tool, set_tracing_disabled
set_tracing_disabled(True) # tracing uploads to OpenAI; off for a local model
model = OpenAIChatCompletionsModel(model="qwen2.5:7b",
openai_client=AsyncOpenAI(base_url="http://localhost:11434/v1", api_key="ollama"))
agent = Agent(name="News agent", model=model,
instructions=(f"Today is {date.today()}. Use your tools for anything recent. Search results are only "
"headlines: before you give details, read the best article with read_page. "
"Only state facts you found, and cite the URLs."),
tools=[function_tool(news_search), function_tool(read_page)])
result = Runner.run_sync(agent, "What happened in AI today? Give 3 headlines with links.")
print(result.final_output)
What we got
Run on 14 November 2026 with openai-agents 0.24 and qwen2.5:7b, the agent called news_search {"query":"AI","days":1} and answered with three of that day's AI headlines, each with its link (CryptoBriefing, BeInCrypto, Arab News).
Want the same tools without writing them? The NestDaddy MCP server works with the SDK's MCP support too: point an MCPServerStreamableHttp at https://mcp.nestdaddy.com/mcp with an Authorization: Bearer YOUR_KEY header.
