Skip to main content

AgentSearch Tool Spec (llama-index-tools-agentsearch)

A LlamaIndex ToolSpec for AgentSearch: live web search for agents. Free search needs no API key.

Function Cost
search(query, max_results=None) Free (25 searches/day per user, up to 5 results, no key). Paid and unlimited if a wallet is set.
extract(url, formats=None, max_chars=None) $0.005/call (USDC on Base via x402)
render(url, formats=None, max_chars=None, wait_until=None, wait_for_selector=None) $0.005/call (headless browser for JS pages)

Install

pip install -U llama-index-tools-agentsearch

Quickstart

from llama_index.tools.agentsearch import AgentSearchToolSpec

spec = AgentSearchToolSpec()
print(spec.search("latest LlamaIndex release", max_results=3))  # JSON string

# With an agent
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

agent = FunctionAgent(tools=spec.to_tool_list(), llm=OpenAI(model="gpt-4o-mini"))
# response = await agent.run("What changed in the latest LlamaIndex release? Cite URLs.")

Free-only tool list: [t for t in spec.to_tool_list() if t.metadata.name == "search"]. Force free search even with a wallet set: AgentSearchToolSpec(mode="free").

Paid mode

Install the paid extra (pip install "llama-index-tools-agentsearch[paid]") and set AGENTSEARCH_WALLET_PRIVATE_KEY to the private key of a new wallet made only for this, funded with a little USDC on Base (e.g. $1; no ETH needed). Each call costs $0.005 and is paid over x402 through the Pocket Network Agentic Portal using the official x402 Python SDK. With a key set, search also goes paid and unlimited.

Env var Default
AGENTSEARCH_MAX_TOTAL_ATOMIC 1000000 ($1.00 per process)
AGENTSEARCH_MAX_PER_CALL_ATOMIC 5000 ($0.005; can only be lowered)
AGENTSEARCH_TIMEOUT_MS 30000

Limits are checked before anything is signed. The key is never logged or returned. Paid results include a payment object.

Errors

Tools return "Error: ..." strings instead of raising. A 429 from the free relay means the daily limit (25 searches/day per user) was hit, and the message explains how to upgrade.

Development

pip install -e ".[test]" && pytest     # unit tests (mocked)
AGENTSEARCH_LIVE=1 pytest -k live       # one real free search

Docs: https://agentsearchhq.com/agents.md?utm_source=llama-index-tools-agentsearch&utm_medium=package

MIT

Metadata

Release files for llama-index-tools-agentsearch 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 llama-index-tools-agentsearch 0.2.0
File Size Uploaded
llama_index_tools_agentsearch-0.2.0.tar.gz 9.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-agentsearch 0.2.0
File Interpreter ABI Platform
llama_index_tools_agentsearch-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / llama_index_tools_agentsearch-0.2.0.tar.gz

Download URL llama_index_tools_agentsearch-0.2.0.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9ef0cfc1c543383aa7fa0d519a2673ca3b7c4c20f685cb955ecff5b569385db3
BLAKE2b-256 checksum
How to use checksums
0ab995e89f145be5b011e5a93f6e9511d7d31908ca6630a3ffa62bf64cf80a71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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

Download URL llama_index_tools_agentsearch-0.2.0-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74f1bb84006d3261f68317547889c13891d295749fbc8de15774da463232917f
BLAKE2b-256 checksum
How to use checksums
73880b759c71a90f759716ab9e93eced126b5adef859194ce840a19a566134a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

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