Skip to content
  • Auto
  • Light
  • Dark
DiscordForumGitHubSign up

Fetch Webpage

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.

from letta import Letta
client = Letta(token="LETTA_API_KEY")
agent = client.agents.create(
model="openai/gpt-4o",
tools=["fetch_webpage"],
memory_blocks=[{
"label": "persona",
"value": "I can fetch and read webpages to answer questions about online content."
}]
)
ParameterTypeDescription
urlstrThe URL of the webpage to fetch

The tool returns webpage content as text/markdown.

With Exa API (if configured):

{
"title": "Page title",
"published_date": "2025-01-15",
"author": "Author name",
"text": "Full page content in markdown"
}

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

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

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

Terminal window
docker run \
-e EXA_API_KEY="your_exa_api_key" \
letta/letta:latest
agent = client.agents.create(
model="openai/gpt-4o",
tools=["fetch_webpage", "web_search"],
memory_blocks=[{
"label": "persona",
"value": "I search for documentation with web_search and read it with fetch_webpage."
}]
)
agent = client.agents.create(
model="openai/gpt-4o",
tools=["fetch_webpage", "archival_memory_insert"],
memory_blocks=[{
"label": "persona",
"value": "I fetch articles and store key insights in archival memory for later reference."
}]
)
agent = client.agents.create(
model="openai/gpt-4o",
tools=["fetch_webpage"],
memory_blocks=[{
"label": "persona",
"value": "I fetch webpages and provide summaries of their content."
}]
)
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