LangChain
Give LangChain agents live web search, news, and page content with the official search1api-langchain toolkit.
search1api-langchain is the official Search1API integration for LangChain. It
exposes web search, news search, and page crawling through LangChain's standard
tool interface, and relies on the official Search1API Python SDK for
authentication, retries, timeouts, and API errors.
The similarly named langchain-search1api package on PyPI is an independent
third-party project. search1api-langchain is the package maintained by
Search1API.
Install
pip install search1api-langchainCreate a key in the dashboard, then export it:
export SEARCH1API_API_KEY="your-api-key"SEARCH1API_KEY is also accepted, so the same environment works for the
Search1API CLI.
Use the whole toolkit
Search1APIToolkit returns all three tools at once, ready to hand to an 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 toolkit provides search1api_search, search1api_news, and
search1api_crawl. Each tool is also importable on its own when an agent should
only receive one capability.
Every tool supports asynchronous invocation:
from search1api_langchain import Search1APISearchTool
search = Search1APISearchTool()
result = await search.ainvoke({"query": "async Python agents"})An explicit key and client settings can be supplied when environment-based configuration is not appropriate:
from search1api_langchain import Search1APISearchTool
search = Search1APISearchTool(
api_key="your-api-key",
timeout=45,
max_retries=3,
)API keys use Pydantic's secret type and are excluded from model serialization.
Search
search1api_search returns ranked web results for a query.
from search1api_langchain import Search1APISearchTool
search = Search1APISearchTool()
results = search.invoke(
{
"query": "latest LangChain agent releases",
"max_results": 5,
"time_range": "month",
}
)Each result carries title, link, and snippet. Setting crawl_results also
fills content with the readable page text, and image queries return an
images list. search_service selects the upstream engine when a specific one
is required.
See Search for the full request and response contract.
News
search1api_news returns recent news articles for a query, with the same
result shape as search.
from search1api_langchain import Search1APINewsTool
news = Search1APINewsTool()
articles = news.invoke({"query": "AI regulation", "time_range": "day"})See News for supported sources and parameters.
Crawl
search1api_crawl reads a known URL and returns clean, readable content. It
fetches and extracts page content; it does not drive a browser session.
from search1api_langchain import Search1APICrawlTool
crawl = Search1APICrawlTool()
page = crawl.invoke({"url": "https://example.com/article"})Pass a URL returned by search when an agent needs the full article rather than a snippet. See Crawl for the full contract.
Credits
Search and news requests cost one credit each. Setting crawl_results asks
Search1API to read the top result pages and costs one additional credit for each
page crawled successfully, so the tools default it to 0. A crawl request costs
one credit.
New accounts receive 100 credits without a credit card or expiration date. See Credits and limits for current rates.