Skip to main content

langchain-lyrenth

Read the web through Lyrenth from LangChain. A page arrives as clean Markdown instead of raw HTML, typically 80 to 90 percent fewer input tokens for the same page, and carries its canonical source URL so an answer built on it can be attributed.

Pages are served from a standing index of over 2 billion documents, so when many agents read the same URL it does not become many requests to that website.

pip install langchain-lyrenth

Get a free API key at https://lyrenth.com/signup (2,000 reads a month, no card). The components read LYRENTH_API_KEY from the environment.

A tool, for an agent

Give an agent the ability to read any page it decides it needs.

from langchain.agents import create_agent
from langchain_lyrenth import LyrenthReadTool

agent = create_agent(
    model="openai:gpt-5.5",
    tools=[LyrenthReadTool()],
    system_prompt="You are a research assistant.",
)

result = agent.invoke({"messages": [
    {"role": "user", "content": "What does https://example.com/pricing say?"}
]})

The tool is called read_url, takes a single url, and returns the page as Markdown with its title and source URL at the top. It implements the async path too, so it does not block the event loop an agent runs on.

Options: LyrenthReadTool(fresh=True) forces a live re-fetch instead of the stored copy, and max_tokens=4000 caps a long page at roughly that many tokens, trimmed at a clean boundary.

A loader, for a pipeline

When the URLs are known ahead of time, load them as Documents.

from langchain_lyrenth import LyrenthLoader

docs = LyrenthLoader([
    "https://example.com/a",
    "https://example.com/b",
]).load()

docs[0].page_content   # the cleaned Markdown
docs[0].metadata       # {"source", "title", "description", "word_count"}

lazy_load() streams them one at a time. The same fresh and max_tokens options apply, and client= reuses an existing lyrenth.Lyrenth client.

Notes

Reads resolve through a shared cache, so a page many callers want is fetched from its origin a minimal number of times. Lyrenth identifies its crawler, honors robots.txt, and does not train foundation models on crawled content; the policy is at https://lyrenth.com/bot.

MIT licensed. Issues and questions: https://github.com/lyrenth/langchain-lyrenth/issues.

Release files for langchain-lyrenth 0.2.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-lyrenth 0.2.0
File Size Uploaded
langchain_lyrenth-0.2.0.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-lyrenth 0.2.0
File Interpreter ABI Platform
langchain_lyrenth-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / langchain_lyrenth-0.2.0.tar.gz

Download URL langchain_lyrenth-0.2.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
127a86392b2baa84c4b463544fcb597e662e73f979978a43e92e3fb2a0d37f28
BLAKE2b-256 checksum
How to use checksums
d4c204ae1c512a60bf880fc9ed9cd07cd223c4dc4bc720ab76f179435a0e2ec1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / langchain_lyrenth-0.2.0-py3-none-any.whl

Download URL langchain_lyrenth-0.2.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a03c87e06830ff515de192833e00076878212c458684a4fa52ad9f41b3f12ac
BLAKE2b-256 checksum
How to use checksums
7a92fa26ff4e9a0e094f12007d0914eb9bdacf52f745a9b4e531e8b8ec40e48d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.2.0 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