# AgentMap (`roosch/agentmap`) Actor

Every URL on a site from robots.txt and its sitemaps, as clean JSON for AI agents. Sitemap indexes, gzip, text, RSS/Atom, lastmod filters. Pay only for URLs delivered.

- **URL**: https://apify.com/roosch/agentmap.md
- **Developed by:** [Justin Rooschuz](https://apify.com/roosch) (community)
- **Categories:** Developer tools, SEO tools, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## AgentMap: every URL on a site, as clean JSON for AI agents

Give AgentMap a site (`example.com`) or a sitemap URL. It reads `robots.txt`, follows every sitemap and sitemap index (gzip included), and returns one clean row per URL with `lastmod`, `changefreq`, `priority`, hreflang alternates and image counts. No browser, no crawling of pages: fast, cheap and polite.

Pay only for what you get: failed sites, missing sitemaps and empty files are never charged.

### For AI agents (quick start)

```json
{ "urls": ["docs.apify.com"], "maxUrls": 1000, "include": ["*/academy/*"], "lastmodAfter": "2026-09-01" }
```

- **Dataset:** one row per URL: `{ url, lastmod, changefreq, priority, alternates, images, site, sitemap }`.
- **`OUTPUT` record:** per-site status (`ok`/`failed`), where sitemaps were found (`robots.txt`, `fallback`, `direct`), every sitemap file read, a plain-English `error` for anything that failed, and what was charged.
- Feed the URLs straight into [AgentShot](https://apify.com/roosch/agentshot) to screenshot or read the pages.

Agents without an Apify account can pay on their own through [Apify agentic payments](https://docs.apify.com/agents/payments): buy a prepaid, spend-capped Apify token with x402 (USDC on Base or Solana) or MPP (stablecoins on Tempo or Solana), or pay per call with Skyfire. AgentMap runs with limited permissions and pay-per-event pricing only, so it works with all three.

### Use it from an MCP client (Claude, Cursor, and others)

Add [Apify's MCP server](https://docs.apify.com/integrations/mcp) with just this Actor loaded:

```json
{
  "mcpServers": {
    "agentmap": {
      "url": "https://mcp.apify.com?tools=roosch/agentmap"
    }
  }
}
```

On first connection your browser opens so you can sign in to Apify. To skip sign-in, add `"headers": { "Authorization": "Bearer <APIFY_TOKEN>" }`. A prepaid token bought through [agentic payments](https://docs.apify.com/agents/payments) works there too.

Your client then gets a tool called `roosch--agentmap`. The server also adds `get-dataset-items`, `get-key-value-store-record`, `get-actor-run` and `abort-actor-run`. Example call:

```json
{ "name": "roosch--agentmap", "arguments": { "urls": ["docs.apify.com"], "maxUrls": 200 } }
```

The tool returns the run's status and storage details (`status`, `runId`, `storages.datasets.default.id`, the available fields), not the dataset rows. If the run is still running, check `get-actor-run` until it finishes. Then call `get-dataset-items` with that dataset ID to get one row per URL (`url`, `lastmod`, `site`, `sitemap`…). For per-site status and errors, call `get-key-value-store-record` with the default key-value store ID from the run summary and the key `OUTPUT`. Each run is billed at the prices below.

### Input

| Field | Default | What it does |
|---|---|---|
| `urls` | required | Site roots or direct sitemap / RSS / Atom / text-sitemap URLs. Up to 50. |
| `maxUrls` | 1000 | Total URLs across the run (max 200,000). Your cost ceiling. |
| `include` / `exclude` | none | Glob (`*/blog/*`) or `/regex/` patterns on the URL. |
| `lastmodAfter` | none | Only URLs changed on/after this date (drops URLs with no `lastmod`). |
| `sameHostOnly` | true | Ignore sitemaps and URLs on other hosts (`www.` counts as same). |

### How discovery works

1. `Sitemap:` lines in `robots.txt`.
2. If none: `/sitemap.xml`, `/sitemap_index.xml`, `/sitemap-index.xml`, `/wp-sitemap.xml`, `/sitemap.txt`.
3. Sitemap indexes are followed up to 4 levels deep and 1,000 files per site. URLs are de-duplicated across the whole run.

### Pricing (pay per event)

| Event | Price | When |
|---|---|---|
| Actor start | $0.00005 | Apify's standard per-run start fee. |
| Sitemap file parsed | $0.002 | A sitemap / index / feed file with at least one entry was read and parsed. |
| URL delivered | $0.0001 | One unique URL saved to your dataset after filters ($0.10 per 1,000). |

Set a maximum cost per run in Apify and AgentMap stops cleanly when it is reached, delivering only what was paid for.

### Limits and safeguards

- Only public http(s) hosts. Private, local and cloud-metadata addresses are blocked, including after redirects (DNS is checked on every hop).
- 50 MB per sitemap file (the sitemap protocol limit), 30 s timeout, 5 redirects.
- No login, no cookies, no page rendering. Sites that block data-centre traffic may fail; the error says why.

### FAQ

**Is it legal?** AgentMap reads files that sites publish specifically so machines can find their pages. You choose the sites and are responsible for how you use the URLs, including site terms. This isn't legal advice.

**Is my data kept?** Results live only in your own Apify run storage, under your retention settings.

**The site has no sitemap.** You'll get `status: "failed"` with the reason and no charge. Pass a feed or sitemap URL directly if you know one.

**Does it check if each URL is live?** Not in this version. It returns what the site declares; pair it with AgentShot to fetch pages.

**Example cost.** docs.apify.com (7 sitemap files, about 4,000 URLs) costs about $0.42. A 1,000-page blog costs about $0.10–0.11.

### Support

Open an issue on the Issues tab; replies within 48 hours.

# Actor input Schema

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

Site roots (example.com) or direct sitemap/feed URLs. For a site root, sitemaps are found via robots.txt, then /sitemap.xml and common variants. Up to 50 per run.

## `maxUrls` (type: `integer`):

Stop after this many URLs in total (you pay per URL delivered). Max 200,000.

## `include` (type: `array`):

Keep only URLs matching any pattern. Glob with \* (e.g. */blog/*) or /regex/.

## `exclude` (type: `array`):

Drop URLs matching any pattern. Glob with \* or /regex/.

## `lastmodAfter` (type: `string`):

Keep only URLs whose sitemap lastmod is on/after this date (YYYY-MM-DD). URLs without lastmod are dropped when set.

## `sameHostOnly` (type: `boolean`):

Ignore sitemaps and URLs on other hosts (www. is treated as the same host).

## Actor input object example

```json
{
  "urls": [
    "https://docs.apify.com"
  ],
  "maxUrls": 1000,
  "sameHostOnly": true
}
```

# Actor output Schema

## `urls` (type: `string`):

No description

## `summary` (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 = {
    "urls": [
        "https://docs.apify.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("roosch/agentmap").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://docs.apify.com"] }

# Run the Actor and wait for it to finish
run = client.actor("roosch/agentmap").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 '{
  "urls": [
    "https://docs.apify.com"
  ]
}' |
apify call roosch/agentmap --silent --output-dataset

```

## MCP server setup

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

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/KWNvhpoWt7cBSKBno/builds/kRmcx2hl8ITgM8Dpd/openapi.json
