# RAG Web Search - Results as Markdown for AI (`aolmo/rag-web-search`) Actor

Web search for AI agents and RAG: for any query you get the top results with title, URL and snippet, plus each page converted to clean Markdown with its title, author and date. Region and time filters, search-only mode. $0.001 per result, free when a page cannot be read.

- **URL**: https://apify.com/aolmo/rag-web-search.md
- **Developed by:** [Antonio del Olmo Tena](https://apify.com/aolmo) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 result scrapeds

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

Give your AI agent or RAG pipeline live web knowledge in one call. Send a search query and the Actor returns the top web results with title, URL and snippet, and opens each result to give you the page as clean Markdown: main content only, with title, author, publish date and language. Ready to drop into an LLM prompt, a vector database or an agent tool.

No browser, no search API key: the Actor searches the web through DuckDuckGo and converts each page with a fast HTML-to-Markdown engine. You pay $0.001 per result, and results whose page cannot be read are free.

### What you get

One Dataset row per result:

- `position`, `title`, `url`, `displayedUrl`, `snippet`: the search result.
- `markdown`: the page as clean Markdown (headings, lists, tables, code blocks, absolute links), main content only by default.
- `pageTitle`, `description`, `author`, `publishedAt`, `language`, `wordCount`.
- `truncated` when the page was cut at **Max characters per page**, `likelyJsRendered` when the page needs JavaScript and little text was found.
- `error` when a page could not be fetched (for example a site that blocks automated visits): that row keeps the search data and is not charged.
- `query`, `region`, and `isNew` on scheduled runs (URL not in the previous results).

### How to use it

1. Open the **Input** tab.
2. In **Search queries** type one per line, for example `best open source CRM for startups`. Search operators such as `site:` and quotes work.
3. Set **Results per query** (default 5, up to 30), **Region** and, optionally, **Published within**.
4. Keep **Fetch pages as Markdown** on for full content, or switch it off to get only titles, URLs and snippets.
5. Click **Start** and read the rows, or call it from your agent through the API or the Apify MCP server.

### Input

```json
{
  "queries": ["best open source CRM for startups"],
  "maxResults": 5,
  "scrapePages": true,
  "region": "us-en",
  "timeRange": "any",
  "mainContent": true,
  "maxChars": 30000
}
```

| Field | Description |
|-------|-------------|
| `queries` | Search queries. Up to 50 per run. |
| `maxResults` | Results per query, 1 to 30. Default 5. |
| `scrapePages` | Fetch each result as Markdown. Default on. |
| `region` | `us-en`, `uk-en`, `es-es`, `de-de`, `fr-fr`, `mx-es`... or `wt-wt`. |
| `timeRange` | `any`, `day`, `week`, `month`, `year`. |
| `mainContent` | Remove navigation, footers and banners. Default on. |
| `maxChars` | Characters per page, 1,000 to 200,000. Default 30,000. |

### Output example

```json
{
  "query": "best open source CRM for startups",
  "region": "us-en",
  "position": 1,
  "title": "7 Best Open Source CRMs for Startups",
  "url": "https://techsy.io/en/blog/open-source-crm",
  "displayedUrl": "techsy.io/en/blog/open-source-crm",
  "snippet": "Compare the best open source CRMs for startups...",
  "scraped": true,
  "pageTitle": "7 Best Open Source CRMs for Startups in 2026",
  "description": "We compared Twenty, SuiteCRM, EspoCRM...",
  "markdown": "# 7 Best Open Source CRMs for Startups\n\nChoosing a CRM...",
  "wordCount": 3807,
  "author": null,
  "publishedAt": "2026-08-14T00:00:00.000Z",
  "language": "en",
  "truncated": false,
  "likelyJsRendered": false,
  "error": null,
  "isNew": false,
  "timestamp": "2026-10-08T12:00:00.000Z"
}
```

### Pricing

Pay per event, no subscription:

- **Result scraped**: $0.001 per result with its page converted to Markdown, or per result in search-only mode. 1,000 results cost $1.
- **New result**: $0.002 per URL that enters the results of a scheduled query.

Results whose page cannot be read are free. Compare with web-browsing Actors for AI at $1.33 per 1,000 pages plus a fee per search.

### Use it as an API

```bash
curl -X POST "https://api.apify.com/v2/acts/aolmo~rag-web-search/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"queries": ["latest EU AI Act guidance"], "maxResults": 3, "timeRange": "month"}'
```

The response is the list of result rows with Markdown, ready for your prompt. The Actor works as a tool for AI agents through the Apify MCP server. To convert URLs you already have, use `aolmo/page-to-markdown`; to load a whole website, `aolmo/website-to-markdown`.

### FAQ

**Which search engine does it use?** DuckDuckGo, which aggregates results from several sources. Results can differ slightly from Google's.

**Why do some results have an error?** Some sites block automated visits or need JavaScript. Those rows keep the title, URL and snippet and are not charged.

**How fast is it?** Usually 3 to 10 seconds per query with 5 pages.

**Can I monitor a topic?** Yes: schedule the Actor and new URLs come with `isNew: true`.

**Where is the data stored between runs?** In a Key-Value Store of your account named `micro-saas-state-rag-web-search`, one key per query. Delete it to start fresh.

# Actor input Schema

## `queries` (type: `array`):

One per line, in natural language or with search operators, e.g. best open source CRM for startups or site:github.com web scraping.

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

Top results to return (and fetch) per query.

## `scrapePages` (type: `boolean`):

Opens each result and converts it to Markdown. Switch off to get only titles, URLs and snippets.

## `region` (type: `string`):

Search region and language: us-en, uk-en, es-es, de-de, fr-fr, mx-es... or wt-wt for no region.

## `timeRange` (type: `string`):

Only results from the past day, week, month or year.

## `mainContent` (type: `boolean`):

Removes menus, footers, cookie banners and sidebars from each page.

## `maxChars` (type: `integer`):

Longer pages are cut at a paragraph boundary (truncated: true).

## `product` (type: `string`):

Internal. Leave as is.

## Actor input object example

```json
{
  "queries": [
    "best open source CRM for startups"
  ],
  "maxResults": 5,
  "scrapePages": true,
  "region": "us-en",
  "timeRange": "any",
  "mainContent": true,
  "maxChars": 30000,
  "product": "rag-web-search"
}
```

# Actor output Schema

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

Dataset items: url, changed, events, data, timestamp and error (when the target failed).

# 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 = {
    "queries": [
        "best open source CRM for startups"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("aolmo/rag-web-search").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 = { "queries": ["best open source CRM for startups"] }

# Run the Actor and wait for it to finish
run = client.actor("aolmo/rag-web-search").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 '{
  "queries": [
    "best open source CRM for startups"
  ]
}' |
apify call aolmo/rag-web-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,aolmo/rag-web-search"
        }
    }
}
```

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/QeWcetelwAqs7wv7Y/builds/ndjY8nE16ePkuuqkm/openapi.json
