CLI
The nodemantis command line is included in the node-mantis package on npm and PyPI. Use it to run browser goals, retrieve data, configure credentials, and check your installation. Both packages install the equivalent commands nodemantis and node-mantis.
This page documents the command-line surface: flags, output contracts, exit codes, and configuration. The flags mirror the SDK options — what they mean (effort levels, budgets, retrieval statuses and result fields) is defined once in the API reference.
Choose one installation method below. Each installs the CLI and its compiled runtime. Google Chrome must also be installed. If you have multiple installations, the first nodemantis on your PATH runs.
npm install -g node-mantis
# Run without a global installation
npx node-mantis doctorpython -m pip install --upgrade "node-mantis"
# Or install the CLI in an isolated environment
pipx install "node-mantis"
# Run using a specific Python environment
python -m nodemantis doctorbrew install node-mantis/tap/nodemantisHave Google Chrome installed, set a key, then run a goal. The key can also come from the environment instead of the config file.
export NODEMANTIS_API_KEY="sk_live_<copy-from-dashboard>" # or persist it:
nodemantis configure --api-key "sk_live_<copy-from-dashboard>"
nodemantis doctor
nodemantis run \
"Find the cheapest in-stock Travel & Adventure book. Report its title and price." \
--url https://sandbox.nodemantis.com \
--max-iterations 20| Command | Description | Example |
|---|---|---|
run | Run a browser task from a prompt. | nodemantis run "Go to sandbox.nodemantis.com and find travel books." |
retrieve | Read data from a specified page. | nodemantis retrieve "Read the book titles." -u https://sandbox.nodemantis.com |
configure | Save your API key and proxy configuration. | nodemantis configure |
doctor | Check your installation, browser, and service connection. | nodemantis doctor |
Flags are grouped by the command that accepts them.
| Flag | Description | Example |
|---|---|---|
-h, --help | Show CLI help, or the options for a specific command. | nodemantis --helpnodemantis run -h |
-V, --version | Print the installed CLI version and exit. Use it without a subcommand. | nodemantis -V |
Runs a multi-step browser goal, narrating each iteration on stderr while it works. Every run returns a summary. Pass --schema to request structured data as well.
nodemantis run \
"Find the cheapest in-stock Travel & Adventure book. Report its title and price." \
--url https://sandbox.nodemantis.com \
--max-iterations 20| Parameter | Type | Default | Description |
|---|---|---|---|
-u, --url <url> | string | none | Page to open before the agent starts working on the goal. |
-s, --schema <file|json> | string | free-form | JSON Schema for a typed result — a path to a schema file or an inline JSON string. |
-e, --effort <level> | string | medium | Effort level: low, medium (default), high, or xhigh. Controls the model combinations used for the task. |
-n, --max-iterations <n> | number | 30 | Maximum perception-and-action iterations before the run stops. |
-t, --timeout-ms <ms> | number | 300000 (5 minutes) | Overall operation timeout in milliseconds. |
-c, --max-cost <usd> | number | no ceiling | USD budget checked between iterations. The final iteration can take total spend above this amount. |
--secrets <names> | string | none | Comma-separated names of private values the agent can type but never sees. Each value is read from the environment variable NODEMANTIS_SECRET_<NAME>, with the name in upper case, and stays on your machine. |
-H, --headed | flag | headless | Shows the browser window. Runs are headless unless this flag is set. |
-v, --viewport <WxH> | string | Chrome window size | Browser viewport size, for example 1440x900. |
-P, --use-proxy | flag | off | Routes the browser through the configured proxy. See proxy configuration in the API reference. |
-k, --api-key <key> | string | resolved config | Explicit API key. Overrides environment variables and the config file. |
-l, --log-level <level> | off | info | debug | off | Local file logging level. Files stay on your computer. Use --quiet to hide live terminal narration. |
-d, --debug | flag | off | Enables detailed local log files and retained screenshots. |
-j, --json | flag | off | Prints exactly one JSON object on stdout; every human-readable line goes to stderr. |
-q, --quiet | flag | off | Suppresses narration and progress output on stderr. |
Opens a page and returns grounded data for a prompt. --url is required. Statuses and result fields follow the retrieve contract in the API reference.
nodemantis retrieve "Read this book's title and price in USD." \
--url https://sandbox.nodemantis.com/books/journey-to-the-center-of-the-earth \
--schema '{"type":"object","properties":{"title":{"type":"string"},"priceUsd":{"type":"number"}},"required":["title","priceUsd"],"additionalProperties":false}'| Parameter | Type | Default | Description |
|---|---|---|---|
-u, --url <url> | string | required | Page to open and retrieve from. retrieve fails without it. |
-s, --schema <file|json> | string | free-form | JSON Schema for the result shape — a path to a schema file or an inline JSON string. |
-e, --effort <level> | string | medium | Effort level: low, medium (default), high, or xhigh. Higher effort can improve interpretation and cost more. |
-H, --headed | flag | headless | Shows the browser window. Runs are headless unless this flag is set. |
-v, --viewport <WxH> | string | Chrome window size | Browser viewport size, for example 1440x900. |
-P, --use-proxy | flag | off | Routes the browser through the configured proxy. See proxy configuration in the API reference. |
-k, --api-key <key> | string | resolved config | Explicit API key. Overrides environment variables and the config file. |
-l, --log-level <level> | off | info | debug | off | Local file logging level. Files stay on your computer. Use --quiet to hide live terminal narration. |
-d, --debug | flag | off | Enables detailed local log files and retained screenshots. |
-j, --json | flag | off | Prints exactly one JSON object on stdout; every human-readable line goes to stderr. |
-q, --quiet | flag | off | Suppresses narration and progress output on stderr. |
To use a schema saved in books.json and print JSON output:
nodemantis retrieve "Read the book titles and prices." -u https://sandbox.nodemantis.com -s books.json -jStores credentials in the user config file, created with 0600 permissions. On an interactive terminal it prompts for anything not passed as a flag. See Configuration file for the file locations.
| Parameter | Type | Default | Description |
|---|---|---|---|
-k, --api-key <key> | string | prompted | API key to store in the config file. |
-a, --auth-token <token> | string | none | Auth token to store instead of an API key. |
-f, --config <path> | string | OS user config | Writes to this config file path instead of the platform default. |
Checks your configuration, runtime, and browser against a local test page, then verifies your API key with the hosted service and checks for updates. Reports problems with guidance for fixing them. It does not run an AI task. Use --offline to skip network checks.
| Parameter | Type | Default | Description |
|---|---|---|---|
-k, --api-key <key> | string | resolved config | Explicit API key to diagnose with. |
-j, --json | flag | off | Prints the diagnostic report as a single JSON object on stdout. |
--offline | flag | off | Skips hosted API and update checks without making network requests. |
-H, --headed | flag | headless | Shows the browser window during the local installation check. |
During a run, progress messages describe the agent's next action. These messages are written to stderr:
[1/20] The homepage has a Travel & Adventure category link in the main navigation; open it to compare relevant books. — click("Travel & Adventure")
[2/20] The Travel & Adventure catalogue shows four books and an unchecked In stock only filter. Enable it before sorting by price. — click("on")
[3/20] In stock only is checked, while Sort by remains Our shelf order. Select ascending price to identify the cheapest available book. — select("featured")
[4/20] In stock only is checked and Price: low to high is selected; apply these filters to obtain the cheapest available book. — click("Apply filters")
[5/20] retrieve
[6/20] done
Browser session closed.Final results are written to stdout. Progress stays on stderr so you can pipe results to another program while watching the run in your terminal. Use -q or --quiet to hide progress.
With --json, stdout carries exactly one JSON object: the result on success, or an {"error": {...}} envelope when the command fails. All human-readable output stays on stderr, so the command pipes cleanly:
nodemantis retrieve "Read this book's title and price in USD." \
--url https://sandbox.nodemantis.com/books/journey-to-the-center-of-the-earth \
--schema '{"type":"object","properties":{"title":{"type":"string"},"priceUsd":{"type":"number"}},"required":["title","priceUsd"],"additionalProperties":false}' --json | jq .status0— success: the task succeeded, the data was found, or every check passed.1— negative outcome: the task failed, the data was not found, a check failed, or an error occurred.2— usage or configuration error, such as an unknown flag or a missing required value.130— interrupted.
configure writes, and every command reads, a per-user JSON config file created with 0600 permissions:
- macOS:
~/Library/Application Support/nodemantis/config.json - Linux:
$XDG_CONFIG_HOME/nodemantis/config.json - Windows:
%APPDATA%\nodemantis\config.json
Set NODEMANTIS_CONFIG_FILE to override the location. The API key resolves in this order: --api-key, then NODEMANTIS_API_KEY, then NODEMANTIS_AUTH_TOKEN, then the config file.
