Skip to main content
Your agent should answer from pages it read today, not from what a model remembers. You build two small tools: one finds pages, one reads a page. The agent chooses which to call, and every answer can point to a URL. You need an API key in STOPHY_API_KEY. See the Quickstart. A question that takes one search and two page reads costs about $0.003.

1. Find pages

Search returns a short list of pages for a query. This request asks for 3 results.
data.web holds the results. Each has a url, a title and usually a description. This is the real answer.
The search cost $0.001. The tool gives the agent titles, URLs and snippets only, so a result is a lead, not evidence. See Search for sources and filters.

2. Read one page

Scrape reads a page the agent picked. maxChars keeps each answer short, so a long page does not fill the agent’s context.
This real answer is cut. The middle of the Markdown and most of metadata are left out.
nextOffset says where the next part starts. Send the same request with "offset": 1493 to read on. The read cost $0.001. See Content filtering.

3. Wrap both as tools

Each tool takes a string and returns a string. A failed call returns the error as text, so the model can try something else instead of the loop crashing.
readPage puts Source: <url> at the top of everything it returns. That line is what lets the agent cite.

4. Describe the tools to the model

Give the model one definition for each tool. The shape below works with the Anthropic, OpenAI and Vercel AI SDK tool calls, with the field names each one uses.
Add one rule to the system prompt: answer only from text the tools returned, and end each claim with the Source: URL it came from.

5. Try the failures first

Before you connect a model, call each tool with input that fails. A page that is not public returns 400 invalidRequest, and the tool turns it into text. This is the real error for http://localhost/admin.
readPage("http://localhost/admin") returned Read failed: url: Expected a public website URL. A failed call costs nothing.

What to check

  • The agent calls search_web first and read_page on one or two of the URLs it got back.
  • Every URL in the answer appeared in a tool result. Open two of them and check the claim.
  • A long page is read in parts with offset, not guessed from the first 1,500 characters.
  • A failing tool leaves the loop running.

What it costs

A search with no results, and a page that cannot be read, cost nothing. See Pricing.
  • Search for sources, filters and page text in the same call.
  • Scrape for formats such as highlights, which returns only the passages that match a query.
  • Rate limits to keep a busy agent under its limits.
  • Research papers for an agent that reads scholarly papers.