Index of every page on this site: llms.txt
All skills
ejirocodes avatar

/exa-search

@6e805e4
Run it yourself

Exa.ai search API integration for neural and keyword web search with content retrieval. Use when implementing web search features, integrating Exa SDK (exa_py, exa-js), or retrieving web content. Triggers on: Exa, exa_py, exa-js, neural search, web search API, search_and_contents, searchAndContents, find_similar, findSimilar, domain filtering, date filtering, text extraction, page summaries, highlights, search auto mode, fast search, search categories, livecrawl, excluding domains, include text, exclude text, EXA_API_KEY.

Use this Skill: https://skilld.dev/gh/ejirocodes/agent-skills/exa-search

Nothing lands on disk. Nothing to clean up.

Fork this Skill

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

referencescontents.md

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

Contents Retrieval Reference

Table of Contents


Content Options Overview

When using search_and_contents() or searchAndContents(), specify what content to retrieve:

Option Type Description
text bool or object Full page text content
highlights bool or object Relevant snippets matching query
summary bool AI-generated page summary

Text Extraction

Basic Text Retrieval

results = exa.search_and_contents(
    "Python best practices",
    text=True,  # Returns full text
    num_results=5
)

for result in results.results:
    print(result.text)  # Full page content

Limit Text Length

# Limit to 1000 characters per result
results = exa.search_and_contents(
    "Python best practices",
    text={"max_characters": 1000},
    num_results=5
)
const results = await exa.searchAndContents("Python best practices", {
  text: { maxCharacters: 1000 },
  numResults: 5,
});

Text Format

Exa returns content in Markdown format by default, optimized for AI consumption.

# Result text is markdown-formatted
print(result.text)
# Output: "# Page Title\n\nParagraph content...\n\n## Section..."

Highlights

Highlights return the most relevant snippets from the page matching your query.

Basic Highlights

results = exa.search_and_contents(
    "React hooks tutorial",
    highlights=True,
    num_results=5
)

for result in results.results:
    for highlight in result.highlights:
        print(highlight)  # Relevant snippet

Highlight Options

results = exa.search_and_contents(
    "React hooks tutorial",
    highlights={
        "num_sentences": 3,  # Sentences per highlight
        "highlights_per_url": 3  # Max highlights per result
    },
    num_results=5
)
const results = await exa.searchAndContents("React hooks tutorial", {
  highlights: {
    numSentences: 3,
    highlightsPerUrl: 3,
  },
  numResults: 5,
});

When to Use Highlights

  • RAG applications needing relevant context
  • Search result previews
  • When full text is too large
  • Extracting key information quickly

Summaries

AI-generated summaries of page content.

Usage

results = exa.search_and_contents(
    "machine learning frameworks comparison",
    summary=True,
    num_results=5
)

for result in results.results:
    print(result.summary)  # AI-generated summary
const results = await exa.searchAndContents(
  "machine learning frameworks comparison",
  { summary: true, numResults: 5 }
);

Best Practices

  • Use for RAG when full context not needed
  • Combine with highlights for comprehensive context
  • More token-efficient than full text

Livecrawl Options

Control how Exa fetches fresh content.

Livecrawl Modes

Mode Description
never Only use cached content
fallback Use cache first, crawl if unavailable (default)
preferred Prefer fresh crawl, fall back to cache
always Always crawl fresh content

Usage

# Always get fresh content
results = exa.search_and_contents(
    "breaking tech news",
    livecrawl="always",
    text=True,
    num_results=5
)

# Prefer fresh but accept cached
results = exa.search_and_contents(
    "company updates",
    livecrawl="preferred",
    text=True,
    num_results=5
)
const results = await exa.searchAndContents("breaking tech news", {
  livecrawl: "always",
  text: true,
  numResults: 5,
});

When to Use Each Mode

  • never: Historical research, reproducible results
  • fallback: General use, balance of speed and freshness
  • preferred: News, rapidly changing content
  • always: Real-time monitoring, critical freshness

Contents Endpoint

Retrieve contents for known URLs without searching.

Usage

# Get contents for specific URLs
contents = exa.get_contents(
    urls=["https://example.com/article1", "https://example.com/article2"],
    text=True,
    summary=True
)

for content in contents.results:
    print(f"{content.title}: {content.summary}")
const contents = await exa.getContents(
  ["https://example.com/article1", "https://example.com/article2"],
  { text: true, summary: true }
);

Use Cases

  • Fetch content for URLs from other sources
  • Update cached content
  • Batch content retrieval

Response Status

Contents endpoint returns detailed status instead of HTTP errors:

for content in contents.results:
    if content.text:
        print(content.text)
    else:
        print(f"Status: {content.status_code}")  # e.g., 404, timeout

Combining Content Options

Full Context Retrieval

results = exa.search_and_contents(
    "GraphQL vs REST API comparison",
    text={"max_characters": 5000},
    highlights={"num_sentences": 2, "highlights_per_url": 3},
    summary=True,
    num_results=10
)

for result in results.results:
    print(f"Title: {result.title}")
    print(f"URL: {result.url}")
    print(f"Summary: {result.summary}")
    print("Highlights:")
    for h in result.highlights:
        print(f"  - {h}")
    print(f"Full text: {result.text[:500]}...")

Token-Efficient Retrieval

# For RAG with limited context window
results = exa.search_and_contents(
    "query",
    highlights={"num_sentences": 2, "highlights_per_url": 2},
    summary=True,
    # Skip full text to save tokens
    num_results=5
)

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 warning2mo5 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides safe and well-documented patterns for integrating the Exa.ai search API. It includes standard implementations for neural and keyword searches using official SDKs. The only identified concern is the inherent risk of indirect prompt injection common to all tools that fetch and process external web content.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: MEDIUM · 1 issue

  • Runlayer9mo

    1/5 files flagged

  • ZeroLeaks7mo

    1 finding · Score: 82/100

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

Last checked against GitHub 2 months ago.

Steadyupdated 10 months ago
metadata
{
  "author": "ejirocodes",
  "version": "1.0.0"
}

README badge

README badge for ejirocodes/agent-skills/exa-search