{"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":"en","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,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}