Skip to main content

llama-index-readers-alterlab

PyPI downloads license source

Official AlterLab data reader for LlamaIndex.

Scrape any web page — including JavaScript-heavy SPAs and pages that need full browser rendering — 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.2

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.2
File Size Uploaded Provenance Actions
llama_index_readers_alterlab-0.2.2.tar.gz 10.2 kB With provenance Details for llama_index_readers_alterlab-0.2.2.tar.gz

Built distribution (wheel)

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

Total release size: 22.4 kB

Release files / llama_index_readers_alterlab-0.2.2.tar.gz

Download URL llama_index_readers_alterlab-0.2.2.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
52d83798178e5ffb59415ec9043a1a7fabebc447b6fadb686e3dd884db3e5475
BLAKE2b-256 checksum
How to use checksums
72dc7a50aff47bb4792103ffee7cc5aedcd1bb61f8a0f64379168dff6784f46d
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 10, 2026.

Transparency log

Release files / llama_index_readers_alterlab-0.2.2-py3-none-any.whl

Download URL llama_index_readers_alterlab-0.2.2-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2abf59f7185b03d088b7365ff8369c41af9458cf9e80b0050be9804177cbb935
BLAKE2b-256 checksum
How to use checksums
0672ebcecf093a3349354bde2a133e2750e99bafb0a4b1d513ea7d6fcf507c87
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 10, 2026.

Transparency log

Security for llama-index-readers-alterlab 0.2.2

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llama_index_readers_alterlab-0.2.2.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 10, 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.

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