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.

Install

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

npm install -g node-mantis

# Run without a global installation
npx node-mantis doctor

Python package

python -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 doctor

Homebrew

brew install node-mantis/tap/nodemantis

Quickstart

Have 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

CLI commands

CommandDescriptionExample
runRun a browser task from a prompt.nodemantis run "Go to sandbox.nodemantis.com and find travel books."
retrieveRead data from a specified page.nodemantis retrieve "Read the book titles." -u https://sandbox.nodemantis.com
configureSave your API key and proxy configuration.nodemantis configure
doctorCheck your installation, browser, and service connection.nodemantis doctor

CLI flags

Flags are grouped by the command that accepts them.

Help and version

FlagDescriptionExample
-h, --helpShow CLI help, or the options for a specific command.nodemantis --help
nodemantis run -h
-V, --versionPrint the installed CLI version and exit. Use it without a subcommand.nodemantis -V

nodemantis run

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
ParameterTypeDefaultDescription
-u, --url <url>stringnonePage to open before the agent starts working on the goal.
-s, --schema <file|json>stringfree-formJSON Schema for a typed result — a path to a schema file or an inline JSON string.
-e, --effort <level>stringmediumEffort level: low, medium (default), high, or xhigh. Controls the model combinations used for the task.
-n, --max-iterations <n>number30Maximum perception-and-action iterations before the run stops.
-t, --timeout-ms <ms>number300000 (5 minutes)Overall operation timeout in milliseconds.
-c, --max-cost <usd>numberno ceilingUSD budget checked between iterations. The final iteration can take total spend above this amount.
--secrets <names>stringnoneComma-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, --headedflagheadlessShows the browser window. Runs are headless unless this flag is set.
-v, --viewport <WxH>stringChrome window sizeBrowser viewport size, for example 1440x900.
-P, --use-proxyflagoffRoutes the browser through the configured proxy. See proxy configuration in the API reference.
-k, --api-key <key>stringresolved configExplicit API key. Overrides environment variables and the config file.
-l, --log-level <level>off | info | debugoffLocal file logging level. Files stay on your computer. Use --quiet to hide live terminal narration.
-d, --debugflagoffEnables detailed local log files and retained screenshots.
-j, --jsonflagoffPrints exactly one JSON object on stdout; every human-readable line goes to stderr.
-q, --quietflagoffSuppresses narration and progress output on stderr.

nodemantis retrieve

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}'
ParameterTypeDefaultDescription
-u, --url <url>stringrequiredPage to open and retrieve from. retrieve fails without it.
-s, --schema <file|json>stringfree-formJSON Schema for the result shape — a path to a schema file or an inline JSON string.
-e, --effort <level>stringmediumEffort level: low, medium (default), high, or xhigh. Higher effort can improve interpretation and cost more.
-H, --headedflagheadlessShows the browser window. Runs are headless unless this flag is set.
-v, --viewport <WxH>stringChrome window sizeBrowser viewport size, for example 1440x900.
-P, --use-proxyflagoffRoutes the browser through the configured proxy. See proxy configuration in the API reference.
-k, --api-key <key>stringresolved configExplicit API key. Overrides environment variables and the config file.
-l, --log-level <level>off | info | debugoffLocal file logging level. Files stay on your computer. Use --quiet to hide live terminal narration.
-d, --debugflagoffEnables detailed local log files and retained screenshots.
-j, --jsonflagoffPrints exactly one JSON object on stdout; every human-readable line goes to stderr.
-q, --quietflagoffSuppresses 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 -j

nodemantis configure

Stores 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.

ParameterTypeDefaultDescription
-k, --api-key <key>stringpromptedAPI key to store in the config file.
-a, --auth-token <token>stringnoneAuth token to store instead of an API key.
-f, --config <path>stringOS user configWrites to this config file path instead of the platform default.

nodemantis doctor

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.

ParameterTypeDefaultDescription
-k, --api-key <key>stringresolved configExplicit API key to diagnose with.
-j, --jsonflagoffPrints the diagnostic report as a single JSON object on stdout.
--offlineflagoffSkips hosted API and update checks without making network requests.
-H, --headedflagheadlessShows the browser window during the local installation check.

Live narration

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.

JSON output

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 .status

Exit codes

  • 0 — 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.

Configuration file

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.