Index of every page on this site: llms.txt
All skills
exa-labs avatar

/build-with-exa

@9d220cc
by Exa Labsexa-labs/agent-skills75 stars
8
Run it yourself

Build applications and agents with Exa's API: search, contents extraction, answer, Agent API, monitors, websets, OpenAI-compatible endpoints, and exa-py/exa-js SDKs. Use when choosing Exa endpoints, writing Exa API calls, integrating semantic web search or research into products, or debugging Exa request shapes.

Use this Skill: https://skilld.dev/gh/exa-labs/agent-skills/build-with-exa

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesanswer.md

≈892 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Answer Endpoint Reference

Grounded answer generation surface via POST /answer.

Canonical Docs Links

  • Base docs URL: https://exa.ai/docs
  • Answer reference: /reference/answer
  • OpenAI-compatible guide: /integrations/openai-sdk

Contents

  • Overview
  • Request shape
  • When to prefer /answer
  • Structured output
  • Streaming
  • Response shape
  • Critical pitfalls

Overview

Use the answer endpoint when you want Exa to:

  • run the retrieval step
  • generate a direct answer or concise summary
  • attach citations in one API response

This is the best fit when the application wants a grounded answer, not just ranked results.

Request Shape

The recommended request is the query alone:

POST https://api.exa.ai/answer
{
  "query": "What is the latest valuation of SpaceX?"
}

Core Parameters

Everything beyond query requires an explicit task justification.

Parameter Type Notes
query string Required
stream boolean Enables SSE token streaming
text boolean Include full text in cited source objects; adds payload size, so only when the task needs source text
outputSchema object JSON Schema for structured answers
systemPrompt string Guide answer behavior
userLocation string Two-letter ISO country code

When To Prefer /answer

If the product already has a chat LLM, do not use /answer. Give that LLM /search as a tool instead (contents: { highlights: true }) so it owns generation and conversation context.

Use the answer endpoint when:

  • you need a grounded answer with citations and Exa should do the generation
  • you do not need to manually inspect or rank raw results first
  • the app interface is question-driven rather than retrieval-driven

Prefer the search endpoint when:

  • the product already has a chat LLM (expose /search as a tool)
  • your application needs the result list itself
  • you want explicit control over contents modes on each result
  • you want deeper synthesized search flows via deep-lite or deep

Structured Output

from exa_py import Exa

exa = Exa(api_key="YOUR_EXA_API_KEY")
response = exa.answer(
    "What is the latest valuation of SpaceX?",
    output_schema={
        "type": "object",
        "properties": {
            "valuation": {"type": "string"},
            "date": {"type": "string"}
        },
        "required": ["valuation", "date"]
    }
)
print(response.answer)

Use small, explicit schemas. The answer endpoint is good for question-shaped structured output, while the search endpoint is often the better fit for broader synthesized retrieval.

Streaming

When stream: true, the answer endpoint returns server-sent events. In SDKs, use the dedicated streaming helpers instead of passing stream=True into ordinary non-streaming helper calls.

TypeScript:

for await (const chunk of exa.streamAnswer("Explain quantum computing")) {
  if (chunk.content) {
    process.stdout.write(chunk.content);
  }
}

Response Shape

Typical non-streaming response fields:

  • answer
  • citations
  • requestId
  • costDollars

Each citation object may include URL, title, author, published date, and optionally text if requested.

Critical Pitfalls

  1. Use the answer endpoint for answer-shaped output, not as a substitute for full search result inspection.
  2. If you need rich per-result extraction controls, prefer the search endpoint.
  3. For SDK streaming, prefer stream_answer or streamAnswer helpers over ad hoc raw flags.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning2d3 checks · Risk SAFE
  • Gen Agent Trust Hub3d

    The skill provides official documentation and SDK guidance for the Exa API. It includes instructions for installing and using official Python and TypeScript libraries and provides best practices for semantic search and AI research workflows.

  • Socket2d

    No alerts

  • Snyk3d

    Risk: MEDIUM · 1 issue

Signed by skilld at 9d220cc. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 5 days ago
metadata
{
  "author": "Exa",
  "version": "0.3.0",
  "docs": "https://exa.ai/docs"
}

README badge

README badge for exa-labs/agent-skills/build-with-exa