"fascinating article about cats" and compare the search results from Google and Exa. Google gives us SEO-optimized listicles based on the keyword “fascinating”. Exa just works.
This notebook goes over how to use Exa Search with LangChain.
Setup
Installation
Install the LangChain Exa integration package:Credentials
You’ll need an Exa API key to use this integration. Get $10 free credit (plus more by completing certain actions like making your first search) by signing up here.Using ExaSearchResults tool
ExaSearchResults is a tool that can be used with LangChain agents to perform Exa searches. It provides a more structured interface for search operations:Advanced features for ExaSearchResults
You can use advanced search options like controlling search type, live crawling, and content filtering:Using ExaFindSimilarResults tool
ExaFindSimilarResults allows you to find webpages similar to a given URL. This is useful for finding related content or competitive analysis:Use within an Agent
We can use the ExaSearchResults and ExaFindSimilarResults tools with a LangGraph agent. This gives the agent the ability to dynamically search for information and find similar content based on the user’s queries. First, let’s set up the language model. You’ll need to provide your OpenAI API key:Using ExaSearchRetriever
ExaSearchRetriever is a retriever that uses Exa Search to retrieve relevant documents.The
max_characters parameter for TextContentsOptions used to be called max_length which is now deprecated. Make sure to use max_characters instead.Basic usage
Here’s a simple example of using ExaSearchRetriever:Advanced features
You can use advanced features like controlling the number of results, search type, live crawling, summaries, and text content options:API reference
For detailed documentation of all Exa API features and configurations, visit the Exa API documentation.Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

