How anysearch-ai/anysearch-skill works
1. What this repo is
- This is a packaged AI-agent skill, not a server or application backend.
- Its purpose is to give agents a unified interface for AnySearch API capabilities: general search, vertical/domain search, batch search, and page content extraction.
2. Main architectural shape
- The repo is organized as a thin client layer around an external search service.
- The core behavior lives in runtime-specific CLI entrypoints under scripts/, with a small amount of shared spec/config data.
3. Runtime adapters
- There are four equivalent command-line frontends:
- scripts/anysearch_cli.py for Python
- scripts/anysearch_cli.js for Node.js
- scripts/anysearch_cli.ps1 for PowerShell
- scripts/anysearch_cli.sh for Bash
- These are not separate products; they are alternate adapters for different execution environments.
- The repo expects one of them to be chosen as the active runtime for the host agent environment.
4. Active runtime selection
- runtime.conf.example shows that the skill records a preferred runtime in runtime.conf.
- The README defines a priority order for choosing a runtime: Python, then Node.js, then Shell, with PowerShell as the Windows shell path.
- This is a deployment-time concern: the skill is designed to run wherever the agent platform supports one of these interpreters.
5. Command surface
- The CLIs expose a small, consistent set of actions:
- doc for capability/verification output
- search for single-query search
- batch_search for parallel query execution
- extract for fetching and returning full-page content
- The extract path is special in that it returns Markdown directly, rather than requiring a separate formatting step.
6. External service boundary
- The key runtime boundary is the AnySearch API service at anysearch.com.
- The repository itself holds no search index, crawl store, or document database; it is a request/response client to that external service.
- API access is optional but recommended, and anonymous access is supported with lower limits.
7. Authentication and configuration
- API credentials are configured through:
- CLI flag --api_key
- .env file from .env.example
- environment variable ANYSEARCH_API_KEY
- anonymous fallback if none is provided
- This creates a clear config precedence chain and separates secrets from code.
8. Shared metadata and generation assets
- scripts/shared/constants.json and scripts/shared/doc_spec.md suggest shared, runtime-agnostic content used by the CLIs.
- scripts/generate.py likely produces or synchronizes repeated command/help/documentation material across the different runtime implementations.
- That indicates a single source of truth for shared behavior, even though multiple language frontends exist.
9. Packaging and installation boundary
- The repo is meant to be installed into an agent skill directory and loaded by agent tooling.
- SKILL.md, README.md, .env.example, and runtime config files define the skill’s operational contract rather than an application UI.
- .gitignore keeps environment secrets and runtime detection output out of source control.
10. End-to-end data flow
- An agent invokes the chosen CLI runtime.
- The CLI reads runtime/config state and resolves the API key from the configured precedence chain.
- The CLI sends a search or extraction request to the AnySearch service.
- The service returns results or page content.
- The CLI emits machine-readable output to the agent, with extraction already normalized to Markdown.
11. Important architectural conclusion
- The repo is best diagrammed as a multi-runtime client wrapper around one external API, with shared documentation/spec assets and minimal local state.
- There are no internal subsystems such as databases, queues, background jobs, or web endpoints; the main boundaries are runtime selection, configuration/auth, and external API communication.
Main entry points: anysearch_cli.py Python CLI · anysearch_cli.js Node CLI · README.md README · anysearch_cli.ps1 PowerShell CLI
Components 17
Runtime adapters
Equivalent CLI frontends for different execution environments.
- Python CLI · Primary CLI entrypoint for Python environments.
scripts/anysearch_cli.py - Node CLI · CLI entrypoint for Node.js environments.
scripts/anysearch_cli.js - PowerShell CLI · CLI entrypoint for Windows PowerShell environments.
scripts/anysearch_cli.ps1 - Shell CLI · CLI entrypoint for Bash-compatible environments.
scripts/anysearch_cli.sh - Doc command · Capability and verification output path exposed by each runtime.
- Search command · Single-query search path exposed by each runtime.
- Batch search · Parallel multi-query search path exposed by each runtime.
- Extract command · Fetches page content and returns Markdown directly.
Shared assets
Common spec and generated material reused by all runtimes.
Packaging & config
Repository-level files that define installation, runtime selection, and secret handling.
- README · Human-facing overview and runtime selection guidance.
README.md - Skill doc · Skill-level operational contract for agent tooling.
SKILL.md - Runtime example · Example preferred-runtime configuration.
runtime.conf.example - Env example · Example API-key and environment configuration.
.env.example - Git ignore · Excludes secrets and generated runtime state from source control.
.gitignore
External service
The AnySearch API boundary outside this repository.
- AnySearch API · External request/response service for search and content extraction.
Connections 38
- README → Runtime example: runtime priority · Documents how the preferred runtime is selected.
- README → Python CLI: prefer · Python is the first runtime choice when available.
- README → Node CLI: fallback · Node.js is the second runtime choice.
- README → Shell CLI: fallback · Shell is the next fallback runtime.
- README → PowerShell CLI: windows path · PowerShell is the Windows shell option.
- Skill doc → README: operates with · Defines the skill contract alongside the README.
- Env example → AnySearch API: api key · Provides one source of API credential configuration.
- Runtime example → Python CLI: selects · Preferred runtime resolves to a concrete CLI adapter.
- Runtime example → Node CLI: selects · Preferred runtime resolves to a concrete CLI adapter.
- Runtime example → Shell CLI: selects · Preferred runtime resolves to a concrete CLI adapter.
- Runtime example → PowerShell CLI: selects · Preferred runtime resolves to a concrete CLI adapter.
- Python CLI → Constants: reads · Consumes shared constants for behavior and output.
- Python CLI → Doc spec: reads · Uses the shared documentation/spec definition.
- Node CLI → Constants: reads · Consumes shared constants for behavior and output.
- Node CLI → Doc spec: reads · Uses the shared documentation/spec definition.
- PowerShell CLI → Constants: reads · Consumes shared constants for behavior and output.
- Shell CLI → Doc spec: reads · Uses the shared documentation/spec definition.
- Generator → Constants: syncs · Keeps generated behavior aligned with shared constants.
- Generator → Doc spec: syncs · Keeps generated help/spec material aligned.
- Python CLI → Doc command: exposes · Provides the doc capability through the runtime CLI.
- Python CLI → Search command: exposes · Provides single-query search through the runtime CLI.
- Python CLI → Batch search: exposes · Provides batch search through the runtime CLI.
- Python CLI → Extract command: exposes · Provides Markdown extraction through the runtime CLI.
- Node CLI → Doc command: exposes · Provides the doc capability through the runtime CLI.
- Node CLI → Search command: exposes · Provides single-query search through the runtime CLI.
- Node CLI → Batch search: exposes · Provides batch search through the runtime CLI.
- Node CLI → Extract command: exposes · Provides Markdown extraction through the runtime CLI.
- PowerShell CLI → Doc command: exposes · Provides the doc capability through the runtime CLI.
- PowerShell CLI → Search command: exposes · Provides single-query search through the runtime CLI.
- PowerShell CLI → Extract command: exposes · Provides Markdown extraction through the runtime CLI.
- Shell CLI → Search command: exposes · Provides single-query search through the runtime CLI.
- Shell CLI → Batch search: exposes · Provides batch search through the runtime CLI.
- Shell CLI → Extract command: exposes · Provides Markdown extraction through the runtime CLI.
- Search command → AnySearch API: request · Search commands send queries to the external API.
- Batch search → AnySearch API: request · Batch search sends multiple queries to the external API.
- Extract command → AnySearch API: fetch page · Extraction retrieves page content from the external service.
- Doc command → AnySearch API: verify · Capability output may confirm service availability and behavior.
- Git ignore → Env example: protects · Keeps local secret and environment artifacts out of source control.