Prerequisites
The following examples require theexa-py and openai libraries and an API key which can be obtained from Exa.
Example
The following agent will search Exa for AAPL news and print the response.cookbook/91_tools/exa_tools.py
Toolkit Functions
| Function | Description |
|---|---|
search_exa | Searches Exa for a query with optional category filtering |
get_contents | Retrieves detailed content from specific URLs |
find_similar | Finds similar content to a given URL |
exa_answer | Gets an AI-powered answer to a question using Exa search results |
research | Performs deep research on a topic and returns structured results with citations |
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
enable_search | bool | True | Enable search functionality |
enable_get_contents | bool | True | Enable content retrieval |
enable_find_similar | bool | True | Enable finding similar content |
enable_answer | bool | True | Enable AI-powered answers |
enable_research | bool | False | Enable research functionality |
all | bool | False | Enable all functionality |
api_key | Optional[str] | None | Exa API key. Uses EXA_API_KEY environment variable if not set |
text | bool | True | Include text content in results |
text_length_limit | int | 1000 | Maximum length of text content per result |
summary | bool | False | Include result summaries |
num_results | Optional[int] | None | Default number of results |
livecrawl | str | "always" | Livecrawl behavior |
start_crawl_date | Optional[str] | None | Include results crawled after date (YYYY-MM-DD) |
end_crawl_date | Optional[str] | None | Include results crawled before date (YYYY-MM-DD) |
start_published_date | Optional[str] | None | Include results published after date (YYYY-MM-DD) |
end_published_date | Optional[str] | None | Include results published before date (YYYY-MM-DD) |
type | Optional[str] | None | Content type filter (e.g., article, blog, video) |
category | Optional[str] | None | Category filter (e.g., news, research paper) |
include_domains | Optional[List[str]] | None | Restrict results to these domains |
exclude_domains | Optional[List[str]] | None | Exclude results from these domains |
show_results | bool | False | Log search results for debugging |
model | Optional[str] | None | Search model to use (‘exa’ or ‘exa-pro’) |
timeout | int | 30 | Maximum seconds to wait for API responses |
research_model | Literal["exa-research", "exa-research-pro"] | "exa-research" | Model used by the research function |
Categories
Available categories for filtering:- company
- research paper
- news
- github
- tweet
- personal site
- linkedin profile
- financial report