Overview
Anysite CLI is agent-native — it auto-detects when stdout is a pipe or subprocess (non-TTY) and switches all output to structured JSON. No flags, no configuration. AI agents like Claude Code, n8n, Make, and custom scripts get machine-readable responses out of the box. Every command returns:- A JSON envelope with
ok,result/error,hints, andmeta - Exit codes for programmatic flow control
- Error codes with
retryableflag andsuggestions - Next-step hints so agents discover follow-up commands without documentation
Auto-Detection
| Context | Default Output | Override |
|---|---|---|
| Terminal (TTY) | Human-readable Rich text | --json to force JSON |
| Pipe / subprocess (no TTY) | Structured JSON envelope | --human to force human text |
--non-interactive flag disables interactive prompts (confirmations, selections). It is auto-enabled when stdin is not a TTY.
JSON Envelope
Success Response
Error Response
ok field first. Use error.code for programmatic handling, error.retryable to decide whether to retry, and error.suggestions for recovery steps.
Exit Codes
| Code | Meaning | When |
|---|---|---|
| 0 | Success | Command completed successfully |
| 1 | General error | Unhandled error, server error |
| 2 | Usage error | Invalid arguments, missing required parameters |
| 3 | Authentication failed | Invalid or expired API key |
| 4 | Resource not found | Endpoint, connection, or source not found |
| 5 | Network error | Connection failure, timeout, rate limit |
Error Codes
API Errors
API Errors
| Error Code | Exit Code | Retryable | Trigger |
|---|---|---|---|
AUTH_FAILED | 3 | No | Invalid or expired API key |
RATE_LIMIT | 5 | Yes | Too many requests |
NOT_FOUND | 4 | No | Resource not found |
VALIDATION_ERROR | 2 | No | Bad input parameters |
SERVER_ERROR | 1 | Yes | API server error |
NETWORK_ERROR | 5 | Yes | Connection failure |
TIMEOUT | 5 | Yes | Request timeout |
Database Errors
Database Errors
| Error Code | Exit Code | Retryable | Trigger |
|---|---|---|---|
CONNECTION_NOT_FOUND | 4 | No | Database connection not configured |
Dataset Errors
Dataset Errors
| Error Code | Exit Code | Retryable | Trigger |
|---|---|---|---|
DATASET_ERROR | 1 | No | Dataset operation failed |
SOURCE_NOT_FOUND | 4 | No | Source not found in dataset config |
LLM Errors
LLM Errors
| Error Code | Exit Code | Retryable | Trigger |
|---|---|---|---|
CONFIG_ERROR | 2 | No | LLM provider not configured |
LLM_PROVIDER_ERROR | 1 | Yes | LLM provider failure |
Hints
Every command returns next-step hints — suggested follow-up commands based on what you just did. In JSON mode, hints appear in thehints array. In human mode, they are printed as dim text on stderr.
Agents use hints to discover follow-up actions without consulting documentation:
Discovery Payload
Runanysite with no arguments in a pipe to get a full discovery payload describing all CLI capabilities:
| Field | Description |
|---|---|
commands | All available commands with descriptions and subcommands |
agent_protocol | How auto-JSON, --json, --human, --non-interactive work |
output_schema | Success and error envelope formats |
exit_codes | Machine-readable exit code meanings |
installed_extras | Which optional packages are available (data, llm, postgres, clickhouse) |
Built-in Guide
The CLI includes a comprehensive dataset configuration guide accessible via the command line:Integration Examples
Pipe to jq
Shell Script with Error Handling
Agent Workflow
A typical AI agent workflow with the CLI:Next Steps
Data Agent
AI agent for automated data collection using the agent protocol
Installation
Install the CLI and configure global options