Skip to main content

openai-agents-agentsearch

Function tools for the OpenAI Agents SDK backed by AgentSearch: live web search for agents. Free search needs no API key.

Tool Cost
agentsearch_search Free by default (up to 25 searches/day per IP, up to 5 results, no key). Paid and unlimited only when you opt in (AGENTSEARCH_MODE=paid or search_mode="paid").
agentsearch_extract $0.007/call (USDC on Base via x402 to AgentSearch)
agentsearch_render $0.010/call (headless browser for JS pages)

Install

pip install -U openai-agents-agentsearch

Quickstart

from agents import Agent, Runner
from openai_agents_agentsearch import agentsearch_search, agentsearch_tools

agent = Agent(
    name="Researcher",
    instructions="Answer with current facts. Cite URLs.",
    tools=[agentsearch_search],          # or agentsearch_tools() for search + extract + render
)
result = Runner.run_sync(agent, "What changed in the latest OpenAI Agents SDK release?")
print(result.final_output)

Search modes

The model only sees agentsearch_search(query, max_results=None); it can never choose paid search. The search mode is a developer setting:

from openai_agents_agentsearch import agentsearch_tools, make_agentsearch_search

tools = agentsearch_tools(search_mode="paid")   # or make_agentsearch_search("paid")
  • free (default): the free relay.
  • paid: unlimited paid search ($0.008/call). Falls back to free with a logged warning if the [paid] extra or wallet key is missing.
  • auto: paid if the [paid] extra is installed and a wallet key is set, otherwise free.

AGENTSEARCH_MODE (free/paid/auto) takes precedence over the developer setting.

agentsearch_extract accepts formats (markdown, text, html, links); agentsearch_render also accepts formats and wait_for_selector.

Paid mode

Install the paid extra (pip install "openai-agents-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). Since 0.3.0 each call is paid over x402 directly to AgentSearch's own API (https://api.agentsearchhq.com, USDC on Base, settled only on success) using the official x402 Python SDK: search $0.008, extract $0.007, render $0.010, search-and-read $0.015. $1 covers about 140 extracts. Prefer the Pocket Network Agentic Portal ($0.005 per call)? Set AGENTSEARCH_PAYMENT_ROUTE=pocket. Extract and render use the key directly. Search stays free unless you opt in to paid search with AGENTSEARCH_MODE=paid (or agentsearch_tools(search_mode="paid")); a key alone does not switch it. If paid is chosen but the [paid] extra or the key is missing, search falls back to free with a logged warning.

Env var Default
AGENTSEARCH_MAX_TOTAL_ATOMIC 1000000 ($1.00 per process)
AGENTSEARCH_PAYMENT_ROUTE direct (AgentSearch's x402 API); pocket = Pocket Network Agentic Portal at $0.005/call
AGENTSEARCH_MAX_PER_CALL_ATOMIC 10000 on the direct route, 5000 on Pocket ($0.010 / $0.005; can only be lowered)
AGENTSEARCH_TIMEOUT_MS 30000
AGENTSEARCH_MODE unset (free, paid or auto; overrides search_mode)

Limits are checked before anything is signed. The key is not included in tool output or error messages. Paid results include a payment object.

Errors

Tools return "Error: ..." strings instead of raising. A 429 from the free relay means the daily limit (up to 25 searches/day per IP) 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=openai-agents-agentsearch&utm_medium=package

MIT

Metadata

Release files for openai-agents-agentsearch 0.4.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 openai-agents-agentsearch 0.4.0
File Size Uploaded Provenance Actions
openai_agents_agentsearch-0.4.0.tar.gz 16.0 kB Without provenance Details for openai_agents_agentsearch-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openai-agents-agentsearch 0.4.0
File Interpreter ABI Platform Actions
openai_agents_agentsearch-0.4.0-py3-none-any.whl Python 3 none any Details for openai_agents_agentsearch-0.4.0-py3-none-any.whl

Total release size: 30.2 kB

Release files / openai_agents_agentsearch-0.4.0.tar.gz

Download URL openai_agents_agentsearch-0.4.0.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
457de5384e88e2eee0c7baabf87e86c27cf5d5a44612530f1c105a44f49e45dc
BLAKE2b-256 checksum
How to use checksums
821ded10d096b2ecda443162ba3af1173b9b4e8c21e735031e93f450ba591c6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / openai_agents_agentsearch-0.4.0-py3-none-any.whl

Download URL openai_agents_agentsearch-0.4.0-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afa1367bb19054b6e8a05c8e40a070fe4b1ef1571d9d1210d4c0fec66ca16c5c
BLAKE2b-256 checksum
How to use checksums
98be43a01423fd93ae5a3432b373db8bbd16cd9bf163e7b131be3c293823da17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for openai-agents-agentsearch 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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