UnSearch Docs

LangChain Integration

Use UnSearch with LangChain for AI agent search.

LangChain Integration

UnSearch provides drop-in LangChain tool integration.

Installation

pip install unsearch langchain-core

Usage

from unsearch.langchain import UnSearchResults

# Create the tool
tool = UnSearchResults(
    api_key="sk_live_...",
    max_results=5
)

# Use in a LangChain agent
from langchain.agents import AgentExecutor, create_openai_tools_agent

agent = create_openai_tools_agent(llm, [tool], prompt)
executor = AgentExecutor(agent=agent, tools=[tool])

result = executor.invoke({"input": "What are the latest AI trends?"})

Migrating from Tavily

# Before
from langchain_community.tools import TavilySearchResults
tool = TavilySearchResults(api_key="tvly-...")

# After
from unsearch.langchain import UnSearchResults
tool = UnSearchResults(api_key="sk_live_...")

Same interface, same results, 96% cheaper.

On this page