Skip to main content

Agnox CLI

agnox brings Agnox to your terminal and CI pipelines. Use it to list runs, print the failures of a run, trigger a run and wait for its result, upload JUnit XML or Allure results from any test framework, gate a release on the Release Readiness Gate, audit the tests in a pull request with the PR Test Auditor, and export manual test cases as Playwright spec skeletons.

It ships in the same npm package as the MCP server, talks only to the Public API v1, and needs Node.js 20 or later.

Two packages, two jobs. @agnox/agnox-cli (npx @agnox/agnox-cli@latest init / push) only scaffolds and pushes the Docker image for Hosted test runs. Everything on this page, the agnox command for the API and the MCP server, comes from @agnox/mcp-server. If you report runs from your own CI with the Playwright reporter, you don't need @agnox/agnox-cli at all.


Installation​

Run it with npx, without installing. Every command runs straight from the package:

npx -y @agnox/mcp-server@latest --help

Or install it globally:

npm install -g @agnox/mcp-server
agnox --help

Or add it to a project, so CI uses a pinned version:

npm install -D @agnox/mcp-server
npx agnox --help

The package name is @agnox/mcp-server and the installed command is agnox. With npx, a CLI command such as setup, runs or login after the package name runs the CLI; with no command, the package starts the MCP server.

Help for one command​

Every command, command group and subcommand takes --help or -h:

agnox audit pr --help
agnox gate check -h
agnox report upload --help
npx -y @agnox/mcp-server@latest skill install --help

It prints the usage line, every option with its default and the environment variable it falls back to, the exit codes and a few examples, then exits 0. It needs no API key. A group such as agnox report --help lists its subcommands, and agnox help <command> prints the same text. When an option is not recognised, the error names the command's help, for example Run agnox gate check --help. Help needs @agnox/mcp-server 2.4.1 or later; earlier versions answered subcommand help with Unknown option '--help'.

Configuration​

The CLI uses three settings:

VariableRequiredDefaultPurpose
AGNOX_API_KEYYesAPI key from Settings → My Profile → API keys
AGNOX_API_URLNohttps://api.agnox.devThe Agnox API host, for a self-hosted install (https:// only, except for localhost). Not the dashboard URL. A trailing /api, /api/v1 or /api/executions/ingest is removed.
AGNOX_PROJECT_IDNoDefault project, used when --project is omitted

They are read from these places, in this order:

  1. Environment variables, which always win.
  2. A .env file in the current directory. Only the three names above are read, and nothing in your environment is overridden.
  3. Credentials saved by agnox login.

Log in once​

npx -y @agnox/mcp-server@latest login
# Agnox API key: ********************
# Logged in to api.agnox.dev (3 projects). Saved to /home/you/.agnox/config.json

In a terminal, login prompts for the key without echoing it. In a script, or in a terminal that can't prompt (Git Bash / mintty), pass it with --api-key "<your key>". agnox login checks the key against the API first and saves nothing if the key is rejected. For a self-hosted install, add --api-url https://agnox.example.com. The file is created readable by your user only (mode 0600 on macOS and Linux). Delete ~/.agnox/config.json to log out.

Or use a .env file​

# .env in your project (keep it out of git)
AGNOX_API_KEY=<your key>
AGNOX_PROJECT_ID=<project id>

Key and URL stay together. An AGNOX_API_URL from .env is used only together with the AGNOX_API_KEY from the same file. A key from your environment or from agnox login is never sent to a URL that a .env file supplies. This way, a .env in a repository you cloned can't redirect your key to another server. The CLI prints a notice when it ignores such a URL.

Results go to stdout and diagnostics to stderr, so you can pipe --json output into jq safely.


Commands​

CommandDescription
agnox runs listTable of recent runs
agnox runs failures <taskId>Failed tests of one run
agnox triggerStart a hosted run, and optionally wait for it to finish
agnox report uploadUpload JUnit XML or Allure results as a run
agnox gate checkRelease Readiness Gate: READY, REVIEW_REQUIRED or BLOCKED for CI
agnox audit prPR Test Auditor: flags focused or skipped tests, hard waits, forced clicks and weakened assertions in a pull request diff (no API key needed)
agnox export-specsWrite Playwright skeletons for manual test cases
agnox setupLog in, pick a project, and configure Claude Code, VS Code, Copilot CLI and Cursor for this repository
agnox doctorCheck the key, project, MCP config files and a live MCP handshake
agnox loginCheck an API key and save it in ~/.agnox/config.json
agnox skill install, agnox skill printInstall (or print) the Agnox Quality skill for Claude Code, Cursor or Codex
agnox mcpRun the MCP server on stdio
agnox --help, agnox --versionEvery command, and the version
agnox <command> [<subcommand>] --helpOptions, defaults, environment variables, exit codes and examples of one command (-h works too). See Help for one command

Every command also runs through npx without installing, for example npx -y @agnox/mcp-server@latest report upload junit.xml or npx -y @agnox/mcp-server@latest skill install: the command runs and exits. Run without a command, the package starts the MCP server instead (that is how MCP clients launch it).

agnox setup​

Connects the current repository and your AI coding assistants to Agnox in one step: logs in, picks a project, writes the MCP config for Claude Code, VS Code Copilot, Copilot CLI and Cursor, optionally adds an Agnox section to .github/copilot-instructions.md and CLAUDE.md, then runs doctor.

npx -y @agnox/mcp-server@latest setup [--project <id>] [--api-key <key>] [--api-url <url>]
[--clients mcp-json,cursor,vscode,copilot-cli]
[--instructions copilot,claude|none] [--non-interactive]
OptionDescription
--project <id>Project to connect. Without it, the projects your key can see are listed (the only one is picked automatically).
--api-key <key>Use and save this key. Without it, a working key from the environment, .env or agnox login is reused, or you're prompted (masked).
--api-url <url>A self-hosted Agnox API
--clients <list>Files to write: mcp-json (.mcp.json, alias claude), cursor (.cursor/mcp.json), vscode (.vscode/mcp.json), copilot-cli (~/.copilot/mcp-config.json). Interactive default: .mcp.json, plus Cursor when .cursor/ exists.
--instructions <list>Add the Agnox section to copilot (.github/copilot-instructions.md), claude (CLAUDE.md), or none
--non-interactiveNever prompt. Writes only .mcp.json unless --clients says otherwise.

Only the agnox entry of each file is added or replaced; other servers and settings are kept. API keys are never written to repository files. A file with comments or trailing commas, or invalid JSON, is left untouched and the entry to paste is printed instead. Exit code 1 if any check fails or a file was left untouched. See the MCP Quickstart for the full walkthrough.

agnox doctor​

npx -y @agnox/mcp-server@latest doctor [--project <id>]

Checks, in order:

CheckPasses when
API keyA key is found (environment, .env or agnox login) and the API accepts it
Project--project, AGNOX_PROJECT_ID or the project in .mcp.json is visible to the key
Config filesEach of .mcp.json, .cursor/mcp.json, .vscode/mcp.json and ~/.copilot/mcp-config.json that exists parses (JSONC is fine), has a valid agnox entry for that client's schema, and no repository file holds an API key
MCP handshakeThe server answers initialize and lists all 14 tools over stdio

Each problem prints a one-line fix. Exit code 0 when nothing fails, 1 otherwise.

agnox runs list​

agnox runs list [--project <id>] [--status <s>] [--source <s>] [--group <name>] [--limit <n>] [--json]

Prints recent runs, newest first, with task id, name (the CI job or shard, when the run has one), status, source, start time, duration and passed/failed counts.

OptionDescription
--project <id>Project to list (default AGNOX_PROJECT_ID, else every project)
--status <s>Comma-separated filter: PENDING, RUNNING, PASSED, FAILED, ERROR, UNSTABLE
--group <name>Only runs of this run group, e.g. every job of one CI workflow run ("E2E #42")
--limit <n>How many runs to show (default 25; the API caps this at 100)
--jsonPrint the API data as JSON
agnox runs list --status FAILED --limit 5
agnox runs list --group "E2E #42" --status FAILED

agnox runs failures​

agnox runs failures <taskId> [--json]

Prints one block per failed test: name, spec file, failure signature and the first lines of the error. With --json, it prints the full failure data, including the page context captured at the moment of failure.

agnox runs failures run-k3j2

agnox trigger​

agnox trigger --image <img> --command <cmd> --env <development|qa|staging|production>
[--project <id>] [--base-url <url>] [--folder <path>]
[--wait] [--timeout <sec>] [--json]

Starts a run on Agnox's hosted runners.

OptionDescription
--image <img>Required. Docker image that contains your tests
--command <cmd>Required. Command that runs them, for example npx playwright test
--env <env>Required. development, qa, staging or production
--project <id>Project to run in (default AGNOX_PROJECT_ID)
--base-url <url>Base URL of the application under test
--folder <path>Test folder to run (default: all tests)
--waitPoll every 5 seconds until the run finishes, then exit with its result
--timeout <sec>Give up waiting after this many seconds (default 1800)
--jsonPrint the started run, or with --wait the finished run, as JSON
agnox trigger --image ghcr.io/acme/e2e:latest \
--command "npx playwright test" --env staging --wait
# Started run run-k3j2; waiting for it to finish…
# Run run-k3j2 PASSED — 120 passed, 0 failed in 4m 10s

agnox report upload​

agnox report upload <file|dir|archive.zip>... [--format junit|allure|auto] [--project <id>]
[--branch <name>] [--commit-sha <sha>] [--repository <owner/repo>] [--pr <n>]
[--run-url <url>] [--ci github|gitlab|azure|bitbucket|jenkins] [--no-ci-detect]
[--tool <name>] [--env <environment>] [--group <name>] [--local] [--run-name <name>]
[--create-cycle | --cycle <id>] [--fail-on-failure] [--json]

Records the results of any test framework (Maestro, Pytest, Selenium, WebdriverIO, Jest, JUnit/TestNG and more) as one finished run, from the JUnit XML or Allure results it writes. Each path is a file, a directory (searched recursively) or a .zip archive. The format is detected unless you pass --format. Git details (branch, commit, repository, pull request, job link) are read from GitHub Actions, GitLab CI, Azure Pipelines, Bitbucket Pipelines and Jenkins variables; flags override them. In GitHub Actions the run is grouped with the other jobs of the same workflow run (--group, else AGNOX_GROUP_NAME, overrides it), and --env (default AGNOX_ENVIRONMENT, else production) accepts development, qa, staging and production.

Upload each device or platform as its own run, so Android and iOS results are counted separately and still appear as one group:

agnox report upload android/report.xml --tool maestro --run-name Android --env qa
agnox report upload ios/report.xml --tool maestro --run-name iOS --env qa
agnox report upload target/surefire-reports --tool junit5 --branch main --commit-sha "$GIT_COMMIT"
# Uploading 12 report files (84 KB)…
# Run report-1764496800000-1a2b3c4d FAILED — JUnit XML: 148 tests, 145 passed, 2 failed, 1 skipped, 3 flaky in 4m 12s

From an allure-results directory only *-result.json and *-container.json are sent, never attachments. Every option, the supported report fields and CI examples are on JUnit XML & Allure Report Ingestion.

agnox export-specs​

agnox export-specs --out <dir> [--project <id>] [--folder <path>] [--force]

Exports the project's manual test cases as Playwright spec skeletons, one file per top-level folder (for example, a Checkout folder becomes checkout.spec.ts). Cases outside any folder go to root.spec.ts. Automated test cases are skipped, because they already have a spec.

OptionDescription
--out <dir>Required. Directory to write into. It is created if missing.
--project <id>Project to export (default AGNOX_PROJECT_ID)
--folder <path>Export only this folder, for example /Checkout
--forceOverwrite existing files. Without it, nothing is written if any target file exists.

Safety rules: only flat, lower-case *.spec.ts names are written (at most 500 files, 5 MB each), nothing is written outside --out, and symbolic links are never written through.

See Migrate & export test cases for what a generated file looks like.

agnox gate check​

The Release Readiness Gate for a pipeline: it prints the project's verdict (READY, REVIEW_REQUIRED or BLOCKED), each check, and the blocking failures, then exits with a code your CI can act on. Local runs never count.

agnox gate check --group "E2E #42" --env staging
agnox gate check --commit "$GITHUB_SHA" --fail-on-review --format markdown >> "$GITHUB_STEP_SUMMARY"
OptionDescription
--project <id>Project (default AGNOX_PROJECT_ID)
--branch <name>, --commit <sha>, --env <environment>, --group <name>Scope: only runs of this branch, commit (SHA or a prefix of at least 4 characters), environment or run group. Without --commit or --group, the latest run's group (or commit) is evaluated
--fail-on-reviewExit 1 on REVIEW_REQUIRED too
--format text|json|markdowntext (default), the full API response as json, or a markdown summary table for $GITHUB_STEP_SUMMARY or a pull request comment

Exit codes: 0 READY (and REVIEW_REQUIRED without --fail-on-review), 1 BLOCKED (or REVIEW_REQUIRED with --fail-on-review), 2 a usage, configuration or network error. Only the verdict goes to stdout.

agnox audit pr​

The PR Test Auditor: it reads the diff of a pull request and reports what weakens the tests: .only, new skips, hard waits, { force: true }, removed assertions and empty catch blocks in Playwright/JS/TS tests and Maestro flows, plus source changes without test changes. It's deterministic and needs no API key.

agnox audit pr # origin/main to the working tree, untracked files included
agnox audit pr --base "origin/$BASE_REF" --head HEAD --format github
agnox audit pr --staged --fail-on warn
agnox audit pr --diff-file pr.diff --format json
OptionDescription
--base <ref>Branch the pull request targets (default origin/main)
--head <ref>Audit base...head. Without it, the merge base is compared with the working tree
--stagedAudit only the staged changes
--diff-file <path>Audit a unified diff file instead of reading git
--fail-on error|warn|neverLowest severity that exits 1 (default error)
--format text|json|markdown|githubtext (default), the report as json, a markdown table for $GITHUB_STEP_SUMMARY, or github workflow commands for inline pull request annotations
--ignore-missing-testsTurn off the missing-test-updates rule, for example in a repository that holds only tests
--error-on-skipsReport new skips as errors
--project <id>With AGNOX_API_KEY: note changed test files whose tests are quarantined or unstable in Agnox (default AGNOX_PROJECT_ID). Informational; an unreachable Agnox never fails the audit

Exit codes: 0 pass, 1 a finding at or above --fail-on, 2 a git, usage or configuration error (for example a shallow clone without the base branch). Suppress a reviewed finding in the code with // agnox-audit-ignore <ruleId>: <reason>; the reason is required. See PR Test Auditor for every rule.

agnox skill​

Installs the Agnox Quality skill: the failure investigation workflow and guardrails for your coding agent.

agnox skill install # .claude/skills/agnox-quality/SKILL.md (Claude Code)
agnox skill install --target cursor,codex # .cursor/rules/agnox-quality.mdc and a block in AGENTS.md
agnox skill print --target cursor # print instead of writing
OptionDescription
--target <list>claude (default), cursor, codex, or all, comma-separated
--dir <path>Install below this directory instead of the current one

Running it again replaces the skill in place. In AGENTS.md, only the block between <!-- agnox-skill:start --> and <!-- agnox-skill:end --> changes. Symbolic links are never written through.

agnox mcp​

Runs the MCP server on stdio. It takes no arguments and is configured through the same environment variables.


Exit codes​

CodeMeaning
0Success. With trigger --wait, the run finished as PASSED. A report upload was recorded (whatever its result, unless --fail-on-failure).
1API error, usage error, missing configuration, an invalid report, or a trigger --wait timeout
2trigger --wait: the run finished but didn't pass (FAILED, ERROR or UNSTABLE). report upload --fail-on-failure: the uploaded run failed.

Code 2 lets a pipeline tell "the tests failed" apart from "the pipeline couldn't reach Agnox".

agnox gate check has its own codes: 0 ready, 1 blocked, 2 any error (see agnox gate check), so a gate that can't reach Agnox never reads as a blocked release. agnox audit pr likewise: 0 pass, 1 findings, 2 any error (see agnox audit pr).

Use in CI​

GitHub Actions​

- name: Run E2E suite on Agnox
run: npx -y @agnox/mcp-server@latest trigger --image ghcr.io/acme/e2e:latest --command "npx playwright test" --env staging --wait
env:
AGNOX_API_KEY: ${{ secrets.AGNOX_API_KEY }}
AGNOX_PROJECT_ID: ${{ vars.AGNOX_PROJECT_ID }}

The job fails when the run fails, because agnox exits with code 2.

GitLab CI​

e2e:
image: node:22
script:
- npx -y @agnox/mcp-server@latest trigger --image $E2E_IMAGE --command "npx playwright test" --env staging --wait --timeout 3600
variables:
AGNOX_PROJECT_ID: "665f…"
# AGNOX_API_KEY comes from a masked CI/CD variable

Upload JUnit XML or Allure results​

- name: Upload test results to Agnox
if: always()
run: npx -y @agnox/mcp-server@latest report upload build/test-results --tool pytest
env:
AGNOX_API_KEY: ${{ secrets.AGNOX_API_KEY }}
AGNOX_PROJECT_ID: ${{ vars.AGNOX_PROJECT_ID }}

Gate a release​

- name: Release readiness gate
run: npx -y @agnox/mcp-server@latest gate check --group "${{ github.workflow }} #${{ github.run_number }}" --format markdown >> "$GITHUB_STEP_SUMMARY"
env:
AGNOX_API_KEY: ${{ secrets.AGNOX_API_KEY }}
AGNOX_PROJECT_ID: ${{ vars.AGNOX_PROJECT_ID }}

The step fails when the release is BLOCKED, and the job summary shows the checks and blocking failures. See Release Readiness Gate.

Audit the tests in a pull request​

- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: PR test audit
run: npx -y @agnox/mcp-server@latest audit pr --base "origin/$BASE_REF" --head HEAD --format github
env:
BASE_REF: ${{ github.base_ref }}

Errors and warnings appear as annotations on the changed lines, and the step fails on errors. See PR Test Auditor for the full workflow with a job summary.

Treat a failed run differently from an outage​

set +e
agnox trigger --image "$IMAGE" --command "npx playwright test" --env staging --wait
code=$?
set -e
if [ "$code" -eq 2 ]; then echo "Tests failed"; exit 1; fi
if [ "$code" -ne 0 ]; then echo "Could not reach Agnox, skipping the gate"; exit 0; fi