Web pages your agent fetches and searches

Your agent reads the web and searches it. It fetches a page as markdown, and searches with a key of yours, never one your agent holds.

lnk agent tool add web        # it calls web__fetch, and web__search with a key

Add it

It installs link-web if it's missing, takes the search key from BRAVE_API_KEY or TAVILY_API_KEY, else asks for it (Enter for pages only), and lets your agent call the tool. It restarts your agent with the tool, and --agent <name> picks another agent. Your agent's first lnk agent start offers it too.

Ask it something

Ask "what's in the news in Lisbon today?" and it searches, fetches the stories it found, and answers from them.

What it costs

You need the link-web plugin, which lnk plugin add link-web installs. Fetching a page costs nothing. Searching takes a key from Brave Search or Tavily, whose plans say what a search costs.

By hand

lnk agent tool add web is these three steps: the plugin, the tool with its key, and your agent allowed to call it.

lnk plugin add link-web
BRAVE_API_KEY=... lnk sandbox tool add web --allow fetch --allow search --env BRAVE_API_KEY -- lnk-link-web serve
lnk agent allow --tool web

Search with your key

Link Web searches through Brave Search's API or Tavily's, with the key in its own environment. Your agent and its harness never see the key, because the tool runs outside the agent's sandbox.

TAVILY_API_KEY=tvly-... lnk sandbox tool add web --allow fetch --allow search --env TAVILY_API_KEY -- lnk-link-web serve

With both keys, it uses Brave's unless LNK_WEB_SEARCH=tavily is in its environment too. Without a key, it offers only fetch. A search gives each result's title, address and snippet, and when it was published where the API says. The agent can ask for up to ten results, or only those from the last day, week, month or year.

What a fetch gives

A fetch gives a page as text your agent reads, whatever kind of page it is, within limits of size and time.

A page of HTML

A page of HTML comes as markdown: its headings, paragraphs, lists, tables, code, quotes and links, each link whole so the agent can fetch it next.

What's left out

Scripts, styles, images, menus and forms are left out, and nothing on the page runs. Other text, such as JSON or plain text, comes as it is, while a PDF or an image is refused, by the type its server says, before any of it is downloaded. A page is read up to 5 MB, and a fetch that takes more than 30 s, its page's download included, fails.

Many at once

A round's calls run at once, up to 16; a call past them waits until one is answered. Two pages at a time are made markdown, as a page's markdown takes many times the page while it's made, and a session's fetches share one connection pool.

A long page

A long page comes in parts of 24 KB, about 6,000 tokens, and each part says where the next starts. The page is fetched for its first part, and its next parts come from that copy, kept for 5 minutes (the last 3 pages), so reading a page through fetches it once.

[tool.web] fetch

Set [tool.web] fetch in your agent's spec for larger or smaller parts. Link Harness sends it with each call, and another harness gets 24 KB.

Fetch a page on your network

A page on this computer or your network is never fetched, so the tool can't reach what your agent's sandbox keeps out. Name a host to let it through:

BRAVE_API_KEY=... lnk sandbox tool add web --allow fetch --allow search --env BRAVE_API_KEY -- lnk-link-web serve --private-host wiki.home.arpa

--private-host takes a name or an address, and can be given more than once. Adding the tool again replaces it, so give its key again too.

More about it

Agents Security has the guarantees and gaps, and Agents Decisions why it works this way. To work on its code, see Developing Link Web, and when it doesn't search or fetch, Troubleshooting.

Docs

  • Developing: lnk-link-web is Link Web: an MCP server over stdio with two calls, fetch and search, for any harness to reach as a tool
  • Decisions: How your agent reaches the web, and whose search it uses
  • Troubleshooting: What to do when your agent's web tool doesn't search or fetch a page (Link Web)