Exa Python SDK

2.11.0 · active · verified Fri Apr 10

The official Python SDK for Exa, the web search API for AI. It enables developers to semantically search the web, retrieve page contents, find similar pages, and generate answers with citations. The library is currently at version 2.11.0 and is actively maintained with regular updates.

Warnings

Install

Imports

Quickstart

Instantiate the Exa client with your API key, then perform a web search and get an answer to a question. Ensure the 'EXA_API_KEY' environment variable is set.

import os
from exa_py import Exa

exa = Exa(api_key=os.environ.get('EXA_API_KEY', ''))

if exa.api_key:
    # Search the web
    results = exa.search(
        "blog post about artificial intelligence",
        type="auto",
        contents={"highlights": True}
    )
    print("Search results:", results.results)

    # Ask a question
    response = exa.answer("What is the capital of France?")
    print("Answer:", response.answer)
else:
    print("EXA_API_KEY environment variable not set. Please set it to run the quickstart example.")

view raw JSON →