Use for creating websets, running searches, importing CSV data, managing items, and adding enrichments to extract structured data.
Comprehensive webset management including creation, search, imports, items, and enrichments.
Use --help to see available commands and verify usage before running:
exa-ai <command> --help
When using the Bash tool with complex shell syntax, follow these best practices for reliability:
jq to parse output in a follow-up command if needed$(...) can be fragile; break into sequential stepsExample:
# Less reliable: nested command substitution
webset_id=$(exa-ai webset-create --search '{"query":"tech startups","count":1}' | jq -r '.webset_id')
# More reliable: run directly, then parse
exa-ai webset-create --search '{"query":"tech startups","count":1}'
# Then in a follow-up command if needed:
webset_id=$(cat output.json | jq -r '.webset_id')
Universal rules across all operations:
--wait flag in commands. It's designed for human interactive use, not automated workflows.Pricing: $50/month = 8,000 credits ($0.00625 per credit)
Cost per operation:
Why start with count:1: Testing with 1 result costs 10 credits ($0.0625). A failed search with count:100 wastes 1,000 credits ($6.25) - 100x more expensive.
Why enrich last: Enriching bad results wastes credits. Always validate first, expand second, enrich last.
exa-ai --help
All exa-ai webset commands support output formats:
jq to extract specific fields (e.g., | jq -r '.webset_id')Core operations for managing webset collections.
company: Companies and organizationsperson: Individual peoplearticle: News articles and blog postsresearch_paper: Academic paperscustom: Custom entity types (define with --entity-description)webset_id=$(exa-ai webset-create \
--search '{"query":"AI startups in San Francisco","count":1}' | jq -r '.webset_id')
exa-ai webset-create \
--search '{
"query": "Technology companies focused on developer tools",
"count": 1,
"entity": {
"type": "company"
},
"criteria": [
{
"description": "Companies with 50-500 employees indicating growth stage"
},
{
"description": "Primary product is developer tools, APIs, or infrastructure"
}
]
}'
exa-ai webset-create \
--search '{
"query": "Nonprofits focused on economic justice",
"count": 1,
"entity": {
"type": "custom",
"description": "nonprofit"
},
"criteria": [
{
"description": "Primary focus on economic justice"
},
{
"description": "Annual operating budget between $1M and $10M"
}
]
}'
import_id=$(exa-ai import-create companies.csv \
--count 100 \
--title "Companies" \
--format csv \
--entity-type company | jq -r '.import_id')
exa-ai webset-create --import $import_id
webset_id=$(exa-ai webset-create \
--search '{"query":"tech startups","count":1}' | jq -r '.webset_id')
exa-ai webset-item-list $webset_id
β οΈ REQUIRED: Manually verify the result is relevant before continuing. If not, adjust the query and start over.
# Expand to 2 results (use same query and criteria from validation)
exa-ai webset-search-create $webset_id \
--query "tech startups" \
--behavior override \
--count 2
exa-ai webset-item-list $webset_id
β οΈ REQUIRED: Check quality at this scale. Repeat with larger counts (5, 10, 25, 50, 100) until you reach your target.
Loop this step: Keep expanding gradually (2 β 5 β 10 β 25 β 50 β 100) with verification between each expansion.
exa-ai enrichment-create $webset_id \
--description "Company website" --format url --title "Website"
exa-ai enrichment-create $webset_id \
--description "Employee count" --format text --title "Team Size"
CRITICAL: Criteria are evaluated conditionally - when one criterion fails, others may not run. A low success rate doesn't indicate that criterion is restrictive; it means OTHER criteria are filtering results first. Only interpret a low success rate as "restrictive" when OTHER criteria have high success rates (>80%).
exa-ai webset-list
exa-ai webset-get ws_abc123
exa-ai webset-update ws_abc123 --metadata '{"status":"active","owner":"team"}'
exa-ai webset-delete ws_abc123
Run searches within a webset to add new items.
Control how new search results are combined with existing items:
append (default): Add new items to existing collection
--behavior is omittedoverride: Replace entire collection with search results
CRITICAL - First search requirement: The first webset-search-create on a webset MUST explicitly use --behavior override. Since the default is append, omitting --behavior will fail with "No previous search found" error. Subsequent searches can omit the flag (defaults to append).
CRITICAL: When appending or scaling up searches, maintain IDENTICAL query and criteria from your validated search.
Using different criteria causes Exa to generate new search parameters on-the-fly, which:
# Step 1: Test search with criteria (MUST use override for first search)
exa-ai webset-search-create ws_abc123 \
--query "Progressive nonprofits in California" \
--behavior override \
--count 1 \
--criteria '[
{"description": "Annual budget between $1M and $10M"},
{"description": "Primary focus on economic justice, affordability, living wages, or worker power"},
{"description": "Established communications, narrative strategy, or messaging function"}
]'
# Verify quality, then append MORE results with IDENTICAL query and criteria
exa-ai webset-search-create ws_abc123 \
--query "Progressive nonprofits in California" \
--behavior append \
--count 5 \
--criteria '[
{"description": "Annual budget between $1M and $10M"},
{"description": "Primary focus on economic justice, affordability, living wages, or worker power"},
{"description": "Established communications, narrative strategy, or messaging function"}
]'
# Create criteria file once
cat > criteria.json <<'EOF'
[
{"description": "Annual budget between $1M and $10M"},
{"description": "Primary focus on economic justice, affordability, living wages, or worker power"},
{"description": "Established communications, narrative strategy, or messaging function"}
]
EOF
# Use consistently across all searches (first search needs override)
exa-ai webset-search-create ws_abc123 \
--query "Progressive nonprofits in California" \
--behavior override \
--count 1 \
--criteria @criteria.json
exa-ai webset-search-create ws_abc123 \
--query "Progressive nonprofits in California" \
--behavior append \
--count 5 \
--criteria @criteria.json
# First search on webset (must use override)
exa-ai webset-search-create ws_abc123 \
--query "AI startups in San Francisco" \
--behavior override \
--count 1
# Append to collection
exa-ai webset-search-create ws_abc123 \
--query "SaaS companies Series B" \
--behavior append \
--count 1
# Override collection
exa-ai webset-search-create ws_abc123 \
--query "top tech companies" \
--behavior override \
--count 1
webset_id="ws_abc123"
search_id=$(exa-ai webset-search-create $webset_id \
--query "fintech startups" \
--behavior override \
--count 1 | jq -r '.search_id')
exa-ai webset-search-get $webset_id $search_id
exa-ai webset-search-cancel $webset_id $search_id
Upload CSV files to create websets from existing datasets.
# Create import
import_id=$(exa-ai import-create companies.csv \
--count 100 \
--title "Tech Companies" \
--format csv \
--entity-type company | jq -r '.import_id')
# Create webset from import
webset_id=$(exa-ai webset-create --import $import_id | jq -r '.webset_id')
exa-ai import-create products.csv \
--count 5 \
--title "Product List" \
--format csv \
--entity-type custom \
--entity-description "Consumer electronics products"
exa-ai import-list
exa-ai import-get imp_abc123
--import loads data for enrichment. search.scope filters searches to specific sources.
β οΈ NEVER use same ID in both - returns 400:
# β INVALID
exa-ai webset-create --import import_abc \
--search '{"scope":[{"source":"import","id":"import_abc"}]}'
# β
Scoped search only
exa-ai webset-create \
--search '{"query":"CEOs","scope":[{"source":"import","id":"import_abc"}]}'
# β
Relationship traversal
exa-ai webset-search-create ws_abc --query "investors" --behavior override \
--scope '[{"source":"webset","id":"webset_abc","relationship":{"definition":"investors of","limit":5}}]'
Manage individual items in websets.
# List items
exa-ai webset-item-list ws_abc123
exa-ai webset-item-list ws_abc123 --output-format pretty
# Get item details
exa-ai webset-item-get item_xyz789
# Delete item
exa-ai webset-item-delete item_xyz789
# Get all item IDs
exa-ai webset-item-list ws_abc123 --output-format json | jq -r '.[].id'
# Count items
exa-ai webset-item-list ws_abc123 --output-format json | jq 'length'
Add structured data fields to all items in a webset using AI extraction.
exa-ai enrichment-create --help and exa-ai enrichment-update --help to see all available parameters# Text enrichment
exa-ai enrichment-create ws_abc123 \
--description "Number of employees as of latest data" \
--format text \
--title "Team Size"
# URL enrichment
exa-ai enrichment-create ws_abc123 \
--description "Primary company website URL" \
--format url \
--title "Website"
# Options enrichment
exa-ai enrichment-create ws_abc123 \
--description "Current funding stage" \
--format options \
--options '[
{"label":"Pre-seed"},
{"label":"Seed"},
{"label":"Series A"},
{"label":"Series B"},
{"label":"Series C+"},
{"label":"Public"}
]' \
--title "Funding Stage"
cat > industries.json <<'EOF'
[
{"label": "SaaS"},
{"label": "Developer Tools"},
{"label": "AI/ML"},
{"label": "Fintech"},
{"label": "Healthcare"},
{"label": "Other"}
]
EOF
exa-ai enrichment-create ws_abc123 \
--description "Primary industry or sector" \
--format options \
--options @industries.json \
--title "Industry"
exa-ai enrichment-create ws_abc123 \
--description "Technology stack" \
--format text \
--instructions "Focus only on backend technologies and databases. Ignore frontend frameworks." \
--title "Backend Tech"
# List enrichments
exa-ai enrichment-list ws_abc123
exa-ai enrichment-list ws_abc123 --output-format pretty
# Get details
exa-ai enrichment-get ws_abc123 enr_xyz789
# Update extraction prompt (description)
exa-ai enrichment-update ws_abc123 enr_xyz789 \
--description "Exact employee count from most recent source"
# Update format and options
exa-ai enrichment-update ws_abc123 enr_xyz789 \
--format options \
--options '[{"label":"Small"},{"label":"Medium"},{"label":"Large"}]'
# Update metadata
exa-ai enrichment-update ws_abc123 enr_xyz789 \
--metadata '{"source":"manual","updated":"2024-01-15"}'
# Note: Cannot update --instructions or --title (creation-only parameters)
# To change instructions, delete and recreate the enrichment
# Delete
exa-ai enrichment-delete ws_abc123 enr_xyz789
# Cancel running enrichment
exa-ai enrichment-cancel ws_abc123 enr_xyz789
Company websets: Website (url), Team Size (text), Funding Stage (options), Industry (options)
Person websets: LinkedIn (url), Job Title (text), Company (text), Location (text)
Research papers: Publication Year (text), Authors (text), Venue (text), Research Area (options)
--wait in commands. It's designed for human interactive use, not automated workflows.--behavior append. First search on a webset MUST explicitly use --behavior override or it will fail with "No previous search found" error.--behavior append or --behavior override (NOT --mode)webset-search-get require both webset_id and search_idjq to extract and save IDs for subsequent commandsFor complete command references, syntax, and all options, consult REFERENCE.md and component-specific reference files.
Applies to: answer, search, find-similar, get-contents
When using schema parameters (--output-schema or --summary-schema), always wrap properties in an object:
{"type":"object","properties":{"field_name":{"type":"string"}}}
DO NOT use bare properties without the object wrapper:
{"properties":{"field_name":{"type":"string"}}} // β Missing "type":"object"
Why: The Exa API requires a valid JSON Schema with an object type at the root level. Omitting this causes validation errors.
Examples:
# β
CORRECT - object wrapper included
exa-ai search "AI news" \
--summary-schema '{"type":"object","properties":{"headline":{"type":"string"}}}'
# β WRONG - missing object wrapper
exa-ai search "AI news" \
--summary-schema '{"properties":{"headline":{"type":"string"}}}'
Applies to: answer, context, search, find-similar, get-contents
toon format produces YAML-like output, not JSON. DO NOT pipe toon output to jq for parsing:
# β WRONG - toon is not JSON
exa-ai search "query" --output-format toon | jq -r '.results'
# β
CORRECT - use JSON (default) with jq
exa-ai search "query" | jq -r '.results[].title'
# β
CORRECT - use toon for direct reading only
exa-ai search "query" --output-format toon
Why: jq expects valid JSON input. toon format is designed for human readability and produces YAML-like output that jq cannot parse.
Applies to: answer, context, search, find-similar, get-contents
Pick one strategy and stick with it throughout your workflow:
Approach 1: toon only - Compact YAML-like output for direct reading
exa-ai search "query" --output-format toonApproach 2: JSON + jq - Extract specific fields programmatically
exa-ai search "query" | jq -r '.results[].title'Approach 3: Schemas + jq - Structured data extraction with validation
exa-ai search "query" --summary-schema '{...}' | jq -r '.results[].summary | fromjson'Why: Mixing approaches increases complexity and token usage. Choosing one approach optimizes for your use case.
Applies to: monitor, search (websets), research, and all skills using complex commands
When using the Bash tool with complex shell syntax, run commands directly and parse output in separate steps:
# β WRONG - nested command substitution
webset_id=$(exa-ai webset-create --search '{"query":"..."}' | jq -r '.webset_id')
# β
CORRECT - run directly, then parse
exa-ai webset-create --search '{"query":"..."}'
# Then in a follow-up command:
webset_id=$(cat output.json | jq -r '.webset_id')
Why: Complex nested $(...) command substitutions can fail unpredictably in shell environments. Running commands directly and parsing separately improves reliability and makes debugging easier.
Applies to: All skills when using complex multi-step operations
Avoid nesting multiple levels of command substitution:
# β WRONG - deeply nested
result=$(exa-ai search "$(cat query.txt | tr '\n' ' ')" --num-results $(cat config.json | jq -r '.count'))
# β
CORRECT - sequential steps
query=$(cat query.txt | tr '\n' ' ')
count=$(cat config.json | jq -r '.count')
exa-ai search "$query" --num-results $count
Why: Nested command substitutions are fragile and hard to debug when they fail. Sequential steps make each operation explicit and easier to troubleshoot.
Applies to: All skills when working with multi-step workflows
For readability and reliability, break complex operations into clear sequential steps:
# β Less maintainable - everything in one line
exa-ai webset-create --search '{"query":"startups","count":1}' | jq -r '.webset_id' | xargs -I {} exa-ai webset-search-create {} --query "AI" --behavior override
# β
More maintainable - clear steps
exa-ai webset-create --search '{"query":"startups","count":1}'
webset_id=$(jq -r '.webset_id' < output.json)
exa-ai webset-search-create $webset_id --query "AI" --behavior override
Why: Sequential steps are easier to understand, debug, and modify. Each step can be verified independently.