Skip to content

Dianel555/DSkills / skills/exa

High-precision semantic search and content retrieval via Exa API. Use when: (1) Deep research requiring semantic understanding, (2) Code documentation and examples lookup, (3) Company/professional research, (4) AI-powered comprehensive research tasks, (5) URL content extraction with structured output. Triggers: "research", "find papers", "code examples", "company info", "LinkedIn profiles", "deep analysis". Differentiator: Exa excels at semantic/neural search while grok-search is better for real-time news and general web content.

scripts/exa_cli/__main__.py

View on GitHub
"""argparse routing for the Exa CLI."""

from __future__ import annotations

import argparse
import asyncio
import os
import sys

from .advanced import cmd_web_search_advanced_exa
from .agent import AGENT_EFFORTS, AGENT_PROVIDERS, cmd_agent_run, run_id_arg
from .config import Config, load_dotenv
from .config_info import cmd_get_config_info
from .fetch import cmd_web_fetch_exa
from .search import cmd_web_search_exa


def _add_global_options(parser: argparse.ArgumentParser) -> None:
    parser.add_argument("--api-url", help="Override EXA_API_URL")
    parser.add_argument("--api-key", help="Override EXA_API_KEY")
    parser.add_argument("--debug", action="store_true", help="Enable debug logging to stderr (sets EXA_DEBUG=true)")
    parser.add_argument(
        "--max-retry-wait",
        type=int,
        default=None,
        help="Cap (seconds) for single retry wait and exponential backoff (default: 60, env: EXA_MAX_RETRY_WAIT)",
    )
    parser.add_argument(
        "--auth-scheme",
        choices=["x-api-key", "bearer"],
        default=None,
        help="Authentication scheme: x-api-key (default) or bearer (env: EXA_AUTH_SCHEME)",
    )


def _num_results_in_range(value: str) -> int:
    n = int(value)
    if n < 1 or n > 100:
        raise argparse.ArgumentTypeError("must be between 1 and 100")
    return n


def _positive_int(value: str) -> int:
    n = int(value)
    if n <= 0:
        raise argparse.ArgumentTypeError("must be a positive integer")
    return n


def _non_negative_int(value: str) -> int:
    n = int(value)
    if n < 0:
        raise argparse.ArgumentTypeError("must be a non-negative integer")
    return n


def _run_id(value: str) -> str:
    try:
        return run_id_arg(value)
    except ValueError as exc:
        raise argparse.ArgumentTypeError(str(exc)) from exc


def _build_search_parser(sub) -> None:
    p = sub.add_parser("web_search_exa", help="Semantic web search (highlights always on)")
    p.add_argument("--query", "-q", required=True, help="Search query (may embed category:<type>)")
    p.add_argument(
        "--num-results", "-n", type=_num_results_in_range, default=10, help="Number of results 1-100 (default: 10)"
    )


def _build_fetch_parser(sub) -> None:
    p = sub.add_parser("web_fetch_exa", help="Batch URL extraction via /contents")
    p.add_argument("--urls", action="append", required=True, help="URL to fetch (repeat flag for multiple URLs)")
    p.add_argument("--max-chars", type=_positive_int, default=3000, help="Max characters per page (default: 3000)")
    p.add_argument("--out", "-o", help="Write JSON to file instead of stdout")


def _build_advanced_parser(sub) -> None:
    p = sub.add_parser("web_search_advanced_exa", help="Advanced search with filters")
    p.add_argument("--query", "-q", required=True, help="Search query")
    p.add_argument("--type", choices=["auto", "fast", "instant"], default="auto", help="Search type (default: auto)")
    p.add_argument("--category", help="Category filter")
    p.add_argument("--num-results", "-n", type=_num_results_in_range, default=10)
    p.add_argument(
        "--include-domains", action="append", default=None, help="Domain to include (repeat flag for multiple)"
    )
    p.add_argument(
        "--exclude-domains", action="append", default=None, help="Domain to exclude (repeat flag for multiple)"
    )
    p.add_argument(
        "--include-text", action="append", default=None, help="Required text snippet (repeat flag for multiple)"
    )
    p.add_argument(
        "--exclude-text", action="append", default=None, help="Excluded text snippet (repeat flag for multiple)"
    )
    p.add_argument("--start-date", help="ISO 8601 start date (publishedDate)")
    p.add_argument("--end-date", help="ISO 8601 end date (publishedDate)")
    p.add_argument("--max-age-hours", type=int, help="Max content age in hours")
    p.add_argument("--text", action="store_true", help="Include text content")
    p.add_argument("--highlights", action="store_true", help="Include highlights")
    p.add_argument("--summary", action="store_true", help="Include summary")
    p.add_argument("--max-chars", type=_positive_int, help="Max characters for text (only effective with --text)")
    p.add_argument("--out", "-o", help="Write JSON to file instead of stdout")


def _build_config_info_parser(sub) -> None:
    p = sub.add_parser("get_config_info", help="Show config + optional connectivity probe")
    p.add_argument("--no-test", action="store_true", help="Skip connectivity probe")


def _build_agent_parser(sub) -> None:
    p = sub.add_parser("agent_run", help="Create or resume an Exa Agent run")
    mode = p.add_mutually_exclusive_group(required=True)
    mode.add_argument("--query", help="Research objective for a new run")
    mode.add_argument("--run-id", type=_run_id, help="Existing Agent run ID")
    p.add_argument("--system-prompt")
    p.add_argument("--output-schema", metavar="FILE")
    p.add_argument("--input-data", metavar="FILE")
    p.add_argument("--input-exclusion", metavar="FILE")
    p.add_argument("--data-source", action="append", choices=AGENT_PROVIDERS)
    p.add_argument("--previous-run-id", type=_run_id)
    p.add_argument("--effort", choices=AGENT_EFFORTS, default=None)
    p.add_argument("--wait-seconds", type=_non_negative_int, default=750)
    p.add_argument("--poll-interval", type=_positive_int, default=4)
    p.add_argument("--out", "-o", help="Write the normalized result to a file")


def build_parser() -> argparse.ArgumentParser:
    parser = argparse.ArgumentParser(
        prog="exa_cli",
        description="Exa Search CLI — semantic search via Exa API",
    )
    _add_global_options(parser)
    sub = parser.add_subparsers(dest="command", required=True)
    _build_search_parser(sub)
    _build_fetch_parser(sub)
    _build_advanced_parser(sub)
    _build_config_info_parser(sub)
    _build_agent_parser(sub)
    return parser


COMMAND_DISPATCH = {
    "web_search_exa": cmd_web_search_exa,
    "web_fetch_exa": cmd_web_fetch_exa,
    "web_search_advanced_exa": cmd_web_search_advanced_exa,
    "get_config_info": cmd_get_config_info,
    "agent_run": cmd_agent_run,
}


def main() -> None:
    load_dotenv()
    parser = build_parser()
    args = parser.parse_args()

    if args.debug:
        os.environ["EXA_DEBUG"] = "true"

    cfg = Config()
    cfg.set_overrides(
        api_url=args.api_url,
        api_key=args.api_key,
        max_retry_wait=args.max_retry_wait,
        auth_scheme=args.auth_scheme,
    )

    handler = COMMAND_DISPATCH[args.command]
    try:
        asyncio.run(handler(args))
    except KeyboardInterrupt:
        sys.exit(130)


if __name__ == "__main__":
    main()
rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).Stars: 198kUpdated Claude CodeCodexUnverifiedInstall
doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.Stars: 198kUpdated Claude CodeCodexVerifiedInstall