{"id":2495,"library":"exa-py","title":"Exa Python SDK","description":"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.","status":"active","version":"2.11.0","language":"python","source_language":"en","source_url":"https://github.com/exa-labs/exa-py","tags":["AI","web search","API","SDK"],"install":[{"cmd":"pip install exa-py","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Recommended for managing API keys as environment variables.","package":"python-dotenv","optional":true}],"imports":[{"symbol":"Exa","correct":"from exa_py import Exa"},{"note":"Use for asynchronous operations.","symbol":"AsyncExa","correct":"from exa_py import AsyncExa"}],"quickstart":{"code":"import os\nfrom exa_py import Exa\n\nexa = Exa(api_key=os.environ.get('EXA_API_KEY', ''))\n\nif exa.api_key:\n    # Search the web\n    results = exa.search(\n        \"blog post about artificial intelligence\",\n        type=\"auto\",\n        contents={\"highlights\": True}\n    )\n    print(\"Search results:\", results.results)\n\n    # Ask a question\n    response = exa.answer(\"What is the capital of France?\")\n    print(\"Answer:\", response.answer)\nelse:\n    print(\"EXA_API_KEY environment variable not set. Please set it to run the quickstart example.\")","lang":"python","description":"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."},"warnings":[{"fix":"Uninstall `metaphor-python` and install `exa-py`. Update import statements from `from metaphor_python import Metaphor` to `from exa_py import Exa`.","message":"The library was formerly known as `metaphor-python`. While the API is largely compatible, existing `metaphor-python` installations should be migrated to `exa-py`.","severity":"breaking","affected_versions":"<=1.x.x (metaphor-python)"},{"fix":"Structure `output_schema` to focus only on the desired content fields. Access citation information via `results.output.grounding`.","message":"When 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"By 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Design `output_schema` to adhere to these depth and property count limits when requesting structured output.","message":"For 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'2.11.0':41 'activ':44 'ai':15,49 'answer':32 'api':13,52 'citat':34 'content':26 'current':38 'develop':18 'enabl':17 'exa':1,9 'find':27 'generat':31 'librari':36 'maintain':45 'offici':5 'page':25,29 'python':2,6 'regular':47 'retriev':24 'sdk':3,7,53 'search':12,21,51 'semant':20 'similar':28 'updat':48 'version':40 'web':11,23,50","created_at":"2026-04-11T01:30:32.444406+00:00","updated_at":"2026-04-16T14:52:42.876264+00:00","problems":[{"fix":"Install the package using pip: `pip install exa-py`","cause":"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.","error":"ModuleNotFoundError: No module named 'exa_py'"},{"fix":"Ensure you provide a valid Exa API key when initializing the Exa client: `exa = Exa(api_key=\"your-api-key\")`","cause":"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.","error":"Exa API Error: 401 Unauthorized"},{"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.","cause":"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.","error":"AttributeError: 'Exa' object has no attribute 'some_method'"},{"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.","cause":"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).","error":"Exa API Error: 400 Bad Request"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.19.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://exa.ai","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/exa-py/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","llm-agents"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}