exa-py

Python SDK for Exa API.

MIT 116 个版本 Python >=3.9
Exa AI <hello@exa.ai>
安装
pip install exa-py
poetry add exa-py
pipenv install exa-py
conda install exa-py
描述

Exa Python SDK

PyPI version

The official Python SDK for Exa, the web search API for AI.

Documentation | Dashboard

Install

pip install exa-py

Requires Python 3.9+

Quick Start

from exa_py import Exa

exa = Exa(api_key="your-api-key")

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

# Ask a question
response = exa.answer("What is the capital of France?")
results = exa.search(
    "machine learning startups",
    contents={"highlights": True}
)
results = exa.search(
    "climate tech news",
    num_results=20,
    start_published_date="2024-01-01",
    include_domains=["techcrunch.com", "wired.com"],
    contents={"highlights": True}
)
results = exa.search(
    "What are the latest battery breakthroughs?",
    type="auto",
    system_prompt="Prefer official sources and avoid duplicate results",
    output_schema={
        "type": "object",
        "properties": {
            "summary": {"type": "string"},
            "key_companies": {"type": "array", "items": {"type": "string"}},
        },
        "required": ["summary", "key_companies"],
    },
)
print(results.output.content if results.output else None)
for chunk in exa.stream_search(
    "What are the latest battery breakthroughs?",
    type="auto",
):
    if chunk.content:
        print(chunk.content, end="", flush=True)

Search output_schema modes:

  • {"type": "text", "description": "..."}: return plain text in output.content
  • {"type": "object", ...}: return structured JSON in output.content

system_prompt and output_schema are supported on every search type. Search streaming is available via stream_search(...), which yields OpenAI-style chat completion chunks.

For type: "object", search currently enforces:

  • max nesting depth: 2
  • max total properties: 10

Deep search variants that also support additional_queries:

  • deep-lite
  • deep
  • deep-reasoning

Contents

results = exa.get_contents(
    ["https://docs.exa.ai"],
    text=True
)
results = exa.get_contents(
    ["https://arxiv.org/abs/2303.08774"],
    highlights=True
)

Answer

response = exa.answer("What caused the 2008 financial crisis?")
print(response.answer)
for chunk in exa.stream_answer("Explain quantum computing"):
    print(chunk, end="", flush=True)

Agent API

The Agent API is available without a beta header.

run = exa.agent.runs.create(
    query="Find engineering leaders at AI infrastructure companies that raised a Series A or B in the last 6 months.",
    output_schema={
        "type": "object",
        "properties": {
            "people": {
                "type": "array",
                "maxItems": 10,
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {"type": "string"},
                        "contact_email": {"type": "string", "format": "email"},
                        "linkedin_url": {"type": "string", "format": "uri"},
                    },
                    "required": ["name", "linkedin_url"],
                },
            }
        },
        "required": ["people"],
    },
    effort="auto",
)

run = exa.agent.runs.poll_until_finished(run.id)
print(run.output.structured if run.output else None)

Async

from exa_py import AsyncExa

exa = AsyncExa(api_key="your-api-key")

results = await exa.search("async search example", contents={"highlights": True})

More

See the full documentation for all features including websets, filters, and advanced options.

版本列表
2.14.0 2026-06-16
2.13.2 2026-06-08
2.13.0 2026-05-13
2.12.1 2026-04-22
2.12.0 2026-04-15
2.11.0 2026-04-04
2.10.2 2026-03-26
2.10.1 2026-03-25
2.10.0 2026-03-23
2.9.0 2026-03-13
2.8.1 2026-03-10
2.8.0 2026-03-10
2.7.1 2026-03-10
2.7.0 2026-03-04
2.6.1 2026-02-27
2.6.0 2026-02-27
2.5.0 2026-02-25
2.4.0 2026-02-10
2.3.0 2026-02-01
2.2.0 2026-01-27
2.1.1 2026-01-22
2.1.0 2026-01-22
2.0.2 2025-12-19
2.0.1 2025-11-21
2.0.0 2025-10-28
1.16.2 2026-04-24
1.16.1 2025-10-09
1.16.0 2025-10-08
1.15.6 2025-09-10
1.15.5 2025-09-05
1.15.4 2025-08-29
1.15.3 2025-08-25
1.15.2 2025-08-23
1.15.1 2025-08-21
1.15.0 2025-08-21
1.14.20 2025-07-30
1.14.19 2025-07-29
1.14.18 2025-07-21
1.14.17 2025-07-17
1.14.16 2025-07-10
1.14.15 2025-07-03
1.14.14 2025-07-02
1.14.13 2025-06-27
1.14.12 2025-06-24
1.14.11 2025-06-23
1.14.10 2025-06-21
1.14.9 2025-06-18
1.14.8 2025-06-21
1.14.7 2025-06-17
1.14.6 2025-06-09
1.14.5 2025-06-07
1.14.4 2025-06-07
1.14.3 2025-06-06
1.14.2 2025-06-04
1.14.1 2025-06-03
1.14.0 2025-06-01
1.13.2 2025-05-31
1.13.1 2025-05-14
1.13.0 2025-05-10
1.12.5 2025-05-29
1.12.4 2025-05-28
1.12.3 2025-05-15
1.12.1 2025-04-18
1.12.0 2025-04-13
1.11.0 2025-04-04
1.10.0 2025-03-31
1.9.1 2025-03-21
1.9.0 2025-03-11
1.8.9 2025-02-18
1.8.8 2025-02-06
1.8.7 2025-01-30
1.8.6 2025-01-30
1.8.5 2025-01-24
1.8.4 2025-01-22
1.8.3 2025-01-22
1.7.3 2025-01-21
1.7.2 2025-01-14
1.7.1 2024-12-25
1.7.0 2024-11-26
1.6.0 2024-11-05
1.5.2 2024-11-01
1.5.1 2024-10-29
1.5.0 2024-10-28
1.4.0 2024-10-04
1.4.1b0 2024-10-15
1.3.1b0 2024-10-03
1.3.0b0 2024-10-03
1.2.1 2024-10-01
1.2.0 2024-10-01
1.1.8 2024-09-26
1.1.7 2024-09-17
1.1.6 2024-09-17
1.1.5 2024-09-17
1.1.4 2024-09-14
1.1.3 2024-09-13
1.1.2 2024-09-13
1.1.1 2024-09-13
1.1.0 2024-09-07
1.0.18 2024-08-16
1.0.17 2024-07-29
1.0.16 2024-07-16
1.0.15 2024-07-16
1.0.14 2024-07-14
1.0.13 2024-07-08
1.0.12 2024-05-26
1.0.11 2024-05-24
1.0.10 2024-05-24
1.0.9 2024-03-12
1.0.8 2024-02-05
1.0.7 2024-01-25
1.0.6 2024-01-25
1.0.5 2024-01-25
1.0.2 2024-01-23
1.0.1 2024-01-23
1.0.0 2024-01-23
1.0.18b1 2024-08-28