Skip to main content
Give your agent a search tool and a page reader so it cites what it read instead of answering from memory. You need STOPHY_API_KEY. See the Quickstart.

1. Find pages

data.web holds results with a url, title, description and position. These are leads, not evidence. See Search for sources and filters.

2. Read one page

maxChars keeps a long page from filling the agent’s context.
The text is in data.markdown. When it was cut, data.nextOffset says where the next part starts, and data.warning says so. Send the same request with "offset": <nextOffset> to read on. See Content filtering.

3. Wrap both as tools

Return text the model can read, and turn an error into text so it can try another input. Source: <url> at the top of each page is what lets the agent cite.

4. Describe the tools to the model

Register search_web with a required string query, and say it returns titles, URLs and snippets without reading pages. Register read_page with a required string url and an optional integer offset. Use your provider’s schema, as in LLM SDKs. 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.

Check it

  • A non-public URL such as http://localhost/admin fails with invalidRequest, and the loop keeps running.
  • The agent calls search_web first, then read_page on one or two results.
  • Every URL in the answer appeared in a tool result. Open two and check the claim.
  • A long page is read in parts with offset, not guessed from the first 1,500 characters.
See Pricing and Rate limits for a busy agent. For scholarly sources, see Research papers.