Official Search1API tools for LangChain
Project description
Search1API for LangChain
Official Search1API tools for LangChain agents. The package exposes live web search, news search, and page crawling through LangChain's standard tool interface while relying on the official Search1API Python SDK for authentication, retries, timeouts, and API errors.
The similarly named
langchain-search1apipackage on PyPI is an independent third-party project.search1api-langchainis the official package maintained by Search1API.
Install
pip install search1api-langchain
Set an API key:
export SEARCH1API_API_KEY="your-api-key"
SEARCH1API_KEY is also accepted for compatibility with the Search1API CLI.
Create a key in the
Search1API dashboard.
Use all tools
from search1api_langchain import Search1APIToolkit
tools = Search1APIToolkit().get_tools()
search = tools[0]
result = search.invoke(
{
"query": "latest LangChain agent releases",
"max_results": 5,
"time_range": "month",
}
)
print(result)
The toolkit returns:
search1api_searchfor discovering ranked web sources;search1api_newsfor recent news articles; andsearch1api_crawlfor reading a known URL as clean content.
Pass the returned list directly to a LangChain agent:
from langchain.agents import create_agent
from search1api_langchain import Search1APIToolkit
agent = create_agent(
model="openai:gpt-5.4",
tools=Search1APIToolkit().get_tools(),
)
response = agent.invoke(
{"messages": [{"role": "user", "content": "What changed in LangChain this month?"}]}
)
The agent example also requires the langchain package and the integration
package for the selected model.
Use tools individually
from search1api_langchain import (
Search1APICrawlTool,
Search1APINewsTool,
Search1APISearchTool,
)
search = Search1APISearchTool()
news = Search1APINewsTool()
crawl = Search1APICrawlTool()
search.invoke({"query": "agent observability", "search_service": "google"})
news.invoke({"query": "AI regulation", "time_range": "day"})
crawl.invoke({"url": "https://example.com/article"})
Every tool supports LangChain's asynchronous invocation:
result = await search.ainvoke({"query": "async Python agents"})
An explicit key and client settings can be supplied when environment-based configuration is not appropriate:
tool = Search1APISearchTool(
api_key="your-api-key",
timeout=45,
max_retries=3,
)
API keys use Pydantic's secret type and are excluded from model serialization.
Credits
Plain Search and News requests cost one credit. Setting crawl_results asks
Search1API to read the top result pages and costs one additional credit for each
successful crawl. The tools therefore default crawl_results to 0.
A Crawl request costs one credit. See Credits and limits for current details.
Development
python -m venv .venv
. .venv/bin/activate
python -m pip install -e ".[dev]"
ruff format --check .
ruff check .
mypy src/search1api_langchain
pytest
python -m build
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 search1api_langchain-0.1.0.tar.gz.
File metadata
- Download URL: search1api_langchain-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60ca806affa0ead52541d85a69abf5da38913e233c7002aa87cacdffd7e02b80
|
|
| MD5 |
253f8c80ab23178c5361d3ebd0c69cbf
|
|
| BLAKE2b-256 |
c845795a6bc194e3b24b9c8fc23d91099a4dcd96ad0db7ae0e079bebf698aa3b
|
Provenance
The following attestation bundles were made for search1api_langchain-0.1.0.tar.gz:
Publisher:
publish.yml on superagents-lab/search1api-langchain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
search1api_langchain-0.1.0.tar.gz -
Subject digest:
60ca806affa0ead52541d85a69abf5da38913e233c7002aa87cacdffd7e02b80 - Sigstore transparency entry: 2279352371
- Sigstore integration time:
-
Permalink:
superagents-lab/search1api-langchain@7e6c65da3ddb5bc4e69ec15631736aa649bcaddd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/superagents-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7e6c65da3ddb5bc4e69ec15631736aa649bcaddd -
Trigger Event:
release
-
Statement type:
File details
Details for the file search1api_langchain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: search1api_langchain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4e7b24de73980d43a39a9aba025b96d84aada31fe696d1d56a72b0b95c6a672
|
|
| MD5 |
f5c57ddb7b7ad2ee6296947189759c59
|
|
| BLAKE2b-256 |
64af3e22c49add712beac3d5aa4de975412529921b8904a7b24992f2d6fc3303
|
Provenance
The following attestation bundles were made for search1api_langchain-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on superagents-lab/search1api-langchain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
search1api_langchain-0.1.0-py3-none-any.whl -
Subject digest:
c4e7b24de73980d43a39a9aba025b96d84aada31fe696d1d56a72b0b95c6a672 - Sigstore transparency entry: 2279352408
- Sigstore integration time:
-
Permalink:
superagents-lab/search1api-langchain@7e6c65da3ddb5bc4e69ec15631736aa649bcaddd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/superagents-lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7e6c65da3ddb5bc4e69ec15631736aa649bcaddd -
Trigger Event:
release
-
Statement type: