$npx -y skills add MoizIbnYousaf/marketing-cli --skill build-with-exaBuild applications and agents with Exa's API Platform: search, contents, answer, context, Agent API, monitors, websets, OpenAI-compatible endpoints, and exa-py / exa-js. Use when choosing Exa endpoints, writing Exa API calls, integrating semantic web search or research into produ
| 1 | ## On Activation |
| 2 | |
| 3 | 1. Confirm `EXA_API_KEY` is available for any live API call. SDK examples assume the key is set. |
| 4 | 2. Default new integrations to `POST /search` with `type: "auto"` and `contents.highlights: true`. Escalate to Agent API only for multi-step research / list-building. |
| 5 | 3. Load only the `references/*.md` file needed for the current endpoint - do not dump the whole tree into context. |
| 6 | 4. For agent-native marketing research inside mktg projects, prefer `exa-search`, `company-research`, or `lead-generation` over inventing a custom integration. |
| 7 | |
| 8 | # Build with Exa |
| 9 | |
| 10 | ## Scope |
| 11 | |
| 12 | Included by default: |
| 13 | |
| 14 | - Core retrieval APIs: search endpoint, contents endpoint, answer endpoint, context endpoint |
| 15 | - Long-running research workflows: Agent API (`/agent`) |
| 16 | - Async and recurring workflows: Monitors API, Websets API |
| 17 | - SDK guidance: Python `exa-py`, TypeScript `exa-js` |
| 18 | |
| 19 | > Note on data retention: `/search`, `/answer`, and deep research are Zero Data Retention (ZDR). The Agent API (`/agent`), Websets, and Monitors are not ZDR. If a use case requires ZDR, stay on the ZDR surfaces or contact Exa. |
| 20 | |
| 21 | ## Installation |
| 22 | |
| 23 | ```bash |
| 24 | # Python |
| 25 | pip install exa-py |
| 26 | |
| 27 | # TypeScript / JavaScript |
| 28 | npm install exa-js |
| 29 | ``` |
| 30 | |
| 31 | ## Authentication |
| 32 | |
| 33 | ```bash |
| 34 | export EXA_API_KEY="your_api_key_here" |
| 35 | ``` |
| 36 | |
| 37 | Exa accepts either the `x-api-key` header or `Authorization: Bearer <key>`. |
| 38 | |
| 39 | ## API Decision Workflow |
| 40 | |
| 41 | Before picking an endpoint, decide which workflow shape fits: |
| 42 | |
| 43 | - Raw web content for your own LLM or agent: start with `/search` using `type: "auto"` and `contents: { highlights: true }` |
| 44 | - Synthesized structured output: start with `/search` using the search type that fits your latency and reasoning needs, then add `outputSchema` and `systemPrompt` |
| 45 | - Long-running multi-step research, list-building, or enrichment with structured output: use the Agent API (`/agent`) |
| 46 | |
| 47 | **Default to the search endpoint.** Use the search endpoint (`/search`) for most new integrations, then move to a more specialized Exa surface only when the task shape clearly calls for it. |
| 48 | |
| 49 | 1. Need general semantic web retrieval, synthesized output, filters, or content extraction from search results: use the search endpoint (`/search`) |
| 50 | 2. Already know the URLs and need clean page extraction or freshness controls: use the contents endpoint (`/contents`) |
| 51 | 3. Need pages related to a known seed URL: use the search endpoint (`/search`) with a query derived from the page (for example title, topic, or text from `/contents`) |
| 52 | 4. Need a grounded answer with citations from Exa-managed search: use the answer endpoint (`/answer`) |
| 53 | 5. Need code-focused retrieval from repos, docs, and Stack Overflow: use the context endpoint (`/context`) |
| 54 | 6. Need OpenAI SDK drop-in compatibility for chat or responses clients: use the OpenAI-compatible endpoints (`/chat/completions`, `/responses`) |
| 55 | 7. Need asynchronous multi-step research, list-building, enrichment, or follow-up questions over prior research: use the Agent API (`/agent`) |
| 56 | 8. Need scheduled recurring search with webhook delivery: use the Monitors API (`/monitors`) |
| 57 | 9. Need async verified and enriched entity collection workflows: use the Websets API (`/websets/v0`) |
| 58 | |
| 59 | ## Quick Start |
| 60 | |
| 61 | For more complete examples, see the relevant reference file in the table below. |
| 62 | |
| 63 | **Python** (`/search`): |
| 64 | |
| 65 | ```python |
| 66 | from exa_py import Exa |
| 67 | |
| 68 | exa = Exa(api_key="YOUR_EXA_API_KEY") |
| 69 | result = exa.search( |
| 70 | "latest developments in LLMs", |
| 71 | type="auto", |
| 72 | contents={"highlights": True} |
| 73 | ) |
| 74 | |
| 75 | for item in result.results: |
| 76 | print(item.title, item.url) |
| 77 | ``` |
| 78 | |
| 79 | **TypeScript** (`/search`): |
| 80 | |
| 81 | ```typescript |
| 82 | import Exa from "exa-js"; |
| 83 | |
| 84 | const exa = new Exa(); |
| 85 | const result = await exa.search("latest developments in LLMs", { |
| 86 | type: "auto", |
| 87 | contents: { highlights: true } |
| 88 | }); |
| 89 | |
| 90 | for (const item of result.results) { |
| 91 | console.log(item.title, item.url); |
| 92 | } |
| 93 | ``` |
| 94 | |
| 95 | **Raw HTTP** (`/search`): |
| 96 | |
| 97 | ```bash |
| 98 | curl -X POST "https://api.exa.ai/search" \ |
| 99 | -H "Content-Type: application/json" \ |
| 100 | -H "x-api-key: $EXA_API_KEY" \ |
| 101 | -d '{ |
| 102 | "query": "latest developments in LLMs", |
| 103 | "type": "auto", |
| 104 | "contents": { |
| 105 | "highlights": true |
| 106 | } |
| 107 | }' |
| 108 | ``` |
| 109 | |
| 110 | ## Anti-Patterns |
| 111 | - On the search endpoint, `text`, `highlights`, and `summary` belong inside `contents`, not at the top level. |
| 112 | - On the contents endpoint, `text`, `highlights`, and `summary` are top-level fields, not nested inside `contents`. |
| 113 | - Pick one of `highlights`, `text`, or `summary` b |