# Site to Agent Feed (URL to RAG-ready Markdown) (`constant_quadruped/site-to-agent-feed`) Actor

Turn any URL into clean, RAG-ready Markdown + structured JSON for LLMs and AI agents. Self-healing main-content extraction (survives redesigns), headings/links/tables, optional change-detection. No paid APIs.

- **URL**: https://apify.com/constant\_quadruped/site-to-agent-feed.md
- **Developed by:** [CQ](https://apify.com/constant_quadruped) (community)
- **Categories:** Agents, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Site to Agent Feed (URL → RAG-ready Markdown)

Give it any URL(s); get back **clean Markdown + structured JSON** built for LLMs and AI agents — main-content extraction (via [trafilatura](https://trafilatura.readthedocs.io/), which adapts to page layout instead of relying on brittle CSS selectors), plus title, headings, links, and a table count. Optional **change-detection** turns it into a site monitor.

### Why
Agents and RAG pipelines want **Markdown as a first-class return type** (not raw HTML), and extraction that doesn't break on every redesign. Pairs well with MCP-based agent stacks.

### How it works
1. Fetches each URL's HTML over HTTP (`httpx`).
2. Extracts the main content with trafilatura → Markdown + plain text. Falls back to a BeautifulSoup strip + markdownify if trafilatura returns nothing.
3. Pulls structure (title, h1–h3 headings, links, table count) with BeautifulSoup.
4. If `detectChanges` is on, stores a content hash per URL and sets `changed: true` when it differs from the previous run.

### Per-URL output
Each successfully fetched page produces a Dataset item with:
`url`, `fetched_at` (UTC ISO timestamp), `title`, `markdown`, `headings[]` (h1–h3, capped at 50), `links[]` (`{text, href}`, capped at 200), `table_count`, `word_count`, `content_hash` (SHA-256 of the extracted text), and (if `detectChanges`) `changed`. The raw `text` field is included only when `outputFormat: "both"`. `text` and `markdown` are truncated to `maxChars` per page.

If a URL fails to fetch, its item is just `{ "url": ..., "error": ... }`.

> **`outputFormat`:** `"markdown"` (default) returns the structured item with `markdown` (no raw `text` field); `"both"` additionally includes the raw extracted `text`. `markdown`, headings, links, and all other structured fields are always present in both modes.

### Use as a monitor
Schedule it with `detectChanges: true` — each run flags which pages changed, so an agent only re-ingests what's new.

### Limitations — read this
- **Server-rendered HTML only. No JavaScript execution.** It uses a plain HTTP fetch, not a browser. Single-page apps and content injected by JS will be missing or sparse. Use a browser-based scraper for those.
- **Heavily bot-protected sites return 403.** Sites behind Akamai/Cloudflare-class bot protection (e.g. **SEC.gov, FINRA.org**) block non-browser TLS fingerprints and will fail even through residential proxy. This lightweight fetcher is for normal/server-rendered pages; use a real-browser scraper for those. Optional Apify Proxy (off by default) helps only with simple datacenter-IP blocks, not bot-protection.
- **Extraction quality depends on trafilatura.** On unusual layouts it may grab too much or too little; the fallback is a coarse text strip.
- **Change-detection is whole-page hashing.** Any change (including dynamic timestamps, view counters, or rotating banners) flips `changed` to true — it does not diff *what* changed.
- **No anti-bot handling, JS challenges, logins, or pagination.** Pages behind Cloudflare/auth or requiring clicks won't work.
- `links` and `headings` are capped (200 / 50) and may be truncated on large pages.
- Respects nothing beyond a basic User-Agent; you are responsible for honoring each site's terms and robots policy.

# Actor input Schema

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

Pages to convert into clean Markdown + structured data for agents/RAG. Works on normal/server-rendered pages; heavily bot-protected sites (e.g. SEC.gov, FINRA, Cloudflare-gated) will return a 403 — those need a browser-based scraper.
## `outputFormat` (type: `string`):

Choose Markdown + structured JSON, or also include the raw extracted text.
## `detectChanges` (type: `boolean`):

Remember each URL's content hash and flag `changed: true` when it differs — turns this into a site-change monitor for agents.
## `maxChars` (type: `integer`):

Truncate each page's markdown and text to at most this many characters.
## `proxyConfiguration` (type: `object`):

Optional. Route requests through Apify Proxy to get past datacenter-IP blocks on some sites. Off by default (direct = cheapest, fine for most pages). Enable RESIDENTIAL for stubborn sites — note it does NOT defeat Akamai/Cloudflare bot protection (e.g. SEC.gov still blocks). The actor falls back to a direct request if a proxy attempt fails.

## Actor input object example

```json
{
  "urls": [
    "https://en.wikipedia.org/wiki/Retrieval-augmented_generation"
  ],
  "outputFormat": "markdown",
  "detectChanges": false,
  "maxChars": 50000,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
````

# Actor output Schema

## `feeds` (type: `string`):

Per-URL Markdown + structured metadata records in the default dataset.

# 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 = {
    "urls": [
        "https://en.wikipedia.org/wiki/Retrieval-augmented_generation"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("constant_quadruped/site-to-agent-feed").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 = { "urls": ["https://en.wikipedia.org/wiki/Retrieval-augmented_generation"] }

# Run the Actor and wait for it to finish
run = client.actor("constant_quadruped/site-to-agent-feed").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "urls": [
    "https://en.wikipedia.org/wiki/Retrieval-augmented_generation"
  ]
}' |
apify call constant_quadruped/site-to-agent-feed --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=constant_quadruped/site-to-agent-feed",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Site to Agent Feed (URL to RAG-ready Markdown)",
        "description": "Turn any URL into clean, RAG-ready Markdown + structured JSON for LLMs and AI agents. Self-healing main-content extraction (survives redesigns), headings/links/tables, optional change-detection. No paid APIs.",
        "version": "1.0",
        "x-build-id": "h82oHaaArTgd2kVj4"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/constant_quadruped~site-to-agent-feed/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-constant_quadruped-site-to-agent-feed",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/constant_quadruped~site-to-agent-feed/runs": {
            "post": {
                "operationId": "runs-sync-constant_quadruped-site-to-agent-feed",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/constant_quadruped~site-to-agent-feed/run-sync": {
            "post": {
                "operationId": "run-sync-constant_quadruped-site-to-agent-feed",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "urls"
                ],
                "properties": {
                    "urls": {
                        "title": "URLs",
                        "type": "array",
                        "description": "Pages to convert into clean Markdown + structured data for agents/RAG. Works on normal/server-rendered pages; heavily bot-protected sites (e.g. SEC.gov, FINRA, Cloudflare-gated) will return a 403 — those need a browser-based scraper.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "outputFormat": {
                        "title": "Output format",
                        "enum": [
                            "markdown",
                            "both"
                        ],
                        "type": "string",
                        "description": "Choose Markdown + structured JSON, or also include the raw extracted text.",
                        "default": "markdown"
                    },
                    "detectChanges": {
                        "title": "Detect changes across runs",
                        "type": "boolean",
                        "description": "Remember each URL's content hash and flag `changed: true` when it differs — turns this into a site-change monitor for agents.",
                        "default": false
                    },
                    "maxChars": {
                        "title": "Max characters per page",
                        "minimum": 1000,
                        "maximum": 500000,
                        "type": "integer",
                        "description": "Truncate each page's markdown and text to at most this many characters.",
                        "default": 50000
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Optional. Route requests through Apify Proxy to get past datacenter-IP blocks on some sites. Off by default (direct = cheapest, fine for most pages). Enable RESIDENTIAL for stubborn sites — note it does NOT defeat Akamai/Cloudflare bot protection (e.g. SEC.gov still blocks). The actor falls back to a direct request if a proxy attempt fails.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
