AgentFetch

How do LLMs get real-time web data?

LLMs get real-time web data at inference time, not training time: the model calls a tool that searches or fetches the live web, and the retrieved text is placed in its context window before it answers. A model's weights are frozen at its training cutoff, so anything newer — today's prices, a changelog published this morning, breaking news — has to arrive through retrieval. The pipeline has four steps:

  1. Decide what is missing. The model recognizes that the answer depends on current information and emits a tool call.
  2. Find sources. With no URL in hand, a search step returns candidate pages. AgentFetch's search_and_fetch collapses search and retrieval into one round-trip, fetching the top 3 results by default (up to 10) at 2,000 tokens each unless you change max_tokens_each.
  3. Read the pages. A fetch layer converts each page to clean markdown. fetch_url handles single URLs, including JS-rendered pages and PDFs; fetch_multiple retrieves up to 20 URLs concurrently.
  4. Ground the answer. The retrieved markdown, plus metadata such as title, published date, and token count, goes into the prompt and the model answers from it.

"Real-time" also has a caching dimension. Fetch layers cache to cut cost and latency; AgentFetch serves repeat reads of a page from a cache that is at most six hours old. That is the right default for documentation and reference pages, but for data that changes minute to minute — live prices, scores, breaking news — set use_cache to false so the agent reads the current page. Control volume as well as freshness: cap max_tokens per page and check estimate_tokens before pulling a long document, so real-time web data reaches the LLM without overrunning its context window.