Exa Dspy banner
exa-labs exa-labs

Exa Dspy

Development community

Description

Exa tools for DSPy - web search and content fetching for ReAct agents

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

exa-dspy

Exa tools for [DSPy](https://dspy.ai) — web search and content fetching for ReAct agents.

Installation

pip install exa-dspy

Quick Start

import dspy
from exa_dspy import ExaSearchTool, ExaContentsTool

# Configure your LM
lm = dspy.LM("openai/gpt-4o-mini")
dspy.configure(lm=lm)

# Create tools (uses EXA_API_KEY env var by default)
search = ExaSearchTool(num_results=5)
contents = ExaContentsTool()

# Use in a ReAct agent
agent = dspy.ReAct("question -> answer", tools=[search, contents])
result = agent(question="What are the latest developments in quantum computing?")
print(result.answer)

Tools

ExaSearchTool

Search the web using Exa's neural/keyword search.

search = ExaSearchTool(
    num_results=5,           # number of results to return
    search_type="auto",      # "auto", "neural", "keyword"
    include_domains=None,    # restrict to specific domains
    exclude_domains=None,    # exclude specific domains
    start_published_date=None,  # ISO date filter
    end_published_date=None,
    category=None,           # "news", "company", "research paper", etc.
    livecrawl=None,          # "always", "fallback", "never"
    summary=False,           # include AI summaries
    highlights=False,        # include key highlights
    max_chars_per_result=1000,
)

ExaContentsTool

Fetch and extract clean text content from URLs.

contents = ExaContentsTool(
    max_characters=5000,     # max chars per page
    summary=False,           # include AI summary
    highlights=False,        # include key highlights
    livecrawl=None,          # "always", "fallback", "never"
)

ExaFindSimilarTool

Find pages similar to a given URL.

from exa_dspy import ExaFindSimilarTool

similar = ExaFindSimilarTool(
    num_results=5,
    exclude_source_domain=False,
)

Authentication

Set your Exa API key via environment variable:

export EXA_API_KEY="your-api-key"

Or pass i