Skip to main content
skill CX Codex

exa-rag — Claude Code skill for Exa RAG: features and setup

exa-rag is a Claude Code skill that connects Exa web search to RAG workflows and AI agents. It adds fresh web results and source links to generated answers.

MIT 251 installs ★ 6 updated 2026-06-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ejirocodes/agent-skills --skill exa-rag -a claude-code
Open on GitHub

What exa-rag does

This skill walks through using Exa to retrieve web pages and feed their content into generated responses. It covers integrations with LangChain, LlamaIndex, and Vercel AI SDK, plus MCP, tool calling, and an OpenAI-compatible API.

The LangChain example uses ExaSearchRetriever; the LlamaIndex path uses ExaReader. For Vercel AI SDK, Exa search is wired in as a tool. The guidance also covers domain and date filters, shorter excerpts in place of full page text, and citing source URLs. An Exa API key is required for the examples to query the service. Pick the integration that matches your project's stack.

What it helps with

  • add Exa web retrieval to a LangChain RAG chain
  • load Exa search results into LlamaIndex
  • wire web search into a Vercel AI SDK app
  • give an agent Exa search through MCP or tool calling
  • cite source URLs in generated answers

Example prompts for the agent

  • Set up Exa retrieval for my LangChain RAG chain and return relevant excerpts.
  • Show me how to load Exa results into LlamaIndex with ExaReader.
  • Add Exa search as a tool in this Vercel AI SDK app.

How to install exa-rag

1Skills CLI (Vercel)

npx skills add ejirocodes/agent-skills --skill exa-rag -a claude-code

2Manually: put the files in place

~/.claude/skills/exa-rag/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/exa-rag/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about exa-rag

How do I install exa-rag in Claude Code?

Run npx skills add ejirocodes/agent-skills --skill exa-rag -a claude-code. The skill file is at ~/.claude/skills/exa-rag/SKILL.md.

What does exa-rag do?

It shows how to use Exa web retrieval in RAG workflows and AI agents. The examples cover LangChain, LlamaIndex, Vercel AI SDK, MCP, and an OpenAI-compatible API.

Does exa-rag require an Exa API key?

Yes. The ExaSearchRetriever, ExaReader, and OpenAI-compatible API examples pass an Exa API key.

Source text

SKILL.md · MIT
---
name: exa-rag
description: "Build RAG pipelines with Exa.ai for real-time web retrieval. Use when building retrieval-augmented generation, integrating Exa with LangChain, LlamaIndex, Vercel AI SDK, or implementing AI agents with web search capabilities. Triggers on: RAG pipeline, retrieval augmented generation, Exa LangChain, Exa LlamaIndex, ExaSearchRetriever, ExaSearchResults, Exa MCP, Exa tool calling, Claude tool use, AI agent web search, grounded generation, citation generation, fact checking, hallucination detection, OpenAI compatibility, chat completions."
license: MIT
metadata:
  author: ejirocodes
  version: '1.0.0'
---

# Exa RAG Integration

## Quick Reference

| Topic | When to Use | Reference |
|-------|-------------|-----------|
| **LangChain** | Building RAG chains with LangChain | [langchain.md](references/langchain.md) |
| **LlamaIndex** | Using Exa as a LlamaIndex data source | [llamaindex.md](references/llamaindex.md) |
| **Vercel AI SDK** | Adding web search to Next.js AI apps | [vercel-ai.md](references/vercel-ai.md) |
| **MCP & Tools** | Claude MCP server, OpenAI tools, function calling | [mcp-tools.md](references/mcp-tools.md) |

## Essential Patterns

### LangChain Retriever

```python
from langchain_exa import ExaSearchRetriever

retriever = ExaSearchRetriever(
    exa_api_key="your-key",
    k=5,
    highlights=True
)

docs = retriever.invoke("latest AI research papers")
```

### LlamaIndex Reader

```python
from llama_index.readers.web import ExaReader

reader = ExaReader(api_key="your-key")
documents = reader.load_data(
    query="machine learning best practices",
    num_results=10
)
```

### Vercel AI SDK Tool

```typescript
import { exa } from "@agentic/exa";
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";

const result = await generateText({
  model: openai("gpt-4"),
  tools: { search: exa.searchAndContents },
  prompt: "Search for the latest TypeScript features",
});
```

### OpenAI-Compatible Endpoint

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.exa.ai/v1",
    api_key="your-exa-key"
)

response = client.chat.completions.create(
    model="exa",
    messages=[{"role": "user", "content": "What are the latest AI trends?"}]
)
```

## Integration Selection

| Framework | Best For | Key Feature |
|-----------|----------|-------------|
| **LangChain** | Complex chains, agents | ExaSearchRetriever, tool integration |
| **LlamaIndex** | Document indexing, Q&A | ExaReader, query engines |
| **Vercel AI SDK** | Next.js apps, streaming | Tool definitions, edge-ready |
| **OpenAI Compat** | Drop-in replacement | Minimal code changes |
| **Claude MCP** | Claude Desktop, Claude Code | Native tool calling |

## Common Mistakes

1. **Not using highlights for RAG** - Full text wastes context; use `highlights=True` for relevant snippets
2. **Missing source attribution** - Always include `result.url` in citations for grounded responses
3. **Ignoring summaries** - `summary=True` provides concise context without full page overhead
4. **Over-fetching results** - Start with 3-5 results; more isn't always better for RAG quality
5. **Not filtering domains** - Use `include_domains` to limit to authoritative sources
6. **Skipping date filters** - For current events, always add `start_published_date` to avoid stale info
7. **Forgetting async patterns** - Use async retrievers in production for better throughput

© ejirocodes · MIT · ejirocodes/agent-skills

Similar skills

All skills for AI and ML →

From the same set7

Project sponsors

Companies that keep this analytics open