Skip to main content

llama-index-readers-alterlab

Official AlterLab data reader for LlamaIndex.

Scrape any web page — including JavaScript-heavy SPAs and anti-bot-protected sites — and load the results directly into LlamaIndex Documents for RAG pipelines.

Installation

pip install llama-index-readers-alterlab

Quick Start

from llama_index.readers.alterlab import AlterLabReader

reader = AlterLabReader(api_key="sk_live_...")

# Load one page
docs = reader.load_data(["https://example.com/docs"])
print(docs[0].text)

# Load multiple pages
docs = reader.load_data([
    "https://docs.stripe.com/api/charges",
    "https://docs.stripe.com/api/customers",
])

RAG Pipeline

from llama_index.core import VectorStoreIndex, Settings
from llama_index.llms.openai import OpenAI
from llama_index.embeddings.openai import OpenAIEmbedding
from llama_index.readers.alterlab import AlterLabReader

Settings.llm = OpenAI(model="gpt-4o-mini")
Settings.embed_model = OpenAIEmbedding()

reader = AlterLabReader(api_key="sk_live_...")
docs = reader.load_data([
    "https://docs.stripe.com/api/charges",
    "https://docs.stripe.com/api/refunds",
])

index = VectorStoreIndex.from_documents(docs)
engine = index.as_query_engine(similarity_top_k=3)
print(engine.query("How do I create a refund?"))

Cleanup

AlterLabReader holds a persistent AlterLabSync client (and its asyncio event loop) for its lifetime. Use it as a context manager so the client is closed automatically:

from llama_index.readers.alterlab import AlterLabReader

with AlterLabReader(api_key="sk_live_...") as reader:
    docs = reader.load_data(["https://example.com/docs"])
    print(docs[0].text)

If you can't use a with block, call close() explicitly when you're done with the reader:

reader = AlterLabReader(api_key="sk_live_...")
docs = reader.load_data(["https://example.com/docs"])
reader.close()

close() is idempotent — calling it again (including after a with block already closed the reader) is a no-op.

Options

Parameter Type Default Description
api_key str required AlterLab API key
mode str "auto" Scraping mode: auto, html, js, pdf, ocr
output_format str "markdown" Content format: markdown, text, html, rag, content
render_js bool False Enable JavaScript rendering (browser tier)
base_url str "https://api.alterlab.io" API base URL

load_data(urls, mode=None, output_format=None, extra_info=None, **kwargs) accepts the same parameters plus any keyword arguments forwarded to AlterLabSync.scrape().

Search Tool

AlterLabSearchTool runs web searches and returns numbered title, URL and snippet text:

from llama_index.readers.alterlab import AlterLabSearchTool

tool = AlterLabSearchTool(api_key="sk_live_...", num_results=5, engine="google")
function_tool = tool.to_tool()  # use with a LlamaIndex agent

Blocked-Fetch Fallback

AlterLabBlockedFetchFallback runs your own fetch first and retries through AlterLab only when the result is a 403/429, a bot-protection challenge page, a CAPTCHA, or an empty JavaScript shell. Normal pages, 404s and network errors are returned or raised untouched:

import requests
from llama_index.readers.alterlab import AlterLabBlockedFetchFallback

fallback = AlterLabBlockedFetchFallback(fetch=lambda url: requests.get(url, timeout=20))
function_tool = fallback.to_tool()  # use with a LlamaIndex agent

Metadata

Release files for llama-index-readers-alterlab 0.2.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 llama-index-readers-alterlab 0.2.1
File Size Uploaded Provenance Actions
llama_index_readers_alterlab-0.2.1.tar.gz 9.7 kB With provenance Details for llama_index_readers_alterlab-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-readers-alterlab 0.2.1
File Interpreter ABI Platform Actions
llama_index_readers_alterlab-0.2.1-py3-none-any.whl Python 3 none any Details for llama_index_readers_alterlab-0.2.1-py3-none-any.whl

Total release size: 21.6 kB

Release files / llama_index_readers_alterlab-0.2.1.tar.gz

Download URL llama_index_readers_alterlab-0.2.1.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fa022e412fdb96c83dae6e9a75a6aa1db1f40f55f24a1367639aa75b98871e4b
BLAKE2b-256 checksum
How to use checksums
2a5021abb4350858db4371b68724bc144675616990987fae1be8b59e89c97ca3
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 / llama_index_readers_alterlab-0.2.1-py3-none-any.whl

Download URL llama_index_readers_alterlab-0.2.1-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc088961f239f88c4f3bf578f4e4a66bb4afbcd57da8adaa2986c840fb000221
BLAKE2b-256 checksum
How to use checksums
869b07450f03ffdfd6ba020d02fb324dbb99461e796191265864c13fd0048326
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 llama-index-readers-alterlab 0.2.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 llama_index_readers_alterlab-0.2.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.2.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