Skip to main content

langchain-crawlbase

LangChain primitives backed by the Crawlbase Crawling API.

Three drop-in classes:

  • CrawlbaseLoader — a BaseLoader that fetches a list of URLs and returns clean Markdown Documents ready for chunking.
  • CrawlbaseTool — a BaseTool that lets an LLM agent fetch a live web page mid-conversation.
  • CrawlbaseRetriever — a BaseRetriever that fetches a fixed set of seed URLs and filters by query.

All three return GitHub-flavored Markdown via Crawlbase's format=md parameter, so you skip the HTML-stripping step entirely.

Installation

pip install langchain-crawlbase

Setup

Get a token from your Crawlbase dashboard. Use your normal token for static pages, or your JavaScript token for SPA / JS-rendered pages — Crawlbase routes the request automatically based on which token you send.

export CRAWLBASE_TOKEN=your_token

Usage

Document loader

import os
from langchain_crawlbase import CrawlbaseLoader

loader = CrawlbaseLoader(
    token=os.environ["CRAWLBASE_TOKEN"],
    urls=[
        "https://en.wikipedia.org/wiki/Large_language_model",
        "https://en.wikipedia.org/wiki/Retrieval-augmented_generation",
    ],
)
docs = loader.load()
print(docs[0].page_content[:500])
print(docs[0].metadata)  # {'source': '...', 'pc_status': 200, ...}

For SPA pages, just use your JavaScript token instead — same interface:

loader = CrawlbaseLoader(
    token=os.environ["CRAWLBASE_JS_TOKEN"],
    urls=["https://some-spa-site.com/page"],
)

Agent tool

import os
from langchain_crawlbase import CrawlbaseTool

tool = CrawlbaseTool(token=os.environ["CRAWLBASE_TOKEN"])

# Use directly:
markdown = tool.invoke({"url": "https://example.com"})

# Or bind to an LLM:
from langchain_anthropic import ChatAnthropic
llm = ChatAnthropic(model="claude-opus-4-7")
agent_llm = llm.bind_tools([tool])

Retriever

import os
from langchain_crawlbase import CrawlbaseRetriever

retriever = CrawlbaseRetriever(
    token=os.environ["CRAWLBASE_TOKEN"],
    urls=[
        "https://crawlbase.com/docs/crawling-api",
        "https://crawlbase.com/docs/crawling-api#parameters",
    ],
)
docs = retriever.invoke("how do I render JavaScript pages")

v0.1 uses simple substring matching. For semantic retrieval, pair CrawlbaseLoader with a vector store of your choice.

Extra Crawlbase parameters

Pass any Crawlbase API parameter via extra_params:

loader = CrawlbaseLoader(
    token=token,
    urls=["https://example.com"],
    extra_params={"country": "US", "device": "mobile"},
)

Development

pip install -e ".[dev]"
pytest tests/unit
ruff check .

Integration tests are gated on CRAWLBASE_TOKEN:

CRAWLBASE_TOKEN=xxx pytest tests/integration

License

MIT — © Crawlbase Team. Contact: support@crawlbase.com

Metadata

Release files for langchain-crawlbase 0.1.0

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-crawlbase 0.1.0
File Size Uploaded
langchain_crawlbase-0.1.0.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-crawlbase 0.1.0
File Interpreter ABI Platform
langchain_crawlbase-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.5 kB

Release files / langchain_crawlbase-0.1.0.tar.gz

Download URL langchain_crawlbase-0.1.0.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7b8e241ecb17e28414d120de52766cd4402727bcc5e15af1f5cbb720579856f1
BLAKE2b-256 checksum
How to use checksums
cc4edc52f9234d04c7b9cbd7b0249d1a1c29f4c6d1ac82a72a27803ff00fc4c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 2, 2026.

Transparency log

Release files / langchain_crawlbase-0.1.0-py3-none-any.whl

Download URL langchain_crawlbase-0.1.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6409f10c14a90783f32e09b7447413cb9f32416fb4347e0769a3a8d59ac5fa3
BLAKE2b-256 checksum
How to use checksums
9e4953ac68575aae9e92d2a5529299cb996df87d38b65b003d351822bef1b4ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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