Search Tools (Python @tool Pattern)
Web search capabilities using Google (primary) and DuckDuckGo (fallback).
Installation
uv add tool-search-tools
Tools Provided
| Tool | Description |
|---|---|
web_search |
Search with automatic Google → DuckDuckGo fallback |
search_google |
Google only (requires API credentials) |
search_duckduckgo |
DuckDuckGo only (no credentials needed) |
Configuration
Google Search (Optional)
Set environment variables for Google Programmable Search Engine:
export GOOGLE_API_KEY="your-api-key"
export GOOGLE_CSE_ID="your-cse-id"
Without these, web_search automatically falls back to DuckDuckGo.
Rate Limiting (Optional)
export GOOGLE_SEARCH_RATE_LIMIT="1.0" # requests per second
export GOOGLE_SEARCH_TIMEOUT="30.0" # seconds
export DUCKDUCKGO_SEARCH_RATE_LIMIT="1.0"
export DUCKDUCKGO_SEARCH_TIMEOUT="30.0"
Usage
Direct Invocation
from search_tools import web_search
result = await web_search.ainvoke({"query": "python async tutorial", "num_results": 5})
print(result["provider"]) # "google" or "duckduckgo"
for r in result["results"]:
print(f"{r['title']}: {r['url']}")
With LangGraph
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import ToolNode
from search_tools import web_search
tools = [web_search]
llm = ChatOpenAI(model="gpt-4o-mini")
llm_with_tools = llm.bind_tools(tools)
tool_node = ToolNode(tools)
Response Format
{
"results": [
{"title": "Page Title", "url": "https://...", "snippet": "Description..."},
...
],
"provider": "google", # or "duckduckgo"
"query": "original query",
"count": 5
}
When to Use Which
| Tool | Use Case |
|---|---|
web_search |
Default choice - automatic fallback |
search_google |
Need Google specifically, handle errors yourself |
search_duckduckgo |
Testing, or when Google quota exhausted |
Metadata
Release files for agentarch-search-tools 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentarch_search_tools-1.0.2.tar.gz | 6.8 kB | Without provenance | Details for agentarch_search_tools-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentarch_search_tools-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for agentarch_search_tools-1.0.2-py3-none-any.whl |
Total release size: 13.6 kB
Release files / agentarch_search_tools-1.0.2.tar.gz
| Download URL | agentarch_search_tools-1.0.2.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e01217463461ea0fc8c491f0cfd954fdc75e0e14ba71aabf36225dd0412c68d
|
|
BLAKE2b-256 checksum How to use checksums |
2b5f41f2d65fc991b79706e600f1aabb479b34653a31708aa3ba03df01d43f09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Release files / agentarch_search_tools-1.0.2-py3-none-any.whl
| Download URL | agentarch_search_tools-1.0.2-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
221f5d2298f45cfc4fcf5fa334cb9ba846b1f93b1c3add388000b34c6ab839de
|
|
BLAKE2b-256 checksum How to use checksums |
7194bd0749fa983ce16472c32dcbc12478871c54271e24bcada4881af01103f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Security for agentarch-search-tools 1.0.2
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.