Registry / http-networking / exa-py

exa-py

JSON →
library2.19.0pypypi✓ verified 29d ago

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.

pip install exa-py
INSTALL
IMPORT
SIG · EXA-PY
E
exa-py
http-networkingpythonv2.19.0
Install
6.0s avg
Import
3860ms
Disk
57MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.19.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 3.992s · 58.2MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 6.0s · import 3.728s · 57MB
57MB installed
● package 57MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Exa
✓ from exa_py import Exa
AsyncExa
✓ from exa_py import AsyncExa
Use for asynchronous operations.

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.")
Debug
Known issues
breakingThe library was formerly known as `metaphor-python`. While the API is largely compatible, existing `metaphor-python` installations should be migrated to `exa-py`.
fix
Uninstall `metaphor-python` and install `exa-py`. Update import statements from `from metaphor_python import Metaphor` to `from exa_py import Exa`.
affects: <=1.x.x (metaphor-python)
gotchaWhen using the `search` method with `output_schema`, avoid including citation or confidence fields directly in the schema. Grounding is returned automatically in the `output.grounding` field.
fix
Structure `output_schema` to focus only on the desired content fields. Access citation information via `results.output.grounding`.
affects: All versions
gotchaBy default, content retrieval (e.g., via `search` or `get_contents`) returns text with a maximum of 10,000 characters. To disable content retrieval or specify different options (like highlights or summary), use the `contents` parameter.
fix
Set `contents=False` to opt-out of content retrieval, or pass a dictionary with `ContentsOptions` (e.g., `contents={'highlights': {'max_characters': 4000}}`) to customize.
affects: All versions
gotchaFor searches of `type: "object"` with `output_schema`, there are current limitations on the complexity of the output schema: a maximum nesting depth of 2 and a maximum of 10 total properties are enforced.
fix
Design `output_schema` to adhere to these depth and property count limits when requesting structured output.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'exa_py'
The 'exa-py' package is not installed in the Python environment where the code is being executed, or there is a typo in the import statement.
fix
Install the package using pip: `pip install exa-py`
Exa API Error: 401 Unauthorized
The Exa client was initialized without an API key, or with an invalid, expired, or improperly formatted API key, preventing successful authentication with the Exa API.
fix
Ensure you provide a valid Exa API key when initializing the Exa client: `exa = Exa(api_key="your-api-key")`
AttributeError: 'Exa' object has no attribute 'some_method'
You are attempting to call a method or access an attribute that does not exist on the `Exa` client object, or it has been misspelled. This could also occur if a method was deprecated or renamed in a library update.
fix
Consult the official `exa-py` documentation to verify the correct method and attribute names. Use `dir(exa)` to inspect available methods and attributes on an `Exa` instance.
Exa API Error: 400 Bad Request
An API call was made with invalid request parameters, such as a malformed JSON, missing required fields, or unsupported values for specific parameters (e.g., an incorrect date format for `start_published_date` or an invalid `type` for search).
fix
Review the specific error message for details on the invalid parameter. Refer to the `exa-py` documentation for the method being called to ensure all parameters are correctly formatted and have valid values.
Upgrade
Version history
2.19.0latest on PyPI · released Aug 27, 2026
Audit
Dependencies
python-dotenvoptionalRecommended for managing API keys as environment variables.
Agent activity
32 hits · last 30 days
node
30
OpenAI (training)
1
Resources
exa-py — pip install exa-py · libregistry