langchain-context
This package contains the LangChain integration for Context.dev, an API for turning the live web into reliable data for AI applications. It gives agents native tools for web search, scraping, crawling, structured extraction, document parsing, brand intelligence, website monitoring, screenshots, and asynchronous batch jobs.
Quick install
pip install -U langchain-context
Get an API key from context.dev and set it as the
CONTEXT_API_KEY environment variable, or pass api_key=... to any tool or toolkit.
export CONTEXT_API_KEY="your-api-key"
Tools
Each Context.dev capability is available as a LangChain BaseTool:
from langchain_context import ContextScrape, ContextSearch
search = ContextSearch()
results = search.invoke(
{
"query": "latest official Stripe product announcements",
"includeDomains": ["stripe.com"],
"numResults": 10,
}
)
scrape = ContextScrape()
page = scrape.invoke({"url": "https://stripe.com/newsroom"})
The most common tools have short aliases:
| Tool | Purpose |
|---|---|
ContextSearch |
Search the live web |
ContextScrape |
Scrape one URL as clean Markdown |
ContextCrawl |
Crawl linked pages from a website |
ContextSitemap |
Discover or search a site's URLs |
ContextExtract |
Extract structured data using a JSON schema |
ContextParse |
Parse PDFs and other documents into Markdown |
Dedicated classes are also available for HTML, images, screenshots, style guides, fonts, company classifications, brand profiles, monitors, and batch jobs.
Toolkit
Give an agent the complete safe-by-default Context.dev toolkit:
from langchain_context import ContextToolkit
tools = ContextToolkit().get_tools()
Or keep the tool list focused:
from langchain_context import (
ContextBatchToolkit,
ContextBrandToolkit,
ContextMonitorToolkit,
ContextWebToolkit,
)
web_tools = ContextWebToolkit().get_tools()
brand_tools = ContextBrandToolkit().get_tools()
monitor_tools = ContextMonitorToolkit().get_tools()
batch_tools = ContextBatchToolkit().get_tools()
Write operations and browser actions are opt-in. Enable them only for agents that should be allowed to create or modify Context.dev resources or interact with forms on third-party websites:
tools = ContextToolkit(
include_write_tools=True,
allow_browser_actions=True,
).get_tools()
All toolkits accept api_key, api_base, and timeout. api_base defaults to
https://api.context.dev/v1 and can also be set with CONTEXT_API_BASE.
Parse documents
ContextParse accepts base64-encoded bytes so files remain compatible with
LangChain's JSON tool-call interface:
import base64
from pathlib import Path
from langchain_context import ContextParse
file_bytes = Path("report.pdf").read_bytes()
result = ContextParse().invoke(
{
"fileBase64": base64.b64encode(file_bytes).decode("ascii"),
"fileName": "report.pdf",
}
)
Async
Every tool supports LangChain's asynchronous interface:
from langchain_context import ContextSearch
result = await ContextSearch().ainvoke(
{"query": "latest Context.dev product announcements"}
)
Coverage
The package exposes all 33 API-backed tools in Context.dev's public MCP catalog.
The MCP-only get-brand visual card is host UI; ContextBrandRetrieve returns the
same underlying brand data as structured output for LangChain applications.
Documentation
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_context-0.1.0.tar.gz.
File metadata
- Download URL: langchain_context-0.1.0.tar.gz
- Upload date:
- Size: 46.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c78c53cd3ed5c5b6f4eb4d4e7c22f1d6f0c61ca3e0d0528ee4217a284de42713
|
|
| MD5 |
e123b5099128e78ec969b0573df17b22
|
|
| BLAKE2b-256 |
591b4af757937691710f691345685f7836ecc009ac92c6a767cf837732fd1482
|
Provenance
The following attestation bundles were made for langchain_context-0.1.0.tar.gz:
Publisher:
publish.yml on context-dot-dev/langchain-context
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_context-0.1.0.tar.gz -
Subject digest:
c78c53cd3ed5c5b6f4eb4d4e7c22f1d6f0c61ca3e0d0528ee4217a284de42713 - Sigstore transparency entry: 2498999190
- Sigstore integration time:
-
Permalink:
context-dot-dev/langchain-context@d92977fe6b59d11ddad47fa1ad6b8e0dc07550e4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/context-dot-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d92977fe6b59d11ddad47fa1ad6b8e0dc07550e4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_context-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_context-0.1.0-py3-none-any.whl
- Upload date:
- Size: 46.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b429b695313a02c81a2ec8a9ae0bed6a7e2bbd5fe3df1da01651d3acd6bf203d
|
|
| MD5 |
8d190960f2f327ee7b796da74b562b19
|
|
| BLAKE2b-256 |
827ba06c66bb57eed22cafc94fe825a3f0c815b6c0a90fbda3e42b5c9482d18f
|
Provenance
The following attestation bundles were made for langchain_context-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on context-dot-dev/langchain-context
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_context-0.1.0-py3-none-any.whl -
Subject digest:
b429b695313a02c81a2ec8a9ae0bed6a7e2bbd5fe3df1da01651d3acd6bf203d - Sigstore transparency entry: 2498999193
- Sigstore integration time:
-
Permalink:
context-dot-dev/langchain-context@d92977fe6b59d11ddad47fa1ad6b8e0dc07550e4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/context-dot-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d92977fe6b59d11ddad47fa1ad6b8e0dc07550e4 -
Trigger Event:
push
-
Statement type: