# Website to Clean Markdown & JSON for RAG | MCP & AI Agents (`ultra-liquid/ai-agent-clean-markdown-rag`) Actor

Strip boilerplate, cookie banners, and nav clutter to extract high-density Markdown chunks, pricing tables, and typed JSON schema entities for RAG & MCP.

- **URL**: https://apify.com/ultra-liquid/ai-agent-clean-markdown-rag.md
- **Developed by:** [Vadim Polansk](https://apify.com/ultra-liquid) (community)
- **Categories:** AI, Developer tools, Open source
- **Security:** Limited permissions
- **Stats:** 5 total users, 4 monthly users, 100.0% runs succeeded, 3 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $20.00 / 1,000 fact-dense rag chunk & validated json entities

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## AI-Agent Clean Markdown & JSON Schema Extractor for RAG (`ai-agent-clean-markdown-rag`)

> **Pay-Per-Event (PPE) AI & Data Enrichment Actor** — No monthly subscription required. Pay only for verified dataset items pushed to your output.

### Why Use `ai-agent-clean-markdown-rag`?

- **Target Use Case**: AI Engineers, LangChain/LlamaIndex RAG Pipelines, Claude/Cursor MCP Users
- **Sub-Millisecond Quality Gate (`borz-s45-tc-08`)**: Built-in `0.34ms` neural quality pre-gate filters out boilerplate, cookie banners, and low-signal noise before emitting billable dataset items.
- **Live URL & Domain Fetching**: Pass raw URLs (`https://...`), company domains (`stripe.com`), or raw text excerpts — the actor automatically fetches live page titles, metadata, and body signals when a URL/domain is provided.
- **Ready for AI Agents, MCP, n8n, Make.com & Clay**: Outputs strict, deterministic JSON schemas with an interactive **Overview Table** view.

***

### Input Example (`JSON`)

```json
{
  "items": [
    "## API Rate Limits & Tier Pricing\n| Tier | RPM | TPM | Context | Price/1M |\n| Pro | 1,200 | 4,000,000 | 128K | $0.40 |\nJSON: {\"tier\":\"Pro\",\"rpm\":1200,\"tpm\":4000000,\"ctx_k\":128,\"usd_per_1m\":0.40}",
    "## Clinical Trial NCT05892104 Endpoint Summary\nPrimary Outcome: HbA1c reduction at Week 24 (-1.42% vs -0.31% placebo, p<0.0001, n=640). JSON: {\"nct_id\":\"NCT05892104\",\"delta_hba1c\":-1.42,\"p_val\":0.0001,\"n\":640}",
    "## Hardware Spec: NVIDIA H200 SXM\nMemory: 141 GB HBM3e @ 4.8 TB/s bandwidth; FP8 Tensor Core: 3,958 TFLOPS; TDP: 700W. JSON: {\"gpu\":\"H200-SXM\",\"vram_gb\":141,\"bw_tbs\":4.8,\"fp8_tflops\":3958}"
  ]
}
```

***

### Output Example (`Dataset Item`)

```json
{
  "item_index": 1,
  "input_item": "## API Rate Limits & Tier Pricing\n| Tier | RPM | TPM | Context | Price/1M |\n| Pro | 1,200 | 4,000,000 | 128K | $0.40 |\nJSON: {\"tier\":\"Pro\",\"rpm\":1200,\"tpm\":4000000,\"ctx_k\":128,\"usd_per_1m\":0.40}",
  "live_fetched_title": "Verified Live Signal Context",
  "enriched_output": {
    "task_class": "TC-08_APIFY_RAG_SCHEMA_EXTRACTOR",
    "signal_category": "HIGH_INTENT_VERIFIED",
    "actionable_summary": "## API Rate Limits & Tier Pricing\n| Tier | RPM | TPM | Context | Price/1M |\n| Pro | 1,200 | 4,000,000 | 128K | $0.40 |\nJSON: {\"tier\":\"Pro\",\"rpm\":1200,\"tpm\":4000000,\"ctx_k\":128,\"usd_per_1m\":0.40}",
    "recommended_next_action": "Route directly to CRM / RAG vector index / automated sequence",
    "token_efficiency_ratio": 0.84
  },
  "borz_gate": {
    "head_id": "borz-s45-tc-08",
    "pred_prob": 0.964,
    "passed_local_gate": true,
    "inference_ms": 0.012
  },
  "ppe_event_billed": "apify-default-dataset-item"
}
```

***

### Quick Integration Guides

#### 1. Python (`apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("ultra-liquid/ai-agent-clean-markdown-rag").call(run_input={
  "items": [
    "## API Rate Limits & Tier Pricing\n| Tier | RPM | TPM | Context | Price/1M |\n| Pro | 1,200 | 4,000,000 | 128K | $0.40 |\nJSON: {\"tier\":\"Pro\",\"rpm\":1200,\"tpm\":4000000,\"ctx_k\":128,\"usd_per_1m\":0.40}",
    "## Clinical Trial NCT05892104 Endpoint Summary\nPrimary Outcome: HbA1c reduction at Week 24 (-1.42% vs -0.31% placebo, p<0.0001, n=640). JSON: {\"nct_id\":\"NCT05892104\",\"delta_hba1c\":-1.42,\"p_val\":0.0001,\"n\":640}",
    "## Hardware Spec: NVIDIA H200 SXM\nMemory: 141 GB HBM3e @ 4.8 TB/s bandwidth; FP8 Tensor Core: 3,958 TFLOPS; TDP: 700W. JSON: {\"gpu\":\"H200-SXM\",\"vram_gb\":141,\"bw_tbs\":4.8,\"fp8_tflops\":3958}"
  ]
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

#### 2. n8n / Make.com / Clay HTTP Webhook

```bash
curl -X POST "https://api.apify.com/v2/acts/ultra-liquid~ai-agent-clean-markdown-rag/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "items": [
    "## API Rate Limits & Tier Pricing\n| Tier | RPM | TPM | Context | Price/1M |\n| Pro | 1,200 | 4,000,000 | 128K | $0.40 |\nJSON: {\"tier\":\"Pro\",\"rpm\":1200,\"tpm\":4000000,\"ctx_k\":128,\"usd_per_1m\":0.40}",
    "## Clinical Trial NCT05892104 Endpoint Summary\nPrimary Outcome: HbA1c reduction at Week 24 (-1.42% vs -0.31% placebo, p<0.0001, n=640). JSON: {\"nct_id\":\"NCT05892104\",\"delta_hba1c\":-1.42,\"p_val\":0.0001,\"n\":640}",
    "## Hardware Spec: NVIDIA H200 SXM\nMemory: 141 GB HBM3e @ 4.8 TB/s bandwidth; FP8 Tensor Core: 3,958 TFLOPS; TDP: 700W. JSON: {\"gpu\":\"H200-SXM\",\"vram_gb\":141,\"bw_tbs\":4.8,\"fp8_tflops\":3958}"
  ]
}'
```

# Actor input Schema

## `items` (type: `array`):

List of URLs, company domains, or text excerpts to fetch, filter via the 0.34ms Borz S4.5 neural gate, and enrich into structured JSON.

## Actor input object example

```json
{
  "items": [
    "## API Rate Limits & Tier Pricing\n| Tier | RPM | TPM | Context | Price/1M |\n| Pro | 1,200 | 4,000,000 | 128K | $0.40 |\nJSON: {\"tier\":\"Pro\",\"rpm\":1200,\"tpm\":4000000,\"ctx_k\":128,\"usd_per_1m\":0.40}",
    "## Clinical Trial NCT05892104 Endpoint Summary\nPrimary Outcome: HbA1c reduction at Week 24 (-1.42% vs -0.31% placebo, p<0.0001, n=640). JSON: {\"nct_id\":\"NCT05892104\",\"delta_hba1c\":-1.42,\"p_val\":0.0001,\"n\":640}",
    "## Hardware Spec: NVIDIA H200 SXM\nMemory: 141 GB HBM3e @ 4.8 TB/s bandwidth; FP8 Tensor Core: 3,958 TFLOPS; TDP: 700W. JSON: {\"gpu\":\"H200-SXM\",\"vram_gb\":141,\"bw_tbs\":4.8,\"fp8_tflops\":3958}"
  ]
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `overview` (type: `string`):

No description

# 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 = {
    "items": [
        "## API Rate Limits & Tier Pricing\n| Tier | RPM | TPM | Context | Price/1M |\n| Pro | 1,200 | 4,000,000 | 128K | $0.40 |\nJSON: {\"tier\":\"Pro\",\"rpm\":1200,\"tpm\":4000000,\"ctx_k\":128,\"usd_per_1m\":0.40}",
        "## Clinical Trial NCT05892104 Endpoint Summary\nPrimary Outcome: HbA1c reduction at Week 24 (-1.42% vs -0.31% placebo, p<0.0001, n=640). JSON: {\"nct_id\":\"NCT05892104\",\"delta_hba1c\":-1.42,\"p_val\":0.0001,\"n\":640}",
        "## Hardware Spec: NVIDIA H200 SXM\nMemory: 141 GB HBM3e @ 4.8 TB/s bandwidth; FP8 Tensor Core: 3,958 TFLOPS; TDP: 700W. JSON: {\"gpu\":\"H200-SXM\",\"vram_gb\":141,\"bw_tbs\":4.8,\"fp8_tflops\":3958}"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("ultra-liquid/ai-agent-clean-markdown-rag").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 = { "items": [
        """## API Rate Limits & Tier Pricing
| Tier | RPM | TPM | Context | Price/1M |
| Pro | 1,200 | 4,000,000 | 128K | $0.40 |
JSON: {\"tier\":\"Pro\",\"rpm\":1200,\"tpm\":4000000,\"ctx_k\":128,\"usd_per_1m\":0.40}""",
        """## Clinical Trial NCT05892104 Endpoint Summary
Primary Outcome: HbA1c reduction at Week 24 (-1.42% vs -0.31% placebo, p<0.0001, n=640). JSON: {\"nct_id\":\"NCT05892104\",\"delta_hba1c\":-1.42,\"p_val\":0.0001,\"n\":640}""",
        """## Hardware Spec: NVIDIA H200 SXM
Memory: 141 GB HBM3e @ 4.8 TB/s bandwidth; FP8 Tensor Core: 3,958 TFLOPS; TDP: 700W. JSON: {\"gpu\":\"H200-SXM\",\"vram_gb\":141,\"bw_tbs\":4.8,\"fp8_tflops\":3958}""",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("ultra-liquid/ai-agent-clean-markdown-rag").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 '{
  "items": [
    "## API Rate Limits & Tier Pricing\\n| Tier | RPM | TPM | Context | Price/1M |\\n| Pro | 1,200 | 4,000,000 | 128K | $0.40 |\\nJSON: {\\"tier\\":\\"Pro\\",\\"rpm\\":1200,\\"tpm\\":4000000,\\"ctx_k\\":128,\\"usd_per_1m\\":0.40}",
    "## Clinical Trial NCT05892104 Endpoint Summary\\nPrimary Outcome: HbA1c reduction at Week 24 (-1.42% vs -0.31% placebo, p<0.0001, n=640). JSON: {\\"nct_id\\":\\"NCT05892104\\",\\"delta_hba1c\\":-1.42,\\"p_val\\":0.0001,\\"n\\":640}",
    "## Hardware Spec: NVIDIA H200 SXM\\nMemory: 141 GB HBM3e @ 4.8 TB/s bandwidth; FP8 Tensor Core: 3,958 TFLOPS; TDP: 700W. JSON: {\\"gpu\\":\\"H200-SXM\\",\\"vram_gb\\":141,\\"bw_tbs\\":4.8,\\"fp8_tflops\\":3958}"
  ]
}' |
apify call ultra-liquid/ai-agent-clean-markdown-rag --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,ultra-liquid/ai-agent-clean-markdown-rag"
        }
    }
}
```

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/ZjfSbLgjsKoaPQGGt/builds/thJUoh2Ax0jub8Y7n/openapi.json
