Skip to main content

Scenario

You want your agent to answer questions about a specific site—a vendor’s documentation, your own help center, a competitor’s product pages—accurately and without re-fetching on every question. The pattern is map, select, fetch, index. Discover the inventory cheaply, decide what belongs in the knowledge base, extract only that, and store it.

What you need

The flow

Mapping first is what makes this affordable. A map reports what exists without extracting content, so you pay for reading only the pages you decided are worth reading.

Step 1: map the site

Crawl is asynchronous by default, so this returns a run_id immediately.
Crawls stay on the seed host. To cover docs.example.com and blog.example.com, run two maps.

Step 2: poll until the map finishes

Polling with include_results: false keeps each check small, then one final call collects everything.

Step 3: select what to index

The map gives you URLs, titles, and depth. Filter before spending fetch credits:
Judgment that belongs here:
  • Drop generated API reference if your agent should answer conceptually
  • Drop archived or versioned duplicates of current pages
  • Drop index pages that only link elsewhere and carry no content

Step 4: fetch in batches

titan_fetch takes up to 100 URLs per call. Batch below that so responses stay manageable:
The batch-scoped idempotency_key means an interrupted build can resume without re-paying for batches that already completed.

Step 5: chunk and store

Markdown output chunks cleanly on headings, which keeps sections intact instead of splitting mid-argument:
Keep url and retrieved_at in metadata. The first gives your agent citations; the second tells you what has gone stale.

Keeping it fresh

Re-map on a schedule and diff against what you have indexed:
Because a map costs one credit per URL and no extraction, refreshing the inventory is far cheaper than re-fetching the site. For pages that change without their URL changing, re-fetch on an age policy using retrieved_at, and set freshness: "live_only" on those calls to bypass cache.

When to crawl instead of map

mode: "crawl" extracts content during discovery, in one run instead of two:
Map-then-fetch also lets you use a larger max_chars_per_url on the pages you keep, rather than the smaller crawl-mode default across every page.

Cost in practice

Indexing a 100-page documentation site: Crawling all 100 pages with content would cost 100 and give you 40 pages you did not want—cheaper in credits, worse in index quality. Choose based on whether filtering matters for your corpus.

Next steps