data
Exa AI Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Exa AI KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.exa.*.
Use lua_read_doc("integrations.exa") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
Exa AI workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.exa.search({query = "example_query", num_results = 1, use_autoprompt = true, type = "example_type", category = "example_category", start_published_date = "example_start_published_date", end_published_date = "example_end_published_date", include_domains = "example_include_domains"}))' --json kosmo integrations:lua --eval 'print(docs.read("exa"))' --json
kosmo integrations:lua --eval 'print(docs.read("exa.search"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local exa = app.integrations.exa
local result = exa.search({query = "example_query", num_results = 1, use_autoprompt = true, type = "example_type", category = "example_category", start_published_date = "example_start_published_date", end_published_date = "example_end_published_date", include_domains = "example_include_domains"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.exa, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.exa.default.* or app.integrations.exa.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Exa AI, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
Exa AI
Lua API reference for the exa integration package. Exa provides AI-oriented web search, clean content extraction, similar-link discovery, and grounded answers with citations.
The integration uses the official x-api-key header. Exa also accepts Authorization: Bearer, but this package uses x-api-key consistently.
Search
exa_search
Search the web with current Exa search types. Common types include auto, instant, fast, deep-lite, deep, and deep-reasoning; legacy keyword and neural are also accepted where supported.
local results = exa_search({
query = "Laravel queue monitoring best practices",
type = "auto",
num_results = 5,
})
Use domain and date filters when the source scope matters:
local docs = exa_search({
query = "OpenAI Responses API file search",
include_domains = { "platform.openai.com" },
start_published_date = "2026-01-01T00:00:00Z",
})
For research-like structured extraction, prefer /search with type = "deep-reasoning" and output_schema. Exa documents the older /research/v1 API as deprecated as of May 1, 2026.
local structured = exa_search({
query = "Compare the current pricing of three vector databases",
type = "deep-reasoning",
output_schema = {
type = "object",
properties = {
vendors = {
type = "array",
items = {
type = "object",
properties = {
name = { type = "string" },
pricingSummary = { type = "string" },
},
},
},
},
},
})
Search And Contents
exa_search_and_contents
Search and retrieve content in one call. The content options are sent in Exa’s current nested contents object.
local results = exa_search_and_contents({
query = "latest Typefully API v2 migration guide",
num_results = 3,
text = true,
highlights = {
query = "API v2 migration",
maxCharacters = 3000,
},
})
You can request summaries instead of full text:
local summarized = exa_search_and_contents({
query = "recent Exa Search API changes",
type = "fast",
summary = {
query = "Summarize the API changes for developers.",
},
})
Answer
exa_answer
Generate a grounded answer to a question. Exa returns an answer string and may include citations and cost metadata.
local answer = exa_answer({
query = "What is the latest documented status of Exa research API deprecation?",
text = true,
})
print(answer.answer)
Contents
exa_get_contents
Retrieve clean page contents, highlights, summaries, and metadata for URLs or Exa document IDs. The current Exa Contents API is URL-first, while ids remains supported for search result IDs.
local contents = exa_get_contents({
urls = { "https://example.test/article" },
text = true,
summary = {
query = "Summarize this page for an engineering agent.",
},
})
Use cache freshness and subpage options when crawling site sections:
local crawl = exa_get_contents({
urls = { "https://example.test/docs" },
text = true,
max_age_hours = 24,
subpages = 2,
subpage_target = "api reference",
})
Similar Links
exa_find_similar
Find pages similar to a given URL.
local similar = exa_find_similar({
url = "https://example.test/product",
num_results = 10,
exclude_source_domain = true,
})
User
exa_get_current_user
local user = exa_get_current_user()
print(user.email)
Return Shapes
Search, contents, similar-link, and answer tools return the raw Exa JSON shape. Common fields include requestId, results, answer, citations, statuses, and costDollars.
Multi-Account Usage
Use the namespace prefix assigned by the host:
local results = ns_exa_work.exa_search({
query = "company research",
type = "fast",
})Raw agent markdown
# Exa AI
Lua API reference for the `exa` integration package. Exa provides AI-oriented web search, clean content extraction, similar-link discovery, and grounded answers with citations.
The integration uses the official `x-api-key` header. Exa also accepts `Authorization: Bearer`, but this package uses `x-api-key` consistently.
## Search
### `exa_search`
Search the web with current Exa search types. Common types include `auto`, `instant`, `fast`, `deep-lite`, `deep`, and `deep-reasoning`; legacy `keyword` and `neural` are also accepted where supported.
```lua
local results = exa_search({
query = "Laravel queue monitoring best practices",
type = "auto",
num_results = 5,
})
```
Use domain and date filters when the source scope matters:
```lua
local docs = exa_search({
query = "OpenAI Responses API file search",
include_domains = { "platform.openai.com" },
start_published_date = "2026-01-01T00:00:00Z",
})
```
For research-like structured extraction, prefer `/search` with `type = "deep-reasoning"` and `output_schema`. Exa documents the older `/research/v1` API as deprecated as of May 1, 2026.
```lua
local structured = exa_search({
query = "Compare the current pricing of three vector databases",
type = "deep-reasoning",
output_schema = {
type = "object",
properties = {
vendors = {
type = "array",
items = {
type = "object",
properties = {
name = { type = "string" },
pricingSummary = { type = "string" },
},
},
},
},
},
})
```
## Search And Contents
### `exa_search_and_contents`
Search and retrieve content in one call. The content options are sent in Exa's current nested `contents` object.
```lua
local results = exa_search_and_contents({
query = "latest Typefully API v2 migration guide",
num_results = 3,
text = true,
highlights = {
query = "API v2 migration",
maxCharacters = 3000,
},
})
```
You can request summaries instead of full text:
```lua
local summarized = exa_search_and_contents({
query = "recent Exa Search API changes",
type = "fast",
summary = {
query = "Summarize the API changes for developers.",
},
})
```
## Answer
### `exa_answer`
Generate a grounded answer to a question. Exa returns an `answer` string and may include citations and cost metadata.
```lua
local answer = exa_answer({
query = "What is the latest documented status of Exa research API deprecation?",
text = true,
})
print(answer.answer)
```
## Contents
### `exa_get_contents`
Retrieve clean page contents, highlights, summaries, and metadata for URLs or Exa document IDs. The current Exa Contents API is URL-first, while `ids` remains supported for search result IDs.
```lua
local contents = exa_get_contents({
urls = { "https://example.test/article" },
text = true,
summary = {
query = "Summarize this page for an engineering agent.",
},
})
```
Use cache freshness and subpage options when crawling site sections:
```lua
local crawl = exa_get_contents({
urls = { "https://example.test/docs" },
text = true,
max_age_hours = 24,
subpages = 2,
subpage_target = "api reference",
})
```
## Similar Links
### `exa_find_similar`
Find pages similar to a given URL.
```lua
local similar = exa_find_similar({
url = "https://example.test/product",
num_results = 10,
exclude_source_domain = true,
})
```
## User
### `exa_get_current_user`
```lua
local user = exa_get_current_user()
print(user.email)
```
## Return Shapes
Search, contents, similar-link, and answer tools return the raw Exa JSON shape. Common fields include `requestId`, `results`, `answer`, `citations`, `statuses`, and `costDollars`.
## Multi-Account Usage
Use the namespace prefix assigned by the host:
```lua
local results = ns_exa_work.exa_search({
query = "company research",
type = "fast",
})
``` local result = app.integrations.exa.search({query = "example_query", num_results = 1, use_autoprompt = true, type = "example_type", category = "example_category", start_published_date = "example_start_published_date", end_published_date = "example_end_published_date", include_domains = "example_include_domains"})
print(result) Functions
search Read
Perform a neural search query across the web using Exa AI. Returns a list of relevant pages with titles, URLs, and scores. Supports filtering by category, date range, and autoprompt mode.
- Lua path
app.integrations.exa.search- Full name
exa.exa_search
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | Natural language search query. Describe the type of content you want to find. |
num_results | integer | no | Number of results to return (default: 10, max: 100). |
use_autoprompt | boolean | no | Let Exa automatically optimize your query for better results (default: true). |
type | string | no | Search type. Current options include auto, instant, fast, deep-lite, deep, deep-reasoning, keyword, and neural. |
category | string | no | Filter results to a specific category of content. |
start_published_date | string | no | Only return results published after this date (ISO 8601, e.g., "2024-01-01T00:00:00Z"). |
end_published_date | string | no | Only return results published before this date (ISO 8601). |
include_domains | array | no | Domains to include. |
exclude_domains | array | no | Domains to exclude. |
output_schema | object | no | Optional JSON schema for structured output with deep search types. |
search_and_contents Read
Search the web and retrieve full page contents in one call. Combines search and content retrieval into a single request for efficiency. Returns results with both metadata and full text content.
- Lua path
app.integrations.exa.search_and_contents- Full name
exa.exa_search_and_contents
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | Natural language search query. |
num_results | integer | no | Number of results to return (default: 10, max: 100). |
use_autoprompt | boolean | no | Let Exa automatically optimize your query (default: true). |
type | string | no | Search type. Current options include auto, instant, fast, deep-lite, deep, deep-reasoning, keyword, and neural. |
category | string | no | Filter results to a specific category of content. |
start_published_date | string | no | Only return results published after this date (ISO 8601, e.g., "2024-01-01T00:00:00Z"). |
text | boolean | no | Include full page text in the response (default: true). |
highlights | object | no | Highlight configuration for extracting key passages. |
summary | object | no | Summary configuration for LLM-generated summaries. |
max_age_hours | integer | no | Maximum cached content age in hours for returned contents. |
output_schema | object | no | Optional JSON schema for structured output with deep search types. |
answer Read
Get a grounded answer to a question using Exa search results, including citations when returned by Exa.
- Lua path
app.integrations.exa.answer- Full name
exa.exa_answer
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | Question or query to answer. |
text | boolean | no | Include full text content in search results used for the answer. |
stream | boolean | no | Whether to request streaming. Hosts usually should leave this false because tools return JSON. |
find_similar Read
Find web pages similar to a given URL. Useful for discovering related content, competitors, or alternative resources. Returns a list of similar pages with titles, URLs, and scores.
- Lua path
app.integrations.exa.find_similar- Full name
exa.exa_find_similar
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | yes | The URL to find similar pages for (e.g., "https://example.com/article"). |
num_results | integer | no | Number of similar pages to return (default: 10, max: 100). |
exclude_source_domain | boolean | no | Exclude results from the same domain as the source URL. |
include_domains | array | no | Domains to include. |
exclude_domains | array | no | Domains to exclude. |
get_contents Read
Retrieve full page contents, summaries, highlights, and metadata for URLs or Exa document IDs.
- Lua path
app.integrations.exa.get_contents- Full name
exa.exa_get_contents
| Parameter | Type | Required | Description |
|---|---|---|---|
urls | array | no | List of URLs to retrieve contents for. Preferred for the current Exa Contents API. |
ids | array | no | List of Exa document IDs from search results. Backward-compatible alternative to urls. |
text | boolean | no | Include full page text in the response (default: true). |
highlights | object | no | Highlight configuration for extracting key passages from the content. |
summary | object | no | Summary configuration for LLM-generated page summaries. |
livecrawl | string | no | Deprecated livecrawl preference. Prefer max_age_hours when possible. |
max_age_hours | integer | no | Maximum cached content age in hours. 0 always livecrawls; -1 always uses cache. |
subpages | integer | no | Number of linked subpages to crawl. |
subpage_target | string | no | Term used to target specific subpages. |
get_current_user Read
Get the currently authenticated Exa user's profile information, including email and API usage details. Useful for verifying credentials.
- Lua path
app.integrations.exa.get_current_user- Full name
exa.exa_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||