/exa-pack:exa-architecture-variantsfrom exa-pack
Guides implementation of Exa neural search at three scales: direct search, cached search with category profiles, and full RAG pipeline. Helps choose the right architecture for query volume and latency needs.
Ships in exa-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Three deployment architectures for Exa neural search at different scales. Each uses real Exa SDK methods: search, searchAndContents, findSimilar, getContents, and answer.
| Factor | Direct Search | Cached Search | RAG Pipeline |
|---|---|---|---|
| Volume | < 1K/day | 1K-50K/day | Any volume |
| Latency | 500-2000ms | ~50ms (cached) | 3-8s total |
| Use Case | Simple search UI | Content aggregation | AI answers with citations |
| Complexity | Low | Medium | High |
| Cache Required | No | Yes (Redis/LRU) | Yes |
| Exa Methods | searchAndContents | searchAndContents + cache | All methods |
Best for: Adding search to an existing app, < 1K queries/day.
import Exa from "exa-js";
import express from "express";
const app = express();
const exa = new Exa(process.env.EXA_API_KEY);
// Simple search endpoint
app.get("/api/search", async (req, res) => {
const query = req.query.q as string;
if (!query) return res.status(400).json({ error: "q required" });
try {
const results = await exa.searchAndContents(query, {
type: "auto",
numResults: 5,
text: { maxCharacters: 500 },
highlights: { maxCharacters: 300, query },
});
res.json(results.results.map(r => ({
title: r.title,
url: r.url,
snippet: r.highlights?.join(" ") || r.text?.substring(0, 200),
score: r.score,
})));
} catch (err: any) {
res.status(err.status || 500).json({ error: err.message });
}
});
Best for: High-traffic search, 1K-50K queries/day, content discovery.
import Exa from "exa-js";
import { LRUCache } from "lru-cache";
const exa = new Exa(process.env.EXA_API_KEY);
const cache = new LRUCache<string, any>({ max: 5000, ttl: 3600 * 1000 });
const PROFILES = {
news: {
type: "auto" as const,
category: "news" as const,
numResults: 10,
text: { maxCharacters: 500 },
},
research: {
type: "neural" as const,
category: "research paper" as const,
numResults: 10,
text: { maxCharacters: 2000 },
highlights: { maxCharacters: 500 },
},
companies: {
type: "auto" as const,
category: "company" as const,
numResults: 10,
text: { maxCharacters: 500 },
},
};
async function cachedProfileSearch(
query: string,
profile: keyof typeof PROFILES
) {
const key = `${query.toLowerCase()}:${profile}`;
const cached = cache.get(key);
if (cached) return cached;
const results = await exa.searchAndContents(query, PROFILES[profile]);
cache.set(key, results);
return results;
}
Best for: AI-powered answers, research agents, 50K+ queries/day.
import Exa from "exa-js";
import { LRUCache } from "lru-cache";
const exa = new Exa(process.env.EXA_API_KEY);
const contextCache = new LRUCache<string, any>({ max: 10000, ttl: 7200 * 1000 });
class ExaRAGPipeline {
// Phase 1: Search for relevant sources
async gatherContext(question: string, maxSources = 5) {
const cacheKey = question.toLowerCase().trim();
const cached = contextCache.get(cacheKey);
if (cached) return cached;
const results = await exa.searchAndContents(question, {
type: "neural",
numResults: maxSources,
text: { maxCharacters: 2000 },
highlights: { maxCharacters: 500, query: question },
});
contextCache.set(cacheKey, results);
return results;
}
// Phase 2: Expand with similar content
async expandContext(topResultUrl: string, numSimilar = 3) {
return exa.findSimilarAndContents(topResultUrl, {
numResults: numSimilar,
text: { maxCharacters: 1500 },
excludeSourceDomain: true,
});
}
// Phase 3: Format for LLM context injection
formatForLLM(results: any[]) {
return results.map((r, i) =>
`[Source ${i + 1}] ${r.title}\n` +
`URL: ${r.url}\n` +
`Content: ${r.text}\n` +
`Key points: ${r.highlights?.join(" | ") || "N/A"}`
).join("\n\n---\n\n");
}
// Phase 4: Use Exa's built-in answer endpoint
async getAnswer(question: string) {
const answer = await exa.answer(question, { text: true });
return {
answer: answer.answer,
sources: answer.results.map(r => ({
title: r.title,
url: r.url,
})),
};
}
// Full pipeline
async research(question: string) {
const context = await this.gatherContext(question, 5);
// Expand with similar content from top result
let expanded = { results: [] as any[] };
if (context.results[0]?.url) {
expanded = await this.expandContext(context.results[0].url);
}
const allResults = [...context.results, ...expanded.results];
const llmContext = this.formatForLLM(allResults);
return {
context: llmContext,
sourceCount: allResults.length,
sources: allResults.map(r => ({ title: r.title, url: r.url, score: r.score })),
};
}
}
| Architecture | 10 QPS Limit Strategy |
|---|---|
| Direct | Natural limit: ~864K searches/day at full rate |
| Cached | 50% cache hit = ~1.7M effective searches/day |
| RAG Pipeline | 2-3 API calls per question; cache aggressively |
| Issue | Cause | Solution |
|---|---|---|
| Slow search in UI | No caching | Add LRU or Redis cache |
| Stale cached results | Long TTL | Reduce TTL for time-sensitive profiles |
| RAG hallucination | Poor source selection | Use highlights, increase numResults |
| High API costs | No query deduplication | Cache layer deduplicates identical queries |
For reference architecture details, see exa-reference-architecture.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
30 skills in this plugin
/exa-advanced-troubleshootingApply advanced debugging techniques for hard-to-diagnose Exa issues.
Use when standard troubleshooting fails, investigating latency spikes,
or preparing evidence bundles for Exa support escalation.
Trigger with phrases like "exa hard bug", "exa mystery error",
"exa deep debug", "difficult exa issue", "exa latency spike".
/exa-ci-integrationConfigure Exa CI/CD integration with GitHub Actions and automated testing.
Use when setting up automated testing for Exa integrations,
configuring CI pipelines, or adding Exa health checks to builds.
Trigger with phrases like "exa CI", "exa GitHub Actions",
"exa automated tests", "CI exa", "exa pipeline".
/exa-common-errorsDiagnose and fix Exa API errors by HTTP code and error tag.
Use when encountering Exa errors, debugging failed requests,
or troubleshooting integration issues.
Trigger with phrases like "exa error", "fix exa",
"exa not working", "debug exa", "exa 429", "exa 401".
/exa-core-workflow-aExecute Exa neural search with contents, date filters, and domain scoping.
Use when building search features, implementing RAG context retrieval,
or querying the web with semantic understanding.
Trigger with phrases like "exa search", "exa neural search",
"search with exa", "exa searchAndContents", "exa query".
/exa-core-workflow-bExecute Exa findSimilar, getContents, answer, and streaming answer workflows.
Use when finding pages similar to a URL, retrieving content for known URLs,
or getting AI-generated answers with citations.
Trigger with phrases like "exa find similar", "exa get contents",
"exa answer", "exa similarity search", "findSimilarAndContents".
/exa-cost-tuningOptimize Exa costs through search type selection, caching, and usage monitoring.
Use when analyzing Exa billing, reducing API costs,
or implementing budget controls and usage alerts.
Trigger with phrases like "exa cost", "exa billing",
"reduce exa costs", "exa pricing", "exa expensive", "exa budget".
npx claudepluginhub flight505/skill-forge --plugin exa-packOther plugins' skills for the same job