Skip to main content

LangChain Olostep Integration

Live web search, scraping and crawling API for AI. Get structured, LLM-ready data from any site. Scale to 1M requests with 10 parallel batches at low cost.

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. This package brings Olostep to LangChain and LangGraph agents.

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

This integration provides access to 6 Olostep API endpoints:

1. Scrapes (/v1/scrapes)

Extract content from any single URL in multiple formats (Markdown, HTML, JSON, text). Handles JavaScript rendering, anti-scraping measures, and supports specialized parsers for specific websites.

2. Batches (/v1/batches)

Process up to 100k URLs in parallel. Batch jobs typically complete in 5-8 minutes regardless of batch size. Perfect for large-scale data extraction and competitor analysis.

3. Answers (/v1/answers)

AI-powered web search with natural language queries. Ask questions and get structured answers with sources. Ground your AI products on real-world data and facts. Perfect for data enrichment and research.

4. Maps (/v1/maps)

Extract all URLs from a website for site structure analysis and content discovery. Can discover up to ~100,000 URLs in a single call. Perfect for SEO audits and preparing URLs for batch processing.

5. Crawls (/v1/crawls)

Autonomously discover and scrape entire websites by following links. Perfect for documentation sites, blogs, and comprehensive website data extraction.

6. Searches (/v1/searches)

Search the web and get each result's URL, title and description, optionally with the page's content as markdown in the same call. Filter results by domain.

Core Capabilities

  • Multiple Formats: Markdown, HTML, JSON, and plain text
  • JavaScript Rendering: Automatic handling of dynamic content
  • Specialized Parsers: Custom parsers for Amazon, Google Search, and more
  • Location-Specific: Scrape with country-specific settings
  • LangGraph Ready: Perfect for building complex AI agent workflows
  • Cost-Effective: Pay only for what you use

Installation

pip install langchain-olostep

Setup

Set your Olostep API key:

export OLOSTEP_API_KEY="your_olostep_api_key_here"

Get your API key from https://olostep.com/dashboard

Quick Start

1. Basic Web Scraping

from langchain_olostep import scrape_website
import asyncio

# Scrape a website
content = asyncio.run(scrape_website.ainvoke({
    "url": "https://example.com",
    "format": "markdown"
}))

print(content)

2. Batch Scraping

from langchain_olostep import scrape_batch
import asyncio

# Scrape multiple URLs in parallel
result = asyncio.run(scrape_batch.ainvoke({
    "urls": [
        "https://example1.com",
        "https://example2.com",
        "https://example3.com"
    ],
    "format": "markdown"
}))

print(result)

3. Search the Web

from langchain_olostep import search_web

# Get the top results for a query
result = search_web.invoke({"query": "best open source vector databases", "limit": 5})

# Search one site and read each result page in the same call
result = search_web.invoke({
    "query": "rate limits",
    "include_domains": ["docs.olostep.com"],
    "scrape_results": True
})

print(result)
# Returns: {"query": ..., "results": [{"url": ..., "title": ..., "description": ..., "markdown_content": ...}], ...}

4. AI-Powered Web Search & Q&A

from langchain_olostep import answer_question
import asyncio

# Ask a question and get structured answer
result = asyncio.run(answer_question.ainvoke({
    "task": "What is the latest book by J.K. Rowling?",
    "json_schema": {
        "book_title": "",
        "author": "",
        "release_date": ""
    }
}))

print(result)
# Returns: {"book_title": "The Hallmarked Man", "author": "J.K. Rowling", ...}
# Also includes sources used

5. Extract URLs from Website

from langchain_olostep import extract_urls
import asyncio

# Get all URLs from a website
result = asyncio.run(extract_urls.ainvoke({
    "url": "https://example.com",
    "include_urls": ["/blog/**"],  # Only blog posts
    "top_n": 100
}))

print(result)

6. Crawl Entire Website

from langchain_olostep import crawl_website
import asyncio

# Autonomously crawl and scrape a website
result = asyncio.run(crawl_website.ainvoke({
    "start_url": "https://docs.example.com",
    "max_pages": 100,
    "exclude_urls": ["/admin/**"]
}))

print(result)

Usage with LangChain Agent

pip install langchain langchain-openai langchain-olostep
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
from langchain_olostep import (
    search_web,
    scrape_website,
    answer_question,
    extract_urls
)

# Create agent with Olostep tools
tools = [search_web, scrape_website, answer_question, extract_urls]
agent = create_agent(
    model=ChatOpenAI(model="gpt-4o-mini"),
    tools=tools,
)

# Use the agent
result = agent.invoke({
    "messages": [{
        "role": "user",
        "content": """
Research the company at https://company.com:
1. Scrape their about page
2. Search for their latest funding round
3. Extract all their product pages
""",
    }]
})

print(result["messages"][-1].content)

Usage with LangGraph

import json
from typing import Any, TypedDict

from langgraph.graph import StateGraph, END
from langchain_olostep import (
    scrape_batch,
    answer_question,
    extract_urls
)


class ResearchState(TypedDict, total=False):
    target_url: str
    research_question: str
    desired_format: dict
    urls: list[str]
    batch_id: str
    answer: Any


# Build a research agent workflow
def create_research_agent():
    workflow = StateGraph(ResearchState)
    
    def discover_pages(state: ResearchState):
        # Extract all URLs from target site
        result = extract_urls.invoke({
            "url": state["target_url"],
            "include_urls": ["/product/**"],
            "top_n": 50
        })
        return {"urls": json.loads(result)["urls"]}
    
    def scrape_pages(state: ResearchState):
        # Scrape discovered pages in batch
        result = scrape_batch.invoke({
            "urls": state["urls"],
            "format": "markdown"
        })
        return {"batch_id": json.loads(result)["batch_id"]}
    
    def answer_questions(state: ResearchState):
        # Use AI to answer questions about the data
        result = answer_question.invoke({
            "task": state["research_question"],
            "json_schema": state["desired_format"]
        })
        return {"answer": json.loads(result)["answer"]}
    
    workflow.add_node("discover", discover_pages)
    workflow.add_node("scrape", scrape_pages)
    workflow.add_node("analyze", answer_questions)
    
    workflow.set_entry_point("discover")
    workflow.add_edge("discover", "scrape")
    workflow.add_edge("scrape", "analyze")
    workflow.add_edge("analyze", END)
    
    return workflow.compile()

# Use the agent
agent = create_research_agent()
result = agent.invoke({
    "target_url": "https://store.com",
    "research_question": "What are the top 5 most expensive products?",
    "desired_format": {"products": [{"name": "", "price": "", "url": ""}]}
})

Available Tools

scrape_website

Scrape content from a single URL. Supports markdown, HTML, JSON, and text formats.

Parameters:

  • url (required): Website URL to scrape
  • format: Output format (markdown, html, json, text). Default: "markdown"
  • country: Country code for location-specific content (e.g., "US", "GB", "CA")
  • wait_before_scraping: Wait time in milliseconds for JavaScript rendering
  • parser: Optional parser ID for specialized extraction (e.g., "@olostep/amazon-product")

scrape_batch

Scrape multiple URLs in parallel (up to 100k at once). New accounts start at 100 URLs per batch, and info@olostep.com can lift this.

Parameters:

  • urls (required): List of URLs to scrape
  • format: Output format for all URLs. Default: "markdown"
  • country: Country code for location-specific content
  • wait_before_scraping: Wait time in milliseconds for JavaScript rendering
  • parser: Optional parser ID for specialized extraction

search_web

Search the web and get the matching pages. Use it when the agent needs pages on a topic and has no URL yet.

Parameters:

  • query (required): What to search for, in natural language
  • limit: Number of results, from 1 to 25 (default: 5)
  • include_domains: Only return results from these domains
  • exclude_domains: Never return results from these domains
  • scrape_results: Also return each result's content as markdown (default: False). Each scraped page uses extra credits.
  • max_characters: Maximum characters of markdown kept per page (default: 20000). Longer pages are cut and marked with truncated and full_length; use scrape_website for the full page.

Examples:

search_web.invoke({"query": "LangGraph multi-agent tutorial"})

search_web.invoke({
    "query": "pricing",
    "include_domains": ["olostep.com"],
    "scrape_results": True
})

answer_question

Search the web and get AI-powered answers with sources.

Parameters:

  • task (required): Question or task to search for
  • json_schema: Optional JSON schema dict/string describing desired output format

Examples:

# Simple question
answer_question.invoke({"task": "What is the capital of France?"})

# With structured output
answer_question.invoke({
    "task": "Find the CEO of Stripe",
    "json_schema": {"ceo_name": "", "founded_year": ""}
})

extract_urls

Extract all URLs from a website for site structure analysis.

Parameters:

  • url (required): Website URL to extract URLs from
  • search_query: Optional search query to filter URLs
  • top_n: Limit number of URLs returned
  • include_urls: Glob patterns to include (e.g., ["/blog/**"])
  • exclude_urls: Glob patterns to exclude (e.g., ["/admin/**"])

crawl_website

Autonomously discover and scrape entire websites.

Parameters:

  • start_url (required): Starting URL for the crawl
  • max_pages: Maximum number of pages to crawl. Default: 100
  • include_urls: Glob patterns to include
  • exclude_urls: Glob patterns to exclude
  • max_depth: Maximum depth to crawl from start_url
  • include_external: Include external URLs. Default: False

Advanced Examples

Data Enrichment

from langchain_olostep import answer_question

# Enrich company data from spreadsheet
companies = ["Stripe", "Shopify", "Square"]

for company in companies:
    result = answer_question.invoke({
        "task": f"Find information about {company}",
        "json_schema": {
            "ceo": "",
            "headquarters": "",
            "employee_count": "",
            "latest_funding": ""
        }
    })
    print(f"{company}: {result}")

E-commerce Product Scraping

from langchain_olostep import scrape_website

# Scrape Amazon product with specialized parser
result = scrape_website.invoke({
    "url": "https://www.amazon.com/dp/PRODUCT_ID",
    "parser": "@olostep/amazon-product",
    "format": "json"
})
# Returns structured product data: price, title, rating, etc.

SEO Audit

from langchain_olostep import extract_urls, scrape_batch

# 1. Discover all pages
urls_result = extract_urls.invoke({
    "url": "https://yoursite.com",
    "top_n": 1000
})

# 2. Scrape all pages to analyze
urls = json.loads(urls_result)["urls"]
batch_result = scrape_batch.invoke({
    "urls": urls,
    "format": "html"
})

Documentation Scraping

from langchain_olostep import crawl_website

# Crawl entire docs site
result = crawl_website.invoke({
    "start_url": "https://docs.example.com",
    "max_pages": 500,
    "include_urls": ["/docs/**"],
    "exclude_urls": ["/api/**", "/v1/**"]  # Exclude old versions
})

Error Handling

from langchain_core.exceptions import LangChainException

try:
    result = await scrape_website.ainvoke({
        "url": "https://example.com"
    })
except LangChainException as e:
    print(f"Scraping failed: {e}")

Environment Variables

  • OLOSTEP_API_KEY: Your Olostep API key (required)

Specialized Parsers

Olostep provides pre-built parsers for popular websites:

  • @olostep/amazon-product: Amazon product pages
  • @olostep/google-search: Google search results
  • @olostep/google-maps: Google Maps data

Use them with the parser parameter:

scrape_website.invoke({
    "url": "https://www.amazon.com/dp/PRODUCT_ID",
    "parser": "@olostep/amazon-product"
})

Pricing

Olostep offers competitive pricing:

  • Pay only for what you use
  • No hidden fees
  • Volume discounts available

Visit https://olostep.com/pricing for details.

Support

About Olostep

Olostep is web data infrastructure for AI. It provides live web search, scraping and crawling API to extract and structure data, used in production by AI companies to give their agents fresh, LLM-ready web data at scale.

License

MIT

Metadata

Release files for langchain-olostep 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-olostep 0.4.1
File Size Uploaded Provenance Actions
langchain_olostep-0.4.1.tar.gz 23.6 kB Without provenance Details for langchain_olostep-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-olostep 0.4.1
File Interpreter ABI Platform Actions
langchain_olostep-0.4.1-py3-none-any.whl Python 3 none any Details for langchain_olostep-0.4.1-py3-none-any.whl

Total release size: 39.8 kB

Release files / langchain_olostep-0.4.1.tar.gz

Download URL langchain_olostep-0.4.1.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2e809acebce0b22f247f34087f67e06c0f2e3a71e813dbea17fd850aff7317e0
BLAKE2b-256 checksum
How to use checksums
37bac1dbe49d0ca2d961e89f392539d8030b60081e4c8a9d33057c4f663134df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / langchain_olostep-0.4.1-py3-none-any.whl

Download URL langchain_olostep-0.4.1-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
53b257710318e007ad3e0ef6feebd5a1c43f6a54b997a0c8df3879418de59294
BLAKE2b-256 checksum
How to use checksums
85fcdfc74efda9080cca3b5bd37485b69211374ca8112d03383fe0d68a1d3958
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for langchain-olostep 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page