Before you start, you need:
- Linux or macOS, with Node.js 22 or later.
- A Tuner API key.
- The agent’s Agent Remote ID.
- Inbound or outbound simulation set up for the agent.
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 thetuner command.
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:
- Type it at the prompt.
- Pipe it in on stdin.
- Pass it with
--api-key, which stays in your shell history.
credentials.json, readable only by you:
For each value, the CLI uses the first one it finds, in this order:
- The flag (
--api-key,--agent,--base-url). - The environment variable.
- 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
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.
1 here because a Scenario failed. See Exit codes.
Choose what to run
Pass exactly one of--tag, --scenario or --suite.
--tagmatches the tag exactly, including case.--scenariotakes numeric Scenario IDs fromtuner 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 exit2.
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. --metaworks 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 matchinglist command to see the values.
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
--tagand--scenariotogether, an empty--tag, a bad--timeout, a bad--metapair, or--noise-intensitywithout--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.
- 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 withtuner 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.
- A call never connected, a platform error occurred, a call went unreported, or analysis failed.
--timeoutran 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.
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:
|| [ $? -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.
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 exit2. - The run shows its metadata on the Runs tab. See See which commit a run tested.
- The CLI prints one
Metadata:line on stderr, andtuner runs getprints the same line.
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.
NO_COLOR turns it off.
To branch on the exit code in a shell script:
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
No API key
No API key
The CLI found no key in
--api-key, TUNER_API_KEY or the stored credentials. Set TUNER_API_KEY, or run tuner auth login.No agent
No agent
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.Agent not found in this workspace
Agent not found in this 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.TUNER_WORKSPACE_ID doesn't match the key
TUNER_WORKSPACE_ID doesn't match the key
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 agent already has a run in progress
The agent already has a run in progress
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.The run couldn't test your agent (setup_error)
The run couldn't test your agent (setup_error)
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.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.