Web fetch
Fetches an HTTP(S) URL and returns its content. Two modes are available,
configured at construction time via make_web_fetch / makeWebFetch:
agentic(default): HTML is converted to markdown and passed to an analyst agent that answers aprompt, so the full page never enters the main agent’s context. Use when targeted answers are needed about potentially large pages.markdown: HTML is converted to clean markdown with scripts, styles, and noise stripped. Use when the agent needs full pages for reasoning.
The max_bytes / maxBytes parameter caps the HTTP response size (default 5 MiB);
max_content_chars / maxContentChars caps the extracted content delivered to the model or
analyst (default 50,000 characters). For mode='agentic' / mode: 'agentic',
the factory also accepts a model for the analyst; agent.aux_modelagent.auxModel
The Python tool delegates all networking to an httpx.AsyncClient. Use the
make_web_fetch factory to supply a pre-configured client with custom
timeouts, redirects, proxies, or caching.
Supported in: Node.js (TypeScript); Python (all platforms).
Example:
import { Agent } from '@strands-agents/sdk'import { webFetch } from '@strands-agents/sdk/vended-tools/web-fetch'
const agent = new Agent({ tools: [webFetch] })await agent.invoke('Summarize https://example.com/blog/post')Reading the full page as markdown:
import { Agent } from '@strands-agents/sdk'import { makeWebFetch } from '@strands-agents/sdk/vended-tools/web-fetch'
const webFetch = makeWebFetch({ mode: 'markdown' })const agent = new Agent({ tools: [webFetch] })await agent.invoke('Read https://example.com/docs and explain the architecture')Tighter response cap with a dedicated analyst model:
import { Agent } from '@strands-agents/sdk'import { makeWebFetch } from '@strands-agents/sdk/vended-tools/web-fetch'import { BedrockModel } from '@strands-agents/sdk/models/bedrock'
const webFetch = makeWebFetch({ mode: 'agentic', maxBytes: 1 * 1024 * 1024, maxContentChars: 25_000, model: new BedrockModel({ modelId: 'us.amazon.nova-micro-v1:0' }),})const agent = new Agent({ tools: [webFetch] })from strands import Agentfrom strands.vended_tools import web_fetch
agent = Agent(tools=[web_fetch])agent("What is the pricing for the enterprise plan at https://example.com/pricing")Reading the full page as markdown:
from strands import Agentfrom strands.vended_tools import make_web_fetch
web_fetch = make_web_fetch(mode="markdown")agent = Agent(tools=[web_fetch])agent("Read https://example.com/docs and then explain the architecture")Tighter response cap with a dedicated analyst model and custom transport:
import httpxfrom strands import Agentfrom strands.models import BedrockModelfrom strands.vended_tools import make_web_fetch
web_fetch = make_web_fetch( mode="agentic", client=httpx.AsyncClient(timeout=10.0), max_bytes=1 * 1024 * 1024, max_content_chars=25_000, model=BedrockModel(model_id="us.amazon.nova-micro-v1:0"),)agent = Agent(tools=[web_fetch])