# Agent Web Reader: Search + URL to Markdown for LLMs (`catalyst-labs/agent-web-reader`) Actor

Web search or URLs in, clean markdown out, one JSON row per page with source URL, title and status. $0.002 per page, $0.003 per search; failed URLs never charged. Token budget per result, HTML and PDF, errors returned as rows instead of crashing the call. Built for agents.

- **URL**: https://apify.com/catalyst-labs/agent-web-reader.md
- **Developed by:** [Catalyst Labs](https://apify.com/catalyst-labs) (community)
- **Categories:** AI, Developer tools, Automation
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 page reads

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Agent Web Reader: web search + URL to clean markdown for AI agents

### Why agents pick this

- **$0.003 per search, $0.002 per page read.** A query plus 3 pages costs $0.010. 404s, timeouts, blocks and empty pages are returned as rows with an `errorCode` and are never charged.
- **One flat row per page**, with `url`, `title`, `markdown`, `status`. That makes citations trivial and needs no HTML clean-up.
- **Fits your context window.** `maxCharsPerResult` cuts at a paragraph boundary, and summary mode returns less.
- **One bad link never sinks the batch.** Every URL gets its own status row.

**What it does:** give it a search `query` and/or a list of `urls`; get back one JSON row per page with clean main-content **markdown**, `title`, source `url`, `status` and, on failure, an `errorCode` + `errorMessage`. Reads HTML pages and PDFs. Built for LLM tool calls: small outputs, a per-result character budget, and a summary mode.

**Use it when** an agent needs to: answer a question from the live web with citations, read a link a user pasted, read a PDF from a URL, or triage several pages cheaply.

**Don't use it for:** pages behind a login or paywall, sites that only render with heavy JavaScript (SPAs; you get `EMPTY_CONTENT`), crawling a whole site (use a crawler), screenshots (use `catalyst-labs/website-screenshot-pdf-api`), or DOCX/XLSX files (use `catalyst-labs/document-to-markdown`).

### Cost per call

| Event | Price | When |
|---|---|---|
| `search` | $0.003 | once per query that returned results |
| `page` | $0.002 | per page or PDF read successfully |
| `actor-start` | $0.001 | once per batch run (not charged in Standby/HTTP mode) |

Typical call: `query` + 3 results = $0.001 + $0.003 + 3 x $0.002 = **$0.010**. Reading one URL = **$0.003**. Errors (404, timeout, blocked, empty, scanned PDF) are **never charged**. Set `maxTotalChargeUsd` on the run to cap spend; when the cap is reached remaining URLs return `SPENDING_LIMIT` rows instead of being fetched.

### Input (only `query` or `urls` is required)

```json
{ "query": "what is the model context protocol", "maxResults": 3, "maxCharsPerResult": 4000 }
```

```json
{ "urls": ["https://arxiv.org/pdf/1706.03762", "https://en.wikipedia.org/wiki/Model_Context_Protocol"], "outputMode": "summary" }
```

| Field | Default | Notes |
|---|---|---|
| `query` | – | Web search; top `maxResults` results are opened. |
| `urls` | – | Up to 50 URLs (HTML or PDF). Combine with `query` if you like. |
| `maxResults` | 3 | 1-10 search results to read. |
| `maxCharsPerResult` | 6000 | Token budget per result (~4 chars per token). Cut on a paragraph boundary. |
| `outputMode` | `markdown` | `summary` = lead paragraphs + section outline, max 1,500 chars. |
| `includeLinks` | false | Keep `[text](url)` links. |
| `fullPage` | false | Whole page body instead of main-article extraction (list/index pages). |
| `country` | – | 2-letter code for localized search. |
| `maxPdfPages` | 50 | Pages read per PDF. |
| `timeoutSecs` | 15 | Per-URL timeout; slow URLs become error rows. |

### Output (one flat row per page; same fields every time)

```json
{
  "status": "ok",
  "url": "https://en.wikipedia.org/wiki/Model_Context_Protocol",
  "finalUrl": "https://en.wikipedia.org/wiki/Model_Context_Protocol",
  "title": "Model Context Protocol",
  "markdown": "The Model Context Protocol (MCP) is an open standard ...",
  "chars": 4000, "totalChars": 16749, "truncated": true,
  "source": "search", "searchRank": 1, "query": "what is the model context protocol",
  "contentType": "text/html", "fetchedAt": "2026-10-25T05:01:12.000Z", "ms": 384,
  "errorCode": null, "errorMessage": null
}
```

```json
{ "status": "error", "url": "https://example.com/missing", "markdown": null, "errorCode": "HTTP_404", "errorMessage": "The server answered 404." }
```

Error codes: `INVALID_URL`, `DNS_NOT_FOUND`, `TIMEOUT`, `HTTP_403`/`HTTP_429` (site blocked bots), `HTTP_404`, `NO_TEXT_LAYER` (scanned PDF), `EMPTY_CONTENT`, `UNSUPPORTED_TYPE`, `TOO_LARGE`, `PARSE_FAILED`, `SEARCH_FAILED`, `SPENDING_LIMIT`. One bad URL never fails the run. The `OUTPUT` key-value record holds all rows plus `searchEngine`, `okCount`, `errorCount` and `chargedEvents`.

### Fast calls: Standby (HTTP) mode

The Actor runs in Apify Standby mode, so it answers like an API with no cold start per call:

```bash
curl "https://catalyst-labs--agent-web-reader.apify.actor/?query=apify%20mcp&maxResults=2&token=$APIFY_TOKEN"
curl -X POST "https://catalyst-labs--agent-web-reader.apify.actor/?token=$APIFY_TOKEN" -H 'content-type: application/json' -d '{"urls":["https://example.com"]}'
```

Response: `{ "status": "ok", "query": ..., "searchEngine": ..., "results": [ ...rows... ] }`.

### Use from MCP (Claude, Cursor, ChatGPT, any MCP client)

`https://mcp.apify.com/?tools=catalyst-labs/agent-web-reader` (Apify token as Bearer auth). The tool appears as `catalyst-labs--agent-web-reader`.

### How it works

Search: Bing, with DuckDuckGo and Google (Apify SERP proxy) fallbacks; `searchEngine` tells you which answered. Pages are fetched directly with a datacenter-proxy retry when a site blocks; main content is extracted (Mozilla Readability) and converted to GitHub-flavored markdown (tables kept); scripts, nav, footers and images are dropped (image alt text kept). PDFs are converted page by page with `## Page N` headings.

Same input gives the same rows in the same order (search ranks can change over time as the web does). Respect the sites you read; this tool does not bypass logins or paywalls.

Made by Catalyst Labs. Also see: YouTube Transcript API, Document to Markdown, Google Trends API, Website Screenshot & PDF API.

# Actor input Schema

## `query` (type: `string`):

Web search query. The top `maxResults` results are opened and returned as markdown. Leave empty if you only pass `urls`.

## `urls` (type: `array`):

Pages or PDF links to read directly (max 50). Can be combined with `query`.

## `maxResults` (type: `integer`):

How many search results to open (1-10). Default 3.

## `maxCharsPerResult` (type: `integer`):

Token budget: each result's markdown is cut at a paragraph boundary to this many characters (about 4 characters = 1 token). Default 6000 (~1,500 tokens). `totalChars` and `truncated` tell you what was cut.

## `outputMode` (type: `string`):

`markdown` returns the main content; `summary` returns a short lead + outline to triage many pages cheaply in tokens. Same price.

## `includeLinks` (type: `boolean`):

Keep `[text](url)` links in the markdown. Off by default to save tokens.

## `fullPage` (type: `boolean`):

Return the whole page body instead of the extracted main article. Use for list/index pages.

## `country` (type: `string`):

Optional 2-letter country code for localized search results, e.g. `us`, `gb`, `de`.

## `maxPdfPages` (type: `integer`):

Read at most this many pages of each PDF. Default 50.

## `timeoutSecs` (type: `integer`):

Give up on a URL after this many seconds and return an error row for it (not charged). Default 15.

## Actor input object example

```json
{
  "query": "apify mcp server pricing",
  "maxResults": 3,
  "maxCharsPerResult": 6000,
  "outputMode": "markdown",
  "includeLinks": false,
  "fullPage": false,
  "maxPdfPages": 50,
  "timeoutSecs": 15
}
```

# Actor output Schema

## `results` (type: `string`):

One row per page: status, url, title, markdown, chars, truncated, errorCode, errorMessage.

## `summary` (type: `string`):

query, searchEngine, okCount, errorCount, chargedEvents, results.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "apify mcp server pricing"
};

// Run the Actor and wait for it to finish
const run = await client.actor("catalyst-labs/agent-web-reader").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "query": "apify mcp server pricing" }

# Run the Actor and wait for it to finish
run = client.actor("catalyst-labs/agent-web-reader").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "apify mcp server pricing"
}' |
apify call catalyst-labs/agent-web-reader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,catalyst-labs/agent-web-reader"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/dhQhaDOKspsUYRtUr/builds/NXAHzWemhmfv5tauu/openapi.json
