EX

exa-multi-env-setup

Multi-environment setup guide for Exa API keys, caching, and request limits.

Install

mkdir -p .claude/skills/exa-multi-env-setup && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/8841" && unzip -o skill.zip -d .claude/skills/exa-multi-env-setup && rm skill.zip

Installs to .claude/skills/exa-multi-env-setup

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Configure Exa across development, staging, and production environments.
71 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Isolate API keys across development, staging, and production
  • Configure environment-specific search limits and content settings
  • Implement Redis caching for staging and production environments
  • Perform health checks per environment
  • Manage secrets via CI/CD environment variables

How it works

It uses environment-specific configuration objects to adjust API keys, result limits, and cache TTLs based on the current deployment environment.

Inputs & outputs

You give it
Environment context and search query
You get back
Environment-aware search results with appropriate caching

When to use exa-multi-env-setup

  • Isolate API keys across environments
  • Implement environment-aware search limits
  • Setup Redis caching for staging and prod
  • Configure Exa request parameters per tier

About this skill

Exa Multi-Environment Setup

Overview

Exa charges per search request at api.exa.ai. Multi-environment setup focuses on API key isolation per environment, request limits and caching to control costs in staging, and appropriate numResults/content settings per tier.

Prerequisites

  • Exa API key(s) from dashboard.exa.ai
  • exa-js installed (npm install exa-js)
  • Optional: Redis for search result caching in staging/production

Environment Strategy

EnvironmentKey IsolationnumResultsContentCache TTL
DevelopmentShared dev key3highlights onlyNone
StagingStaging key5text (1000 chars)5 min
ProductionProd key10text (2000 chars)1 hour

Instructions

Step 1: Environment-Aware Configuration

// config/exa.ts
import Exa from "exa-js";

type Env = "development" | "staging" | "production";

interface ExaEnvConfig {
  apiKey: string;
  defaultNumResults: number;
  maxCharacters: number;
  searchType: "auto" | "neural" | "keyword";
  cacheEnabled: boolean;
  cacheTtlSeconds: number;
}

const configs: Record<Env, Omit<ExaEnvConfig, "apiKey"> & { keyVar: string }> = {
  development: {
    keyVar: "EXA_API_KEY",
    defaultNumResults: 3,
    maxCharacters: 500,
    searchType: "auto",
    cacheEnabled: false,
    cacheTtlSeconds: 0,
  },
  staging: {
    keyVar: "EXA_API_KEY_STAGING",
    defaultNumResults: 5,
    maxCharacters: 1000,
    searchType: "auto",
    cacheEnabled: true,
    cacheTtlSeconds: 300,  // 5 minutes
  },
  production: {
    keyVar: "EXA_API_KEY_PROD",
    defaultNumResults: 10,
    maxCharacters: 2000,
    searchType: "neural",
    cacheEnabled: true,
    cacheTtlSeconds: 3600,  // 1 hour
  },
};

export function getExaConfig(): ExaEnvConfig {
  const env = (process.env.NODE_ENV || "development") as Env;
  const config = configs[env] || configs.development;
  const apiKey = process.env[config.keyVar];
  if (!apiKey) {
    throw new Error(`${config.keyVar} not set for ${env} environment`);
  }
  return { ...config, apiKey };
}

export function getExaClient(): Exa {
  return new Exa(getExaConfig().apiKey);
}

Step 2: Search Service with Config-Driven Defaults

// lib/exa-search.ts
import { getExaClient, getExaConfig } from "../config/exa";

export async function search(query: string, numResults?: number) {
  const exa = getExaClient();
  const cfg = getExaConfig();
  const n = numResults ?? cfg.defaultNumResults;

  return exa.searchAndContents(query, {
    type: cfg.searchType,
    numResults: n,
    text: { maxCharacters: cfg.maxCharacters },
  });
}

Step 3: Redis Cache Layer (Staging/Production)

// lib/exa-cache.ts
import { Redis } from "ioredis";
import { getExaClient, getExaConfig } from "../config/exa";

const redis = process.env.REDIS_URL ? new Redis(process.env.REDIS_URL) : null;

export async function cachedSearch(query: string, numResults?: number) {
  const exa = getExaClient();
  const cfg = getExaConfig();
  const n = numResults ?? cfg.defaultNumResults;

  if (cfg.cacheEnabled && redis) {
    const cacheKey = `exa:${Buffer.from(`${query}:${n}:${cfg.searchType}`).toString("base64")}`;
    const cached = await redis.get(cacheKey);
    if (cached) return JSON.parse(cached);

    const results = await exa.searchAndContents(query, {
      type: cfg.searchType,
      numResults: n,
      text: { maxCharacters: cfg.maxCharacters },
    });

    await redis.set(cacheKey, JSON.stringify(results), "EX", cfg.cacheTtlSeconds);
    return results;
  }

  return exa.searchAndContents(query, {
    type: cfg.searchType,
    numResults: n,
    text: { maxCharacters: cfg.maxCharacters },
  });
}

Step 4: Environment Variables

# .env.local (development)
EXA_API_KEY=exa-dev-key-here

# .env.staging
EXA_API_KEY_STAGING=exa-staging-key-here
REDIS_URL=redis://staging-redis:6379

# .env.production
EXA_API_KEY_PROD=exa-prod-key-here
REDIS_URL=redis://prod-redis:6379

Step 5: CI/CD Secret Configuration

# .github/workflows/deploy.yml
jobs:
  deploy-staging:
    environment: staging
    env:
      EXA_API_KEY_STAGING: ${{ secrets.EXA_API_KEY_STAGING }}
      NODE_ENV: staging
    steps:
      - run: npm ci && npm run build && npm run deploy:staging

  deploy-production:
    environment: production
    env:
      EXA_API_KEY_PROD: ${{ secrets.EXA_API_KEY_PROD }}
      NODE_ENV: production
    steps:
      - run: npm ci && npm run build && npm run deploy:prod

Step 6: Health Check Per Environment

export async function checkExaHealth(): Promise<{
  status: string;
  env: string;
  latencyMs: number;
}> {
  const start = performance.now();
  try {
    const exa = getExaClient();
    await exa.search("health check", { numResults: 1 });
    return {
      status: "healthy",
      env: process.env.NODE_ENV || "development",
      latencyMs: Math.round(performance.now() - start),
    };
  } catch {
    return {
      status: "unhealthy",
      env: process.env.NODE_ENV || "development",
      latencyMs: Math.round(performance.now() - start),
    };
  }
}

Error Handling

IssueCauseSolution
401 UnauthorizedWrong API key for environmentVerify correct env var name
429 rate_limit_exceededToo many requestsEnable caching and request queuing
High API costs in stagingNo caching enabledEnable Redis cache with 5-min TTL
Empty results in devnumResults too lowIncrease from 3 to 5

Resources

Next Steps

For deployment configuration, see exa-deploy-integration.

When not to use it

  • When environment variables are missing for the target tier
  • When Redis is not available for caching

Prerequisites

Exa API keyexa-js packageRedis for caching

Limitations

  • Development environment does not support caching
  • Requires separate API keys for each environment

How it compares

This approach enforces environment-specific constraints and caching policies programmatically, rather than using a single global configuration.

Compared to similar skills

exa-multi-env-setup side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
exa-multi-env-setup (this skill)027dReviewIntermediate
smithery-mcp-deployment88moReviewIntermediate
apollo-deploy-integration127dCautionIntermediate
firecrawl-deploy-integration127dReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

smithery-mcp-deployment

CaullenOmdahl

Best practices for creating, optimizing, and deploying MCP servers to Smithery. Use this skill when:(1) Creating new MCP servers for Smithery deployment(2) Optimizing quality scores (achieving 90/100)(3) Troubleshooting deployment issues (0/0 tools, missing annotations, low scores)(4) Migrating existing MCP servers to Smithery format(5) Understanding Smithery's schema format requirements(6) Adding workflow prompts, tool annotations, or documentation resources(7) Configuring smithery.yaml and package.json for deployment

881

apollo-deploy-integration

jeremylongshore

Deploy Apollo.io integrations to production. Use when deploying Apollo integrations, configuring production environments, or setting up deployment pipelines. Trigger with phrases like "deploy apollo", "apollo production deploy", "apollo deployment pipeline", "apollo to production".

19

firecrawl-deploy-integration

jeremylongshore

Deploy FireCrawl integrations to Vercel, Fly.io, and Cloud Run platforms. Use when deploying FireCrawl-powered applications to production, configuring platform-specific secrets, or setting up deployment pipelines. Trigger with phrases like "deploy firecrawl", "firecrawl Vercel", "firecrawl production deploy", "firecrawl Cloud Run", "firecrawl Fly.io".

12

higress-clawdbot-integration

alibaba

Deploy and configure Higress AI Gateway for Clawdbot/OpenClaw integration. Use when: (1) User wants to deploy Higress AI Gateway, (2) User wants to configure Clawdbot/OpenClaw to use Higress as a model provider, (3) User mentions 'higress', 'ai gateway', 'model gateway', 'AI网关', (4) User wants to set up model routing or auto-routing, (5) User needs to manage LLM provider API keys, (6) User wants to track token usage and conversation history.

11

posthog-deploy-integration

jeremylongshore

Deploy PostHog integrations to Vercel, Fly.io, and Cloud Run platforms. Use when deploying PostHog-powered applications to production, configuring platform-specific secrets, or setting up deployment pipelines. Trigger with phrases like "deploy posthog", "posthog Vercel", "posthog production deploy", "posthog Cloud Run", "posthog Fly.io".

10

vercel-hello-world

jeremylongshore

Create a minimal working Vercel example. Use when starting a new Vercel integration, testing your setup, or learning basic Vercel API patterns. Trigger with phrases like "vercel hello world", "vercel example", "vercel quick start", "simple vercel code".

01

Search skills

Search the agent skills registry