Skip to main content
The Olostep Mastra integration gives Mastra agents ready-made tools for live web data, built with Mastra’s createTool(). Olostep is web data infrastructure for AI agents and enterprise AI workflows. Its APIs provide live web search, scraping and crawling to extract, clean and structure data from the web. Add the tools to an agent and the model decides when to search, scrape or crawl. Install from npm →

Why Olostep

  • Web data infrastructure for developers and enterprises
  • Scales to hundreds of millions to billions of requests per customer per month
  • The most performant, reliable and cost-effective API on the market
  • Used by the fastest-growing AI companies
From extracting data from a handful of URLs to crawling hundreds of millions of pages, Olostep gives developers and AI companies reliable, scalable and highly cost-effective access to clean, structured web data.

Features

The package provides 7 tools:

Scrape

Scrape any URL and return clean markdown, with JavaScript rendering

Search

Search the live web and return titles, URLs and descriptions

Answer

Answer a question from the live web, with source URLs

Map

List the URLs on a website, optionally ranked by a query

Crawl

Crawl a site from a starting URL and return the markdown of each page

Batch

Scrape up to 100k URLs in one batch and return the markdown of each page

Results

Get the remaining pages of a crawl or batch

Installation

Works with @mastra/core 1.x, Zod 3.25+ or 4, and Node.js 22.13+.

Setup

Set your Olostep API key as an environment variable:
Or in your .env file:
Get your API key from the Olostep Dashboard.

Quick Start

Give an agent all Olostep tools with createOlostepTools():
maxSteps lets the agent call tools over several steps, for example search first and then scrape the best result. The model string uses Mastra’s model router, so any provider it supports works, such as anthropic/claude-sonnet-5-5. To use the agent across your app, register it on your Mastra instance:

Pick Individual Tools

Only give the agent the tools it needs:
The tools also work in Mastra workflows and anywhere Mastra accepts a tool.

Available Tools

The names below are the keys used by createOlostepTools(). Each tool also has an id, such as olostep-scrape.

olostepScrape

createOlostepScrapeTool(). Scrape a single URL and return its content as markdown. Input:
string
required
The URL of the page to scrape
number
Milliseconds to wait for JavaScript-heavy pages to render (0 to 10000)
Returns: { url, markdown }

olostepSearch

createOlostepSearchTool(). Search the live web. Input:
string
required
The search query
number
default:"10"
Maximum number of results (1 to 25)
Returns: { query, results: [{ title, url, description }] }

olostepAnswer

createOlostepAnswerTool(). Search and read the live web to answer a question, with sources. Input:
string
required
The question or research task
Returns: { answer, sources }

olostepMap

createOlostepMapTool(). Discover the URLs on a website. Input:
string
required
The website to map
string
Rank URLs by relevance to this query
number
default:"100"
Maximum number of URLs to return (1 to 100k)
Returns: { url, urls }

olostepCrawl

createOlostepCrawlTool(). Crawl a website from a starting URL and return each page’s markdown. The tool waits for the crawl, up to timeoutSeconds, then returns the first set of pages. Input:
string
required
The URL to start crawling from
number
default:"5"
Maximum pages to crawl (1 to 100k)
array
Only crawl URLs matching these glob patterns, e.g. ["/docs/**"]
Returns: { id, status, pages: [{ url, markdown }], nextCursor, message }

olostepBatch

createOlostepBatchTool(). Scrape up to 100k URLs in one batch and return each page’s markdown. The tool waits for the batch, up to timeoutSeconds, then returns the first set of pages. Input:
array
required
The URLs to scrape (1 to 100k)
Returns: { id, status, pages: [{ url, markdown }], nextCursor, message }

olostepResults

createOlostepResultsTool(). Get the pages of a crawl or batch by its id. Use it when the crawl or batch tool returned in_progress or a nextCursor. Input:
string
required
The crawl or batch id, starting with crawl_ or batch_
string
The nextCursor from a previous result. Leave empty for the first pages.
Returns: { id, status, pages: [{ url, markdown }], nextCursor, message }
Page content goes to the model, so crawl and batch results come back 20 pages at a time by default. If a job is still running when the wait ends, the tool returns its id with status set to in_progress. If more pages are available, the result includes nextCursor. The agent passes the id and nextCursor to olostepResults to get the next pages, until it has every page.Batches go up to 100k URLs, and you can run 10 batches in parallel for 1M requests. New accounts start at 100 URLs per batch, and info@olostep.com can lift this.

Options

Every factory, and createOlostepTools(), accepts the same options:
string
Olostep API key. Defaults to the OLOSTEP_API_KEY environment variable.
number
default:"20000"
Maximum characters of page content returned to the model per page. Longer pages are truncated.
number
default:"300"
How long the crawl and batch tools wait for the job to finish, in seconds.
number
default:"20"
How many pages the crawl, batch and results tools return per call, up to 100.
string
default:"https://api.olostep.com/v1"
Olostep API base URL.

Streaming Example

Use the same agent with stream to print the answer as it is written:
  1. The agent uses olostepSearch or olostepAnswer to find sources
  2. It uses olostepScrape to read the most relevant pages
  3. It returns a summary with source URLs
  1. The agent uses olostepMap with a searchQuery to find the right docs pages
  2. It uses olostepBatch or olostepCrawl to read them
  3. It writes code against the current API instead of guessing
  1. A scheduled Mastra workflow runs an agent with olostepScrape and olostepBatch
  2. The agent extracts prices or changes from each page
  3. Your code compares them with the last run and sends alerts

Best Practices

Each tool’s description is sent to the model. Fewer tools means fewer tokens and fewer wrong tool choices. For an agent that only reads pages, olostepScrape and olostepSearch are often enough.
Pass maxSteps (for example 5) so the agent can chain tool calls but cannot loop forever.
Page content is the biggest part of the token bill. If you crawl or batch many pages, lower maxCharacters or pagesPerCall so all results fit in the model’s context window.
Crawl and batch tools wait up to timeoutSeconds. Big jobs can run longer, so the tool returns an id. The agent uses olostepResults with that id to get the pages when the job is done.

Upgrading from 1.x

Version 1.x was built for Mastra 0.1 and its integrations / mastra.callApi API, which current Mastra no longer has. Version 2 uses createTool() and works with @mastra/core 1.x. Replace createOlostepIntegration() and callApi with createOlostepTools() passed to your agent’s tools.

Troubleshooting

Error: “Invalid API key”Solutions:
  • Check your API key in the dashboard
  • Make sure OLOSTEP_API_KEY is set where your agent runs
  • Or pass the key directly with createOlostepTools({ apiKey })
Solutions:
  • Pass maxSteps, otherwise the agent stops after the first step
  • Use a model that supports tool calling
  • Mention the web in the agent’s instructions, for example “use the web tools and cite your sources”
The job is still running, which is normal for large jobs.Solutions:
  • Let the agent call olostepResults with the id once the job has finished
  • Raise timeoutSeconds to wait longer
  • On serverless functions, make sure the function’s own time limit is longer than timeoutSeconds
Solutions:
  • Lower maxCharacters or pagesPerCall
  • Use olostepMap with searchQuery to pick fewer, more relevant pages before reading them

Pricing

Olostep charges based on API usage, independent of Mastra:
  • Scrapes: Pay per scrape
  • Searches and Answers: Pay per request
  • Batches: Pay per URL in batch
  • Crawls: Pay per page crawled
  • Maps: Pay per map operation
Check current pricing at olostep.com/pricing.

Support

GitHub

Source code and issues

Support Email

Mastra Docs

Learn about Mastra

Documentation

Browse complete API docs

Scrapes API

Learn about the Scrapes endpoint

Crawls API

Learn about the Crawls endpoint

Vercel AI SDK Integration

Use Olostep tools with the AI SDK

LangChain Integration

Build AI agents with LangChain