Quercle tools for LlamaIndex - AI-powered web fetch and search
Project description
llama-index-tools-quercle
Quercle web search, fetch, and extraction tools for LlamaIndex.
Installation
uv add llama-index-tools-quercle
# or
pip install llama-index-tools-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 llama_index.tools.quercle import QuercleToolSpec
spec = QuercleToolSpec()
tools = spec.to_tool_list()
# tools contains FunctionTool instances for all 5 tools:
# search, fetch, raw_search, raw_fetch, extract
Tools
search / asearch -- AI-Synthesized Web Search
Searches the web and returns an AI-synthesized answer with citations.
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
str |
Yes | Search query |
allowed_domains |
list[str] |
No | Only include results from these domains |
blocked_domains |
list[str] |
No | Exclude results from these domains |
fetch / afetch -- Fetch URL and Analyze with AI
Fetches a URL and processes its content with an AI prompt.
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
str |
Yes | URL to fetch |
prompt |
str |
Yes | Instructions for how to process the page content |
raw_search / araw_search -- Raw Web Search
Searches the web and returns raw search results without AI synthesis.
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
str |
Yes | Search query |
format |
str |
No | Response format ("markdown" or "json") |
use_safeguard |
bool |
No | Enable content safety filtering |
raw_fetch / araw_fetch -- Raw URL Content
Fetches a URL and returns its raw content without AI processing.
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
str |
Yes | URL to fetch |
format |
str |
No | Response format ("markdown" or "html") |
use_safeguard |
bool |
No | Enable content safety filtering |
extract / aextract -- Extract Relevant Content from URL
Fetches a URL and returns only the chunks relevant to a query.
| Parameter | Type | Required | Description |
|---|---|---|---|
url |
str |
Yes | URL to fetch |
query |
str |
Yes | Query describing what content to extract |
format |
str |
No | Response format ("markdown" or "json") |
use_safeguard |
bool |
No | Enable content safety filtering |
Direct Tool Usage
Sync
from llama_index.tools.quercle import QuercleToolSpec
spec = QuercleToolSpec()
# AI-synthesized search
result = spec.search(query="best practices for building AI agents")
print(result)
# Search with domain filtering
result = spec.search(
query="Python documentation",
allowed_domains=["docs.python.org"],
)
print(result)
# Fetch and analyze a page with AI
result = spec.fetch(
url="https://en.wikipedia.org/wiki/Python_(programming_language)",
prompt="Summarize the key features of Python",
)
print(result)
# Raw search results as JSON
result = spec.raw_search(query="LlamaIndex tutorials", format="json")
print(result)
# Raw page content as markdown
result = spec.raw_fetch(
url="https://en.wikipedia.org/wiki/Python_(programming_language)",
format="markdown",
)
print(result)
# Extract relevant content from a page
result = spec.extract(
url="https://example.com/pricing",
query="pricing plans and features",
format="json",
)
print(result)
Async
import asyncio
from llama_index.tools.quercle import QuercleToolSpec
async def main():
spec = QuercleToolSpec()
result = await spec.asearch(query="latest AI agent frameworks")
print(result)
result = await spec.afetch(
url="https://en.wikipedia.org/wiki/TypeScript",
prompt="What is TypeScript?",
)
print(result)
result = await spec.araw_search(query="LlamaIndex tutorials", format="json")
print(result)
result = await spec.araw_fetch(
url="https://en.wikipedia.org/wiki/TypeScript",
format="markdown",
)
print(result)
result = await spec.aextract(
url="https://example.com/pricing",
query="pricing plans and features",
)
print(result)
asyncio.run(main())
Standalone Tools
from llama_index.tools.quercle import (
create_quercle_search_tool,
create_quercle_fetch_tool,
create_quercle_raw_search_tool,
create_quercle_raw_fetch_tool,
create_quercle_extract_tool,
)
search_tool = create_quercle_search_tool()
fetch_tool = create_quercle_fetch_tool()
raw_search_tool = create_quercle_raw_search_tool()
raw_fetch_tool = create_quercle_raw_fetch_tool()
extract_tool = create_quercle_extract_tool()
Custom API Key
spec = QuercleToolSpec(api_key="qk_...")
Agentic Usage
With FunctionAgent
import asyncio
from llama_index.llms.openai import OpenAI
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.tools.quercle import QuercleToolSpec
async def main():
spec = QuercleToolSpec()
tools = spec.to_tool_list()
agent = FunctionAgent(
tools=tools,
llm=OpenAI(model="gpt-4o"),
system_prompt="You are a helpful research assistant. Use the search, fetch, "
"and extract tools to find accurate, up-to-date information.",
)
response = await agent.run(
user_msg="Research the latest developments in WebAssembly and summarize them"
)
print(response)
asyncio.run(main())
With ReActAgent
from llama_index.core.agent.workflow import ReActAgent
agent = ReActAgent(
tools=spec.to_tool_list(),
llm=OpenAI(model="gpt-4o"),
verbose=True,
)
response = await agent.run(user_msg="Search for trending AI papers this week")
Streaming
from llama_index.core.agent.workflow import AgentStream
handler = agent.run(user_msg="Summarize the latest AI news")
async for event in handler.stream_events():
if isinstance(event, AgentStream):
print(event.delta, end="", flush=True)
Configuration
| Parameter | Default | Description |
|---|---|---|
api_key |
QUERCLE_API_KEY env var |
Your Quercle API key |
timeout |
None |
Request timeout in seconds |
API Reference
| Export | Description |
|---|---|
QuercleToolSpec |
LlamaIndex BaseToolSpec with search, fetch, raw_search, raw_fetch, extract (+ async variants) |
create_quercle_search_tool(...) |
Standalone FunctionTool -- AI-synthesized web search with citations |
create_quercle_fetch_tool(...) |
Standalone FunctionTool -- Fetch a URL and analyze content with AI |
create_quercle_raw_search_tool(...) |
Standalone FunctionTool -- Raw web search results (markdown/json) |
create_quercle_raw_fetch_tool(...) |
Standalone FunctionTool -- Raw URL content (markdown/html) |
create_quercle_extract_tool(...) |
Standalone FunctionTool -- Extract relevant content from a URL |
All tools use the QUERCLE_API_KEY environment variable by default. Use api_key parameter to provide a custom key.
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 llama_index_tools_quercle-1.0.0.tar.gz.
File metadata
- Download URL: llama_index_tools_quercle-1.0.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b7b9e4656e0de6a708f0a67d5a68f46ee1d252b7add969349cbb5ee6b5699ce
|
|
| MD5 |
047102a5e1c5444aa7ed97bdeecad0fa
|
|
| BLAKE2b-256 |
8c0c53ff955917a519e13920113cd7fbd26da92dbfb9d528f6dcd5c5d9680668
|
Provenance
The following attestation bundles were made for llama_index_tools_quercle-1.0.0.tar.gz:
Publisher:
publish.yml on quercledev/quercle-llama-index
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llama_index_tools_quercle-1.0.0.tar.gz -
Subject digest:
8b7b9e4656e0de6a708f0a67d5a68f46ee1d252b7add969349cbb5ee6b5699ce - Sigstore transparency entry: 991952568
- Sigstore integration time:
-
Permalink:
quercledev/quercle-llama-index@ba84a3d7d9ff26b2210a8cde31fac75b87b10169 -
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@ba84a3d7d9ff26b2210a8cde31fac75b87b10169 -
Trigger Event:
push
-
Statement type:
File details
Details for the file llama_index_tools_quercle-1.0.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_tools_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 |
73934556c431fc1488b381c9d67c0845f8bf6cdc90217dffaab1f85c48536f33
|
|
| MD5 |
f1b5a5b2bd1cf1cf634798340dee9b03
|
|
| BLAKE2b-256 |
b2aa9bcdbf26458dbd93eb3c2db6a9d12841c7eb5a0c1b754f9dc7f5a2df2f0a
|
Provenance
The following attestation bundles were made for llama_index_tools_quercle-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on quercledev/quercle-llama-index
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llama_index_tools_quercle-1.0.0-py3-none-any.whl -
Subject digest:
73934556c431fc1488b381c9d67c0845f8bf6cdc90217dffaab1f85c48536f33 - Sigstore transparency entry: 991952572
- Sigstore integration time:
-
Permalink:
quercledev/quercle-llama-index@ba84a3d7d9ff26b2210a8cde31fac75b87b10169 -
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@ba84a3d7d9ff26b2210a8cde31fac75b87b10169 -
Trigger Event:
push
-
Statement type: