Why the CLI is CI-friendly
Thetestsprite CLI is designed from the ground up for unattended execution:
- Non-interactive auth — set
TESTSPRITE_API_KEYas a secret; the CLI never prompts when the variable is present. - Stable
--output json— every command emits a machine-readable JSON envelope that your pipeline can parse and forward. - Stable exit codes — exit 0 means the run passed; any non-zero exit lets the shell fail the job. No text scraping required.
Authenticating in CI
Set your API key as a repository or environment secret. In GitHub, go to Settings → Secrets and variables → Actions and click New repository secret:
TESTSPRITE_API_KEY before the credentials file, so no testsprite auth configure step is needed in CI.
In most pipelines the env var alone is enough — you don’t need to run any auth command. If you do need a credentials file on disk (for other tooling), write one non-interactively from the same env var:
TESTSPRITE_API_KEY from the environment and write ~/.testsprite/credentials; init also verifies the key and prints an identity summary.
Gating on the result
The CLI exits non-zero whenever a run does not pass — failed, blocked, cancelled, or timed out. Your shell or CI runner treats that as a job failure automatically.A GitHub Actions workflow
The example below runs all backend tests in a project on every pull request and fails the job if any test does not pass:Parsing JSON output
Pipe--output json to jq to extract fields for downstream steps:
run object contains status, runId, startedAt, finishedAt, codeVersion, and dashboardUrl (when the backend returns a portal link).
Rate limits and retries
The server caps run-triggers at 60 per minute per key. The CLI throttles itself to 50 per minute and automatically retriesRATE_LIMITED responses, honoring the Retry-After header (capped at 3 retries).
For large batches, tune the in-flight concurrency:
--idempotency-key to make retries safe — if the server already accepted the request with that key, it returns the original response instead of triggering a duplicate run:
Handling exit codes
The exit code is your primary signal. Two codes deserve special handling in a pipeline:| Code | Meaning | Recommended action |
|---|---|---|
11 | Rate limited | Honor Retry-After; the CLI retries automatically, but if you hit it outside a run command, back off and retry |
12 | Insufficient credits | Non-retriable — top up your balance before re-queuing the job |
Exit Codes
The complete exit-code table
Where to Go Next
Coding Agent Integration
Let your agent drive the verification loop without a human in the middle
Running Tests
All flags and modes for triggering and waiting on runs
Exit Codes
Full exit-code table for branching your pipeline
Configuration
Env vars, profiles, and per-request timeouts