Skip to main content

langchain-alterlab

LangChain integration for the AlterLab web scraping API.

Installation

pip install langchain-alterlab

Setup

Set your AlterLab API key:

export ALTERLAB_API_KEY="your-api-key"

Get your API key at alterlab.io/dashboard.

Document Loader

Load web pages as LangChain Document objects with structured metadata:

from langchain_alterlab import AlterLabLoader

# Single URL
loader = AlterLabLoader(url="https://example.com/article")
docs = loader.load()

print(docs[0].page_content[:200])
print(docs[0].metadata)
# {'source': 'https://example.com/article', 'title': '...', 'author': '...', ...}

Multiple URLs

loader = AlterLabLoader(
    urls=[
        "https://example.com/page1",
        "https://example.com/page2",
    ],
)
docs = loader.load()

Custom Parameters

loader = AlterLabLoader(
    url="https://example.com",
    params={
        "formats": ["markdown", "json"],
        "mode": "js",  # JavaScript rendering
        "extraction_profile": "article",
    },
)

Async Loading

docs = await loader.aload()

Agent Tool

Use AlterLabScrapeTool with LangChain agents to scrape pages on demand:

from langchain_alterlab import AlterLabScrapeTool

tool = AlterLabScrapeTool()

# Direct use
result = tool.invoke("https://example.com")
print(result)

With an Agent

from langchain_openai import ChatOpenAI
from langchain_alterlab import AlterLabScrapeTool

llm = ChatOpenAI()
tools = [AlterLabScrapeTool()]
agent = llm.bind_tools(tools)

With Metadata

tool = AlterLabScrapeTool(include_metadata=True)
result = tool.invoke("https://example.com")
# Output includes title, author, source before content

Metadata Fields

Documents and tool results include structured metadata:

Field Description
source URL that was scraped
title Page title (if detected)
author Content author (if detected)
published_at Publication date (if detected)
status_code HTTP response status code
extraction_method How content was extracted
response_time_ms API response time
credits_used AlterLab credits consumed
tier_used Scraping tier (1=curl, 2=http, 3=stealth, 4=browser)

API Reference

See docs.alterlab.io for the full AlterLab API documentation.

Search Tool

Use AlterLabSearchTool to let agents run web searches (numbered title, URL and snippet):

from langchain_alterlab import AlterLabSearchTool

tool = AlterLabSearchTool(num_results=5, params={"engine": "google"})
print(tool.invoke("web scraping api"))

Metadata

Release files for langchain-alterlab 0.1.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-alterlab 0.1.1
File Size Uploaded Provenance Actions
langchain_alterlab-0.1.1.tar.gz 9.4 kB With provenance Details for langchain_alterlab-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-alterlab 0.1.1
File Interpreter ABI Platform Actions
langchain_alterlab-0.1.1-py3-none-any.whl Python 3 none any Details for langchain_alterlab-0.1.1-py3-none-any.whl

Total release size: 21.4 kB

Release files / langchain_alterlab-0.1.1.tar.gz

Download URL langchain_alterlab-0.1.1.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
82bdd903113e18487e345f474511561d60531f93b6cfddb48699e413e7b5317a
BLAKE2b-256 checksum
How to use checksums
eeca69d9b05a99b879bd534464012e939aed18aebf0351d336a193130690566f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 2, 2026.

Transparency log

Release files / langchain_alterlab-0.1.1-py3-none-any.whl

Download URL langchain_alterlab-0.1.1-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1669fc7c81b6bf569bf6ccfaf91bc133e23da41ea10cb829a3620c6aded47ae
BLAKE2b-256 checksum
How to use checksums
9f87ca7c4169f30d2ece85aef00a268190b4ae72198196909fd217eb2bc50163
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 2, 2026.

Transparency log

Security for langchain-alterlab 0.1.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_alterlab-0.1.1.tar.gz

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 Nov 2, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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