Fetch Webpage

Convert webpages to readable text/markdown

The fetch_webpage tool enables Letta agents to fetch and convert webpages into readable text or markdown format. Useful for reading documentation, articles, and web content.

On Letta Cloud, this tool works out of the box. For self-hosted deployments with an Exa API key, fetching is enhanced. Without a key, it falls back to open-source extraction tools.

Quick Start

1from letta import Letta
2
3client = Letta(token="LETTA_API_KEY")
4
5agent = client.agents.create(
6 model="openai/gpt-4o",
7 tools=["fetch_webpage"],
8 memory_blocks=[{
9 "label": "persona",
10 "value": "I can fetch and read webpages to answer questions about online content."
11 }]
12)

Tool Parameters

ParameterTypeDescription
urlstrThe URL of the webpage to fetch

Return Format

The tool returns webpage content as text/markdown.

With Exa API (if configured):

1{
2 "title": "Page title",
3 "published_date": "2025-01-15",
4 "author": "Author name",
5 "text": "Full page content in markdown"
6}

Fallback (without Exa): Returns markdown-formatted text extracted from the HTML.

How It Works

The tool uses a multi-tier approach:

  1. Exa API (if EXA_API_KEY is configured): Uses Exa’s content extraction
  2. Trafilatura (fallback): Open-source text extraction to markdown
  3. Readability + html2text (final fallback): HTML cleaning and conversion

Self-Hosted Setup

For enhanced fetching on self-hosted servers, optionally configure an Exa API key. Without it, the tool still works using open-source extraction.

Optional: Configure Exa

$docker run \
> -e EXA_API_KEY="your_exa_api_key" \
> letta/letta:latest

Common Patterns

Documentation Reader

1agent = client.agents.create(
2 model="openai/gpt-4o",
3 tools=["fetch_webpage", "web_search"],
4 memory_blocks=[{
5 "label": "persona",
6 "value": "I search for documentation with web_search and read it with fetch_webpage."
7 }]
8)

Research Assistant

1agent = client.agents.create(
2 model="openai/gpt-4o",
3 tools=["fetch_webpage", "archival_memory_insert"],
4 memory_blocks=[{
5 "label": "persona",
6 "value": "I fetch articles and store key insights in archival memory for later reference."
7 }]
8)

Content Summarizer

1agent = client.agents.create(
2 model="openai/gpt-4o",
3 tools=["fetch_webpage"],
4 memory_blocks=[{
5 "label": "persona",
6 "value": "I fetch webpages and provide summaries of their content."
7 }]
8)

When to Use

Use CaseToolWhy
Read specific webpagefetch_webpageDirect URL access
Find webpages to readweb_searchDiscovery first
Read + search in oneweb_search with include_text=trueCombined operation
Multiple pagesfetch_webpageIterate over URLs