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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_alterlab-0.1.0.tar.gz | 9.4 kB | With provenance | Details for langchain_alterlab-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_alterlab-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_alterlab-0.1.0-py3-none-any.whl |
Total release size: 21.4 kB
Release files / langchain_alterlab-0.1.0.tar.gz
| Download URL | langchain_alterlab-0.1.0.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3811a015bf2d61a44d766d220d6e2fdb74cc5550b94ff85ce40b0802a481a507
|
|
BLAKE2b-256 checksum How to use checksums |
3b266b66e939a36a428016bb430ed734b053430ffcd58bcbbe7396cc8150aa09
|
| 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 logRelease files / langchain_alterlab-0.1.0-py3-none-any.whl
| Download URL | langchain_alterlab-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70ae3779abbef543ccef0e2b0dd89d87871f402bd51c117d715baf393731a884
|
|
BLAKE2b-256 checksum How to use checksums |
3a162e103b7e3966d0d714757a9b6182bad08d14fc968c94536e7d4cfce07f6d
|
| 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 logSecurity for langchain-alterlab 0.1.0
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.
Attestation for langchain_alterlab-0.1.0.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 logA 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.