Skip to main content

langchain-webcite

LangChain tools and a retriever for Webcite, one evidence suite for AI apps and agents: document parsing and OCR to Markdown, claim verification with verdicts, citations bound to source passages, and source search.

Class Kind What it does Credits
WebciteVerifyClaimTool Tool Checks a claim and returns a verdict, a summary and citations with URL, stance and the source passage 4 per claim
WebciteSearchSourcesTool Tool Finds sources for a query, with the matching passage 2 per search
WebciteExtractDocumentTool Tool Reads a PDF, scan, image, spreadsheet or office file at a URL into Markdown Per page, at cost
WebciteRetriever Retriever Source search as LangChain Documents (passage as content, URL, title and stance as metadata) 2 per query
WebciteToolkit Toolkit The three tools sharing one client

Prices are on webcite.co/pricing. The Free plan includes 100 credits, renewing every 30 days while credits remain.

Install

pip install langchain-webcite
export WEBCITE_API_KEY=...   # create one at https://webcite.co/api-keys

Python 3.10 or newer. Depends on langchain-core and the official webcite Python SDK.

Use the tools in an agent

from langchain.agents import create_agent
from langchain_webcite import WebciteToolkit

agent = create_agent(
    "anthropic:claude-sonnet-5",
    tools=WebciteToolkit().get_tools(),
    system_prompt="Check each claim with webcite_verify_claim and cite the URLs it returns.",
)
agent.invoke({"messages": [{"role": "user", "content": "Can you see the Great Wall from the Moon?"}]})

Verify a claim

from langchain_webcite import WebciteVerifyClaimTool

tool = WebciteVerifyClaimTool(max_citations=2)
print(tool.invoke({"claim": "The Great Wall of China is visible from the Moon with the naked eye."}))

Output, rendered from the response recorded from the API on 24 November 2026 (webcite.co/samples/claim-great-wall.json), shortened here:

{"claim": "The Great Wall of China is visible from the Moon with the naked eye.",
 "verdict": "contradicted",
 "summary": "The claim that the Great Wall of China is visible from the Moon with the naked eye is false ...",
 "citations": [{"id": "1", "url": "https://www.nasa.gov/image-article/great-wall/", "title": "nasa.gov",
   "stance": "contradicts",
   "passage": "... Despite myths to the contrary, the wall isn't visible from the moon, ..."}, ...],
 "credits": 4}

Pass source_urls to check the claim against specific pages instead of searching the web. When the tool is called by a model (with a ToolCall), the full API response is attached as the ToolMessage artifact, so nothing is lost when the model only sees the compact text.

Parse a document to Markdown

from langchain_webcite import WebciteExtractDocumentTool

tool = WebciteExtractDocumentTool()          # mode="lite" for the faster, cheaper read
print(tool.invoke({"url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf"}))

The first line is a JSON header; the Markdown follows. Recorded output for page 1 of the form (webcite.co/samples/doc-irs-w9.json):

{"state": "complete", "pages": 1, "credits": 0.4966}

Form **W-9**
(Rev. March 2024)
...

Check state: anything other than complete comes with a reason naming what was not read. Long documents are cut at max_chars (50,000 by default) and the header says so.

Retrieve sources

from langchain_webcite import WebciteRetriever

retriever = WebciteRetriever(k=3)
for doc in retriever.invoke("Apple total net sales fiscal 2024"):
    print(doc.metadata["url"], doc.page_content[:80])

Configuration

Every class takes an optional client, a webcite.Webcite instance. Without one it creates Webcite(), which reads WEBCITE_API_KEY (and WEBCITE_API_URL if set). Pass your own client to set a timeout, retries or a custom httpx client:

from webcite import Webcite
from langchain_webcite import WebciteToolkit

tools = WebciteToolkit(client=Webcite(timeout=120, max_retries=2)).get_tools()

The same capabilities are also available to any MCP client from the hosted server at https://api.webcite.co/mcp (OAuth or API key).

Development

make install   # uv sync --all-groups
make check     # ruff, mypy, pytest
make build     # wheel and sdist in dist/

Tests run the LangChain standard tool and retriever tests (langchain-tests) against recorded API responses in tests/fixtures; sockets are disabled, so no test reaches the network or spends credits. Examples are in examples/.

MIT licensed.

Metadata

Release files for langchain-webcite 0.1.0

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-webcite 0.1.0
File Size Uploaded Provenance Actions
langchain_webcite-0.1.0.tar.gz 24.2 kB Without provenance Details for langchain_webcite-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-webcite 0.1.0
File Interpreter ABI Platform Actions
langchain_webcite-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_webcite-0.1.0-py3-none-any.whl

Total release size: 32.7 kB

Release files / langchain_webcite-0.1.0.tar.gz

Download URL langchain_webcite-0.1.0.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
274dfc364e7f4e98ed4d10144dcb9b8e21b0c8918f19702835aa0c09eb4d5ce2
BLAKE2b-256 checksum
How to use checksums
fd1a3bcc1f2f80ba80e21c75683046c8d1c24d14a852640584d93238f3d4af5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / langchain_webcite-0.1.0-py3-none-any.whl

Download URL langchain_webcite-0.1.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a137c587ee9ed145bc0365d56a5687e0e154e6ede05b366e1646564cfbe6eadf
BLAKE2b-256 checksum
How to use checksums
cbbed7bbaf04faebe874e24412d96c1cf2c02555ad01f6c03a22b146825469d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for langchain-webcite 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.1.0 This release

2 release files No 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