Skip to main content
Before you start, you need:

What is the Tuner CLI?

The Tuner CLI starts a simulation run for an agent and prints a verdict for each Scenario as it lands. It runs saved Scenarios from the Scenario Library, picked by tag, by ID or by suite.

Install

Install the package globally. It adds the tuner command.
To run it without installing, use npx @usetuner.ai/cli in place of tuner.

Set your credentials

The CLI reads the same variables as the SDK integrations. If your project already sends calls to Tuner with an SDK, run the CLI from that folder and there’s nothing else to set up. To run outside a project folder, store a key once:
The CLI checks the key with Tuner and prints the workspace it belongs to. You can give it the key in three ways:
  • Type it at the prompt.
  • Pipe it in on stdin.
  • Pass it with --api-key, which stays in your shell history.
The CLI stores the key in credentials.json, readable only by you: For each value, the CLI uses the first one it finds, in this order:
  1. The flag (--api-key, --agent, --base-url).
  2. The environment variable.
  3. For the key only, the key stored by tuner auth login.

Run your first simulation

1

Find a tag to run

Tag the Scenarios you want in the Scenario Library, then list them:
2

Start the run

The CLI prints the workspace and agent it resolved before it starts, so you can see where the calls go.
3

Read the results

Each Scenario’s verdict prints as it lands. When the run ends, the CLI prints a summary line and the dashboard URL.
The exit code is 1 here because a Scenario failed. See Exit codes.

Choose what to run

Pass exactly one of --tag, --scenario or --suite.
  • --tag matches the tag exactly, including case.
  • --scenario takes numeric Scenario IDs from tuner scenarios list. Duplicate IDs are rejected.
  • A tag with no Scenarios stops the command with an error that points to tuner scenarios list.
  • An empty --tag, for example from an unset shell variable, stops the command with exit 2.
A run holds up to 100 Scenarios, and a run of 40 is still one run with one run ID and one dashboard URL. Tuner starts the next call as each call ends. A tag or a list of IDs over 100 stops the command with an error.

Run a suite

Running a suite needs @usetuner.ai/cli 0.3.0 or later. Run a suite by name. To see the names, run tuner suites list.
  • The name matches ignoring case.
  • The run uses the suite’s Scenarios and run settings.
  • These flags can’t be combined with --suite, and the command stops before any call and names the flag: --tag, --scenario, --language, --profile, --noise, --noise-intensity.
  • --meta works with --suite. See Add run metadata.
tuner suites list prints each suite’s name and run settings. A suite whose test profile was deleted shows (deleted) as its profile. These problems stop the command before any call, with exit 2:

Set the language, noise and test profile

Each option takes a name. Run the matching list command to see the values.
Quote any name that contains spaces. An unknown name stops the command before any call starts. The error says which input didn’t resolve and which list command shows the valid values.

Read the results

Each line starts with the Scenario’s verdict. Verdicts the dashboard lists are linked to Call results.

Exit codes

The exit code tells a script what happened. When a run has more than one outcome, the worst one wins: 1, then 2, then 3, then 0.

Exit 1: a Scenario failed

At least one Scenario failed its evals. Open the run to see the failed evals. This includes a run that timed out after Tuner had already reported a failure.

Exit 2: fix your setup

The message says what to fix. These problems stop the command before it places any call:
  • A bad flag or value, such as --tag and --scenario together, an empty --tag, a bad --timeout, a bad --meta pair, or --noise-intensity without --noise.
  • No API key, or a key Tuner rejects, or a key from a different workspace than TUNER_WORKSPACE_ID.
  • No agent, or an agent, tag, Scenario, language, noise or test profile Tuner doesn’t know.
  • A tag with no Scenarios, or a run of more than 100 Scenarios.
  • A suite problem listed in Run a suite.
  • No credits left, or an agent that isn’t set up for simulation.
  • An agent that already has a run in progress.
Two problems appear after the run starts:
  • The run ends with a setup error: your own voice provider account is out of credits or quota.
  • The CLI loses access while it follows the run, for example because the key was revoked.

Exit 3: Tuner couldn’t finish

Tuner or the network stopped the run, so run the command again. If a run had started, check it with tuner runs get, because it may still be going. Before the run starts:
  • Tuner is unreachable after the CLI’s retries, or it returned a server error or rate-limited the requests.
  • Tuner couldn’t start the run.
  • The connection was lost after the start request, so a run may have started. The CLI prints the agent’s run in progress, if there is one.
After the run starts:
  • A call never connected, a platform error occurred, a call went unreported, or analysis failed.
  • --timeout ran out.
  • The run was canceled outside this command, in the dashboard or with tuner runs cancel.
  • Tuner stayed unreachable while the CLI followed the run.
An agent that never answered the call also exits 3, even though the cause may be yours. Check the Scenario’s message and the dashboard before you act on the code alone. To pass a pipeline step when only Tuner failed, accept exit 3:
Drop || [ $? -eq 3 ] to fail the step on 3 as well.

Cancel a run

The CLI cancels the run for you when you stop it or when it runs out of time. You can also cancel a run by ID. After a cancel, the CLI waits up to 10 seconds for the run to stop. The exit codes are in Exit codes. A second Ctrl-C or SIGTERM exits at once, and the run may keep going. The CLI prints the tuner runs get command to check it. --timeout takes a duration such as 90s, 30m or 1h30m. A bare number counts as seconds.

Cancel a run by ID

Use this for a run you started with --no-wait, or one a script left behind. It uses the same agent as tuner sim run: --agent, then TUNER_AGENT_ID.
The command exits 0 and prints one of three results, each followed by the dashboard URL: A replay run ID returns a not found error. See Canceled runs for what happens to the calls and to credits. To cancel a run when a CI job is canceled, see Cancel and time out.

Add run metadata

Pass --meta key=value to store metadata with the run. Repeat it for each pair.
  • The CLI splits each pair at the first =, so a value can contain =.
  • A pair without =, an empty key or a repeated key stops the command with exit 2.
  • The run shows its metadata on the Runs tab. See See which commit a run tested.
  • The CLI prints one Metadata: line on stderr, and tuner runs get prints the same line.
The GitHub Action sends commit, branch, pr_url and repo_url for you. For other CI tools, see Send the commit and branch.

Start a run and check it later

Pass --no-wait to print the run ID and dashboard URL, then exit 0 without waiting.
tuner runs get prints the run’s status, result and a line for each Scenario.

Use the results in scripts

Add --output json to print one JSON document to stdout. Everything else goes to stderr:
  • Progress, warnings and errors.
  • The per-Scenario lines.
  • The dashboard URL.
In text output, stdout holds only the Scenario lines and the summary. Color shows only in a terminal, and NO_COLOR turns it off. To branch on the exit code in a shell script:
The document carries schema_version: 1. Fields are only added within a version. The CLI package ships the full schema as schema/run-result.v1.json.

Commands and options

Every list command prints a table, or JSON with --output json. These options work on every command: These options apply to tuner sim run: These commands also need an agent, from --agent or TUNER_AGENT_ID: tuner runs get, tuner runs cancel, tuner scenarios list, tuner profiles list and tuner suites list. tuner sim run, tuner runs get, tuner runs cancel and every list command take --output.

Troubleshooting

The CLI found no key in --api-key, TUNER_API_KEY or the stored credentials. Set TUNER_API_KEY, or run tuner auth login.
The CLI found no agent. Pass --agent <agent-remote-id> or set TUNER_AGENT_ID. Run tuner agents list to see the agents in the workspace.
The key and the agent belong to different workspaces. Run tuner auth status to see the key’s workspace, then check the Agent Remote ID in API keys and IDs.
The CLI stops when TUNER_WORKSPACE_ID names a different workspace than the key. Fix the variable, or use a key from that workspace.
The CLI prints the run ID and its dashboard URL. Wait for that run to finish, or cancel it with tuner runs cancel <run-id>. See Cancel a run.
Your voice provider account, for example Retell or ElevenLabs, is out of credits or over its quota. Each affected Scenario shows setup error and the provider’s reason. Top up or raise the limit with your provider, then run the Scenarios again.
The CLI retries requests that fail on Tuner’s side or on the network, with growing waits. See Exit codes and Limits.

Limits

The CLI uses the public API. To start and read runs from your own code, see the Simulation group of the API Reference.

Next steps

Run statuses

What each run status and call result means, and how to fix runs that don’t complete.

GitHub Actions

Run the CLI on every pull request or merge, with a check, a comment and a job summary.