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

All classes read your Decodo API token from the DECODO_API_TOKEN environment variable, or you can pass it explicitly.

export DECODO_API_TOKEN="your-decodo-api-token"

Get a token from the Decodo Dashboard.

By default every class expects basic credentials (base64-encoded username:password). If your token is a plain API token, pass auth_mode="token".:

tool = DecodoWebScrapeTool(auth_mode="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()  # 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_TOKEN"))

DecodoSearchTool

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

from langchain_decodo import DecodoSearchTool

tool = DecodoSearchTool()

# 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",
    ],
)
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(), DecodoSearchTool()],
)

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/"]).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.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-decodo 0.1.1
File Size Uploaded
langchain_decodo-0.1.1.tar.gz 175.7 kB Details

Built distribution (wheel)

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

Total release size: 187.8 kB

Release files / langchain_decodo-0.1.1.tar.gz

Download URL langchain_decodo-0.1.1.tar.gz
Size 175.7 kB
Tags Source
SHA-256 checksum
How to use checksums
02c664b8563a98686992379a6739b34a037e5a733a5179cbb8ee3170304459cd
BLAKE2b-256 checksum
How to use checksums
6412b46bb6d555f7b0ab399a8be5e040971ff5c42e69f7033d591d5c3d2894c7
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 5, 2026.

Transparency log

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

Download URL langchain_decodo-0.1.1-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ccf4a21049b95de1bf07025ec8f753e3d9925c5fda011b9368a6ec0a1cd9785
BLAKE2b-256 checksum
How to use checksums
405f6d7697e45ac46632a0791a156562f9cc45c98276074a380708826fed8ce4
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 5, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

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