Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Web Retrieval

jupyterlite-ai supports two kinds of web retrieval:

  1. Local browser fetch with the built-in browser_fetch tool.

  2. Provider-hosted web tools such as web_search or web_fetch.

This page explains how they work, how to configure them, and how fallback works in chat.

Tool Types

browser_fetch (local tool)

Provider-hosted tools

Configured per provider via AI Settings -> Providers -> Configure provider -> Advanced Settings -> Provider Web Tools.

Provider tools run on provider infrastructure and are usually less affected by browser CORS.

Fallback Strategy

When web tools are available, the agent follows this policy:

  1. For a specific URL request, prefer browser_fetch first.

  2. If the first fetch method fails due to access/policy/network issues, try the other fetch method (browser_fetch <-> web_fetch) when available.

  3. If web_fetch fails with provider-side policy errors such as url_not_allowed or url_not_accessible, retry with browser_fetch before search when possible.

  4. Fall back to web_search only after both fetch methods fail or are unavailable.

This behavior is encoded in the agent prompt policy and is intended to keep URL inspection deterministic while still giving a useful fallback path.

Provider Support

OpenAI

Example:

{
  "customSettings": {
    "webSearch": {
      "enabled": true,
      "searchContextSize": "medium",
      "externalWebAccess": true,
      "allowedDomains": ["example.com"]
    }
  }
}

Anthropic

Example:

{
  "customSettings": {
    "webSearch": {
      "enabled": true,
      "maxUses": 5
    },
    "webFetch": {
      "enabled": true,
      "maxUses": 2,
      "maxContentTokens": 12000,
      "citationsEnabled": true
    }
  }
}

Tool Visibility In Chat

Troubleshooting

web_fetch returns url_not_accessible

Common causes:

Try:

web_fetch returns url_not_allowed

Common causes:

If allowedDomains is empty/unset, provider-side policy can still reject some URLs.

When browser_fetch is available, the agent must retry the same URL with browser_fetch before switching to search.

Why web_search may answer without web_fetch

Search tools can already return enough grounded context for the model to answer. A follow-up web_fetch is only used when the model decides it needs direct URL fetch content.

With Anthropic, search results can include opaque fields such as encryptedContent. They are not user-readable but are used by Anthropic’s grounding/citation pipeline across turns.