Skip to main content

langchain-decodo

LangChain partner package for the Decodo web scraping API.

Provides two LangChain tools and a document loader that let LLM agents and RAG pipelines fetch live web content without managing proxies, JavaScript rendering, or anti-bot protection.

Installation

pip install langchain-decodo

Authentication

Use the Web Data API key from your Web Data API subscription on the Decodo Dashboard. All classes read it from the DECODO_API_TOKEN environment variable, or you can pass it explicitly. Pass auth_mode="token" when using the key:

export DECODO_API_TOKEN="your-decodo-api-key"
tool = DecodoWebScrapeTool(auth_mode="token")

Older plans only have a basic authentication token (base64-encoded username:password). That is the default auth_mode="basic", so omit auth_mode and export the basic token as DECODO_API_TOKEN.

Components

DecodoWebScrapeTool

Scrape any URL and return its full content as markdown or plain text. Handles JavaScript rendering, CAPTCHAs, and geo-blocking automatically.

from langchain_decodo import DecodoWebScrapeTool

tool = DecodoWebScrapeTool(auth_mode="token")  # reads DECODO_API_TOKEN from env
content = tool.run("https://example.com")
print(content)

Pass explicitly:

from pydantic import SecretStr
from langchain_decodo import DecodoWebScrapeTool

tool = DecodoWebScrapeTool(
    decodo_api_token=SecretStr("YOUR_API_KEY"),
    auth_mode="token",
)

DecodoSearchTool

Search Google, Amazon, or Reddit and return structured JSON results.

from langchain_decodo import DecodoSearchTool

tool = DecodoSearchTool(auth_mode="token")

# Google search (default)
results = tool.run({"query": "LangChain latest release", "engine": "google"})

# Amazon product search
results = tool.run({"query": "Python programming book", "engine": "amazon"})

# Reddit discussion search
results = tool.run({"query": "best web scraping libraries", "engine": "reddit"})

Returns a JSON string — a list of objects with content, url, and status_code fields.

Supported engines:

engine Decodo target Description
google google_search Google SERP
amazon amazon_search Amazon product search
reddit google_search + site:reddit.com Reddit via Google

DecodoLoader

Load one or more URLs as LangChain Document objects for use in RAG pipelines.

from langchain_decodo import DecodoLoader

loader = DecodoLoader(
    urls=[
        "https://python.org/about/",
        "https://docs.python.org/3/whatsnew/3.12.html",
    ],
    auth_mode="token",
)
docs = loader.load()

for doc in docs:
    print(doc.metadata["url"], "—", len(doc.page_content), "chars")

Each Document has:

  • page_content — scraped text/markdown.
  • metadata["url"] — the source URL.
  • metadata["source"] — same as url (LangChain convention).
  • metadata["status_code"] — HTTP status from the target site.

LangChain agent example

pip install langchain langchain-openai langchain-decodo
from langchain.agents import create_agent
from langchain_decodo import DecodoSearchTool, DecodoWebScrapeTool

agent = create_agent(
    model="openai:gpt-4o-mini",
    tools=[
        DecodoWebScrapeTool(auth_mode="token"),
        DecodoSearchTool(auth_mode="token"),
    ],
)

result = agent.invoke(
    {
        "messages": [
            {
                "role": "user",
                "content": "What is the latest stable version of Python? Check python.org.",
            }
        ]
    }
)
print(result["messages"][-1].content)

RAG pipeline example

pip install langchain-openai langchain-text-splitters langchain-decodo numpy
from langchain_core.vectorstores import InMemoryVectorStore
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
from langchain_text_splitters import RecursiveCharacterTextSplitter
from langchain_decodo import DecodoLoader

docs = DecodoLoader(urls=["https://python.org/about/"], auth_mode="token").load()

splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
chunks = splitter.split_documents(docs)

store = InMemoryVectorStore.from_documents(chunks, OpenAIEmbeddings())
context = "\n\n".join(
    doc.page_content for doc in store.similarity_search("What is Python used for?", k=4)
)

llm = ChatOpenAI(model="gpt-4o-mini")
answer = llm.invoke(
    f"Answer using only this context:\n\n{context}\n\nQuestion: What is Python used for?"
)
print(answer.content)

Metadata

Release files for langchain-decodo 0.1.3

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-decodo 0.1.3
File Size Uploaded
langchain_decodo-0.1.3.tar.gz 175.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-decodo 0.1.3
File Interpreter ABI Platform
langchain_decodo-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 188.1 kB

Release files / langchain_decodo-0.1.3.tar.gz

Download URL langchain_decodo-0.1.3.tar.gz
Size 175.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f4a7bb70bb9ca2a807a3633c137a487b7c52900d1397378f4a12550f0ca11c15
BLAKE2b-256 checksum
How to use checksums
31008680ca229cb7f20d2396549d8ce729ba9a0697e3eaab5edc5e8e237f1273
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 12, 2026.

Transparency log

Release files / langchain_decodo-0.1.3-py3-none-any.whl

Download URL langchain_decodo-0.1.3-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f65c2f83af20051592c7cd27419d1f719d93b690800d7574fc6651fb580dc53
BLAKE2b-256 checksum
How to use checksums
3ecccf8ecc92026277bbceb2798e6d93e229e7f8209a2fcb45c15ce3135a8a42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 12, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.4

2 release files

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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