generateText or streamText and the model decides when to search, scrape or crawl.
Install from npm →
Features
The package provides 6 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 a list of URLs in one batch and return the markdown of each
Installation
Setup
Set your Olostep API key as an environment variable:.env file:
Quick Start
Pass all Olostep tools to the model witholostepTools():
stopWhen lets the model call tools over several steps, for example search first and then scrape the best result. The model string uses the Vercel AI Gateway. You can also pass any AI SDK provider model, such as openai('gpt-5-mini') from @ai-sdk/openai.
Pick Individual Tools
Only give the model the tools it needs:Available Tools
The tool names below are the keys used byolostepTools().
scrape
olostepScrape(). 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)
{ url, markdown }
search
olostepSearch(). Search the live web.
Input:
string
required
The search query
number
default:"10"
Maximum number of results (1 to 20)
{ query, results: [{ title, url, description }] }
answer
olostepAnswer(). Search and read the live web to answer a question, with sources.
Input:
string
required
The question or research task
{ answer, sources }
map
olostepMap(). Discover the URLs on a website.
Input:
string
required
The website to map
string
Rank URLs by relevance to this query
number
Maximum number of URLs to return (1 to 500)
{ url, urls }
crawl
olostepCrawl(). Crawl a website from a starting URL and return each page’s markdown. The tool waits for the crawl to finish before returning.
Input:
string
required
The URL to start crawling from
number
default:"5"
Maximum pages to crawl (1 to 25)
array
Only crawl URLs matching these glob patterns, e.g.
["/docs/**"]{ url, pages: [{ url, markdown }] }
batch
olostepBatch(). Scrape a list of URLs in one batch and return each page’s markdown. The tool waits for the batch to finish before returning.
Input:
array
required
The URLs to scrape (1 to 20)
{ pages: [{ url, markdown }] }
The crawl and batch tools are capped at 25 pages and 20 URLs per call to keep tool results small enough for the model. For larger jobs, call the Crawls and Batches APIs directly with the Node.js SDK.
Options
Every tool, andolostepTools(), 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.
Streaming Example
Use the same tools withstreamText, for example in a Next.js route handler:
app/api/chat/route.ts
Popular Use Cases
Research Assistant
Research Assistant
- The model uses
searchoranswerto find sources - It uses
scrapeto read the most relevant pages - It returns a summary with source URLs
Docs-Aware Coding Agent
Docs-Aware Coding Agent
- The model uses
mapwith asearchQueryto find the right docs pages - It uses
batchorcrawlto read them - It writes code against the current API instead of guessing
Competitor and Price Monitoring
Competitor and Price Monitoring
- A scheduled job calls
generateTextwithscrapeandbatch - The model extracts prices or changes from each page
- Your code compares them with the last run and sends alerts
Best Practices
Only Pass the Tools You Need
Only Pass the Tools You Need
Each tool’s description is sent to the model. Fewer tools means fewer tokens and fewer wrong tool choices. For a chat that only reads pages,
scrape and search are often enough.Set a Step Limit
Set a Step Limit
Always set
stopWhen (for example stepCountIs(5)) so the model can chain tool calls but cannot loop forever.Lower maxCharacters for Long Pages
Lower maxCharacters for Long Pages
Page content is the biggest part of the token bill. If you crawl or batch many pages, lower
maxCharacters so all results fit in the model’s context window.Raise timeoutSeconds for Big Crawls
Raise timeoutSeconds for Big Crawls
Crawl and batch tools wait for the job to finish. If you hit timeouts, raise
timeoutSeconds, or lower maxPages.Troubleshooting
Authentication Failed
Authentication Failed
Error: “Invalid API key”Solutions:
- Check your API key in the dashboard
- Make sure
OLOSTEP_API_KEYis set where your code runs (for example in your Vercel project’s environment variables) - Or pass the key directly with
olostepTools({ apiKey })
The Model Doesn't Call the Tools
The Model Doesn't Call the Tools
Solutions:
- Set
stopWhen, otherwise generation stops after the first step - Use a model that supports tool calling
- Mention the web in your prompt or system message, for example “use the web tools and cite your sources”
Crawl or Batch Times Out
Crawl or Batch Times Out
Solutions:
- Raise
timeoutSeconds - Lower
maxPagesor pass fewer URLs - On serverless functions, make sure the function’s own time limit is longer than
timeoutSeconds
Context Length Exceeded
Context Length Exceeded
Solutions:
- Lower
maxCharacters - Use
mapwithsearchQueryto pick fewer, more relevant pages before reading them
Pricing
Olostep charges based on API usage, independent of the AI SDK:- 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
Support
GitHub
Source code and issues
Support Email
Email: info@olostep.com
AI SDK Docs
Learn about the Vercel AI SDK
Documentation
Browse complete API docs
Related Resources
Scrapes API
Learn about the Scrapes endpoint
Crawls API
Learn about the Crawls endpoint
Mastra Integration
Build agents with Mastra
LangChain Integration
Build AI agents with LangChain