TestRelic AI
Go to App
CLI

TestRelic CLI quickstart

Log in, ask your first question, and learn the interactive basics — plus a pipes-friendly print-mode example for scripts and CI.

This walks you from a fresh install to your first answer in a couple of minutes. If you have not installed yet, see Installation.

The CLI needs a Growth plan or above

Step 1 below is a cloud sign-in, so before you start: the CLI needs a cloud subscription on Growth or above, in either the active or an unexpired trial state. An active 14-day trial unlocks the CLI whatever tier it sits on; once the trial ends, the plan has to carry it. Without one, your turns come back refused with PLAN_REQUIRED. See Plans & Billing.

Onboard (optional)

If you're wiring up a project for the first time, two commands get you set up:

# deterministic, keys-only — wires local config for the SDKs
testrelic setup --api-key tr_live_xxxxxxxx --mcp-token tr_mcp_xxxxxxxx

# agentic onboarding that inspects your project and detects the framework
testrelic init --framework playwright

setup takes your keys and writes local config (add --no-install to skip installing the SDK). init is the agentic path — pass --yes to accept defaults or --no-upload to configure without sending a run. The first run init makes doesn't wait on Playwright's HTML report, and if it's still going after 10 minutes the CLI stops it and tells you to run the command yourself to see where it waits. Already set up? Skip straight to logging in.

1. Log in

testrelic login

This opens your browser to approve the device (the terminal shows the link and a confirmation code), then saves a token to ~/.testrelic/token. For CI and scripts, save a token instead with testrelic login --token tr_mcp_… — see Authentication.

2. Ask your first question

Launch the interactive UI and type a question:

testrelic
❯ why did the nightly regress?
⏺ query_runs(suite: "nightly", window: "7d")
⎿ 142 runs · 3 newly failing
The nightly suite dropped to 94.2% pass rate after deploy #4891 …

Answers stream as markdown, tool calls show inline, and any artifact the agent produces (dashboards, reports, test plans) renders directly in your scrollback.

Terminal~/shop-e2e

$ testrelic login

Opening your browser to authorize this device…

https://platform.testrelic.ai/cli/authorize?code=WDJB-MJHT&port=51733

Confirmation code: WDJB-MJHT

Waiting for you to approve in the browser…

Approved.

Logged in as sam@acme.dev @ Acme

Token saved to /home/sam/.testrelic/token

3. Add context

  • Press @ to attach a repo, run, branch, test case, environment, suite, or tag as a context chip, fed from your org's data.
  • Press ! to run a local shell command; its output is attached to your next message.
❯ @checkout-repo @run:4891 summarize the new failures

4. Useful basics

  • Type / to open the slash-command menu (/artifacts, /resume, /export, /help, …). See Slash commands.
  • Press Ctrl+R to reverse-search your input history (persistent across sessions).
  • Press Esc to interrupt a streaming turn.

5. Print mode (scripts and CI)

For one-shot, pipe-friendly answers, use -p:

testrelic -p "which suite has the highest flake rate?"
tr -p "list newly failing tests on main" --output-format json

Artifacts render as ANSI on a terminal and as plain text when piped. See Artifacts & headless output for the output formats.

Next steps

Was this page helpful?

On this page