LangChain tools for Quercle web search and URL fetching
Project description
langchain-quercle
Quercle web search, fetch, and extraction tools for LangChain.
Installation
uv add langchain-quercle
# or
pip install langchain-quercle
Setup
Set your API key as an environment variable:
export QUERCLE_API_KEY=qk_...
Get your API key at quercle.dev.
Quick Start
from quercle_langchain import QuercleSearchTool, QuercleFetchTool
search = QuercleSearchTool()
result = search.invoke("latest developments in AI agents")
print(result)
Tools
| Tool | Description | Key Args |
|---|---|---|
QuercleSearchTool |
AI-synthesized web search with citations | query, allowed_domains, blocked_domains |
QuercleFetchTool |
Fetch a URL and analyze content with AI | url, prompt |
QuercleRawSearchTool |
Raw web search results (markdown/JSON) | query, format, use_safeguard |
QuercleRawFetchTool |
Raw URL content (markdown/HTML) | url, format, use_safeguard |
QuercleExtractTool |
Extract relevant content chunks from a URL | url, query, format, use_safeguard |
Direct Tool Usage
Sync
from quercle_langchain import (
QuercleSearchTool,
QuercleFetchTool,
QuercleRawSearchTool,
QuercleRawFetchTool,
QuercleExtractTool,
)
# AI-synthesized search
search = QuercleSearchTool()
result = search.invoke("best practices for building AI agents")
print(result)
# Search with domain filtering
result = search.invoke({
"query": "Python documentation",
"allowed_domains": ["docs.python.org"],
})
# Fetch and analyze a page with AI
fetch = QuercleFetchTool()
result = fetch.invoke({
"url": "https://en.wikipedia.org/wiki/Python_(programming_language)",
"prompt": "Summarize the key features of Python",
})
print(result)
# Raw search results
raw_search = QuercleRawSearchTool()
result = raw_search.invoke({"query": "Python tutorials", "format": "json"})
print(result)
# Raw URL content
raw_fetch = QuercleRawFetchTool()
result = raw_fetch.invoke({"url": "https://example.com", "use_safeguard": True})
print(result)
# Extract relevant content from a URL
extract = QuercleExtractTool()
result = extract.invoke({
"url": "https://en.wikipedia.org/wiki/Python_(programming_language)",
"query": "What are Python's main features?",
"format": "json",
})
print(result)
Async
import asyncio
from quercle_langchain import (
QuercleSearchTool,
QuercleFetchTool,
QuercleRawSearchTool,
QuercleRawFetchTool,
QuercleExtractTool,
)
async def main():
# AI-synthesized search
search = QuercleSearchTool()
result = await search.ainvoke("latest AI agent frameworks")
print(result)
# Fetch and analyze with AI
fetch = QuercleFetchTool()
result = await fetch.ainvoke({
"url": "https://en.wikipedia.org/wiki/TypeScript",
"prompt": "What is TypeScript?",
})
print(result)
# Raw search results
raw_search = QuercleRawSearchTool()
result = await raw_search.ainvoke({"query": "Python tutorials", "format": "json"})
print(result)
# Raw URL content
raw_fetch = QuercleRawFetchTool()
result = await raw_fetch.ainvoke({"url": "https://example.com"})
print(result)
# Extract relevant content
extract = QuercleExtractTool()
result = await extract.ainvoke({
"url": "https://en.wikipedia.org/wiki/TypeScript",
"query": "What is TypeScript used for?",
})
print(result)
asyncio.run(main())
Custom API Key
search = QuercleSearchTool(api_key="qk_...")
fetch = QuercleFetchTool(api_key="qk_...")
raw_search = QuercleRawSearchTool(api_key="qk_...")
raw_fetch = QuercleRawFetchTool(api_key="qk_...")
extract = QuercleExtractTool(api_key="qk_...")
Agentic Usage
With LangGraph ReAct Agent
from quercle_langchain import (
QuercleSearchTool,
QuercleFetchTool,
QuercleRawSearchTool,
QuercleRawFetchTool,
QuercleExtractTool,
)
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
model = ChatOpenAI(model="gpt-4o")
tools = [
QuercleSearchTool(),
QuercleFetchTool(),
QuercleRawSearchTool(),
QuercleRawFetchTool(),
QuercleExtractTool(),
]
agent = create_react_agent(model, tools)
response = agent.invoke({
"messages": [
{"role": "user", "content": "Search for the latest AI news and summarize the top story"}
]
})
print(response["messages"][-1].content)
Streaming
for chunk in agent.stream(
{"messages": [{"role": "user", "content": "Research WebAssembly trends"}]},
stream_mode="values",
):
print(chunk["messages"][-1].content)
With Anthropic
from langchain_anthropic import ChatAnthropic
model = ChatAnthropic(model="claude-sonnet-4-20250514")
agent = create_react_agent(model, tools)
API Reference
QuercleSearchTool
AI-synthesized web search with citations.
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
str |
Yes | The search query |
allowed_domains |
list[str] |
No | Only include results from these domains |
blocked_domains |
list[str] |
No | Exclude results from these domains |
QuercleFetchTool
Fetch a URL and analyze its content with AI.
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
str |
Yes | The URL to fetch |
prompt |
str |
Yes | Instructions for content analysis |
QuercleRawSearchTool
Raw web search results without AI synthesis.
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
str |
Yes | The search query |
format |
str |
No | Output format (e.g. "json") |
use_safeguard |
bool |
No | Enable prompt-injection detection |
QuercleRawFetchTool
Raw URL content without AI processing.
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
str |
Yes | The URL to fetch |
format |
str |
No | Output format (e.g. "json") |
use_safeguard |
bool |
No | Enable prompt-injection detection |
QuercleExtractTool
Extract content chunks relevant to a query from a URL.
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
str |
Yes | The URL to fetch and extract from |
query |
str |
Yes | What information to extract |
format |
str |
No | Output format (e.g. "json") |
use_safeguard |
bool |
No | Enable prompt-injection detection |
Configuration
All tools accept these constructor parameters:
| Parameter | Default | Description |
|---|---|---|
api_key |
QUERCLE_API_KEY env var |
Your Quercle API key |
timeout |
None |
Request timeout in seconds |
License
MIT
Project details
Release history Release notifications | RSS feed
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_quercle-1.0.0.tar.gz.
File metadata
- Download URL: langchain_quercle-1.0.0.tar.gz
- Upload date:
- Size: 66.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e9d8833223635a84ab82d531a921b603c807ac812fa0c5113358b433f3f23fa
|
|
| MD5 |
76d1c94a2e74f5b3f86773717dafebc5
|
|
| BLAKE2b-256 |
ea092c2aaf945052dd0e99cd48fb6dad22850b79f4761851ecb76b3e02d0662d
|
Provenance
The following attestation bundles were made for langchain_quercle-1.0.0.tar.gz:
Publisher:
publish.yml on quercledev/langchain-quercle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_quercle-1.0.0.tar.gz -
Subject digest:
7e9d8833223635a84ab82d531a921b603c807ac812fa0c5113358b433f3f23fa - Sigstore transparency entry: 991936278
- Sigstore integration time:
-
Permalink:
quercledev/langchain-quercle@0500abc9ca1ca54fe770cc639bbad889d8176b83 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/quercledev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0500abc9ca1ca54fe770cc639bbad889d8176b83 -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_quercle-1.0.0-py3-none-any.whl.
File metadata
- Download URL: langchain_quercle-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3347a7765d16322dcf55ff64ccb6e3a05ac3fd9fd6453f708f84b1600263cc4
|
|
| MD5 |
5f9faa6784d7ed4f544ea3ab35f8cfc2
|
|
| BLAKE2b-256 |
c7af3ae345e87f9a1546ebd3d725743e41c64770031fb9660b6299d878bf0eef
|
Provenance
The following attestation bundles were made for langchain_quercle-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on quercledev/langchain-quercle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_quercle-1.0.0-py3-none-any.whl -
Subject digest:
f3347a7765d16322dcf55ff64ccb6e3a05ac3fd9fd6453f708f84b1600263cc4 - Sigstore transparency entry: 991936303
- Sigstore integration time:
-
Permalink:
quercledev/langchain-quercle@0500abc9ca1ca54fe770cc639bbad889d8176b83 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/quercledev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0500abc9ca1ca54fe770cc639bbad889d8176b83 -
Trigger Event:
push
-
Statement type: