Infrastructure

Manage where your tests run — bring-your-own cloud machines, device grids, and CI pipelines — as a shared team resource instead of a per-laptop config file.

Infrastructure answers "where do my tests run?" — a question that now has a platform-level answer instead of a file on one person's laptop. It's the first item in the header nav after Test Runs, ahead of Monitoring.

Machines (AWS / Azure / GCP)
Grids (BrowserStack, TestMu AI)
CI (GitHub Actions, GitLab CI)
Placement decides where a run goes
Test run

Bring-your-own, still rolling out

Infrastructure is TestRelic-hosted compute's management plane, not TestRelic-hosted compute itself — there is no TestRelic-run fleet yet. Today it manages execution targets you already own: your own cloud accounts, your own device grid, or your own CI pipeline. Bring-your-own execution targets are a Pro-and-above entitlement and are rolling out gradually — if you don't see Infrastructure in your navigation, it may not be enabled for your organization yet.

Three kinds of execution target

Infrastructure treats these as genuinely different things, not variations on one "runner" concept — the console reflects that difference rather than papering over it:

Machines

Cloud compute you connect directly — AWS, Azure, or Google Cloud — that TestRelic provisions and tears down to run browser tests. Because TestRelic controls provisioning, capacity is a real number: how many machines are up right now.

Grids

Managed device/browser grids — BrowserStack and TestMu AI Cloud Farm — where the vendor hosts the browsers and TestRelic reports against their published concurrency.

CI

Your own GitHub Actions workflow or GitLab CI pipeline (including self-managed GitLab instances), used to run your whole suite rather than a specific browser instance. This is deliberately not treated as a machine or a grid:

  • Connecting a CI target provisions nothing — no compute is created on your behalf.
  • Capacity is reported as "parallelism decided by your workflow", not a number TestRelic invents.
  • Cost is your CI minutes, never estimated by TestRelic.
  • Disconnecting a CI target deletes nothing on your CI provider.

Before a GitHub Actions or GitLab CI target can be saved, TestRelic verifies the workflow or pipeline can actually be triggered — catching a misconfigured workflow (for example, one missing the required dispatch trigger) at connect time instead of failing every run later.

Connecting a target

From the Infrastructure console:

  1. Open the connect wizard and choose Machines, Grids, or CI.
  2. Provide the credentials or connection details for that target type — a cloud account, a grid API key, or a repository and CI provider.
  3. TestRelic verifies the connection before saving it.
  4. The target appears in your fleet, ready to be selected for runs.

Each connected target has a detail drawer with Overview, Activity, and Settings tabs, plus a Rules panel for controlling how and when it's used.

Run Ask AI sessions on your own runners

Ask AI can run a session on one of your Infrastructure targets instead of on your computer. The runner uses the TestRelic CLI (1.2.1 or later): it claims the session, clones the repository into a temporary directory, installs its dependencies, runs the Ask AI agent there, and can open a pull request with the result. You follow the agent's progress and replies in Ask AI while it runs, and can send it messages or stop it there.

To start one, open Remote in Ask AI, choose New Session, then A runner from Infrastructure ("Clones a repository onto a machine or CI runner, and runs the session there."). In the Run on infrastructure form:

  1. Pick the Repository and Branch, and the Git connection it comes From. The first time, Connect a provider with an access token:
    • GitHub: a fine-grained token with Contents (read and write) and Pull requests (read and write).
    • GitLab: a personal or project access token with the api and write_repository scopes.
    • Bitbucket: an app password (with your username) or a repository access token, with repository write and pull request write.
    • Azure Repos: a personal access token with Code (read and write).
  2. Choose the Runner. CI targets run on your CI minutes; machines show an estimated hourly cost.
  3. Describe What should the agent do? and choose Start session. Open a pull request when done is ticked by default; tick Stop the machine afterwards to stop a machine once the session ends.

The runner gets your Git credential only for this session and deletes the checkout when it ends.

Which targets can take a session. Connected GitHub Actions and GitLab CI targets, and AWS, Google Cloud and Azure machines that are running or stopped (a stopped machine starts on demand). Grids host browsers, not the CLI, so they aren't offered. A target that can't take a session says why, for example Not shared with you, Needs its credential reconnected, or No runner agent yet — machines created from now on include it. TestRelic Runners, managed by TestRelic, is listed as Coming soon. With no usable target, the form says "No runner can take a session yet. Connect GitHub Actions or GitLab CI, or add a machine, in Infrastructure."

GitHub Actions

Save this workflow as .github/workflows/testrelic-ai-session.yml on the repository's default branch, and on the branch you run sessions on if that's a different one. TestRelic starts it with workflow_dispatch, passing the input testrelic_session_id. The job proves who it is with a GitHub OIDC token (audience testrelic, which is why it needs id-token: write), so you don't store a TestRelic secret in the repository. TestRelic checks that the token's repository claim is the target's repository before handing out the session. If the workflow is missing, starting a session fails with a message that names the file and the branch.

.github/workflows/testrelic-ai-session.yml
# TestRelic Ask AI remote sessions — GitHub Actions runner.
#
# Save as .github/workflows/testrelic-ai-session.yml on the branch TestRelic
# dispatches to (the target's default branch). "Run on infrastructure" in the
# TestRelic web app starts it with `workflow_dispatch`; nobody runs it by hand.
#
# The job proves who it is with GitHub's OIDC token (audience `testrelic`,
# which is why `id-token: write` is required). TestRelic checks that the
# token's `repository` claim is the target's owner/repo before handing out the
# session, so no TestRelic secret is stored in this repository.
name: TestRelic AI session

on:
  workflow_dispatch:
    inputs:
      testrelic_session_id:
        description: TestRelic remote session id (set by TestRelic)
        required: true
        type: string

permissions:
  id-token: write
  contents: write
  pull-requests: write

concurrency:
  group: testrelic-ai-${{ inputs.testrelic_session_id }}
  cancel-in-progress: false

jobs:
  session:
    runs-on: ubuntu-latest
    # The session's own limit (maxDurationMinutes) ends it earlier; this is
    # the backstop GitHub enforces.
    timeout-minutes: 360
    steps:
      # Uncomment to pin the Node version your project needs (the runner image
      # already ships one). The session clones the repo itself — no checkout
      # step is needed.
      # - uses: actions/setup-node@v4
      #   with:
      #     node-version: 20

      - name: Install the TestRelic CLI
        run: |
          curl -fsSL https://testrelic.ai/install.sh | sh
          echo "$HOME/.testrelic/bin" >> "$GITHUB_PATH"

      # `testrelic`, not `tr`: on Linux /usr/bin/tr is coreutils.
      - name: Run the Ask AI session
        env:
          # Passed through env, never interpolated into the script.
          TESTRELIC_SESSION_ID: ${{ inputs.testrelic_session_id }}
        run: testrelic runner session --id "$TESTRELIC_SESSION_ID"

GitLab CI

Add this job to .gitlab-ci.yml itself. Before it starts a session, TestRelic reads .gitlab-ci.yml on the session's branch and refuses unless that file has a job that uses TESTRELIC_SESSION_ID, so a job pulled in with include: from another file isn't enough. TestRelic starts a pipeline with the variable TESTRELIC_SESSION_ID, and the job runs only when it's set. The job proves who it is with a GitLab ID token (aud: testrelic), and TestRelic checks that its project_path claim is the target's project. To keep your other jobs out of these pipelines, give each of them the rules shown in the comment.

.gitlab-ci.yml
# TestRelic Ask AI remote sessions — GitLab CI runner.
#
# Add this job to .gitlab-ci.yml. "Run on
# infrastructure" in the TestRelic web app starts a pipeline on the target ref
# with the variable TESTRELIC_SESSION_ID; this job runs only then.
#
# The job proves who it is with a GitLab ID token (`aud: testrelic`) that GitLab
# puts in TESTRELIC_ID_TOKEN. TestRelic checks that its `project_path` claim is
# the target's project before handing out the session, so no TestRelic secret is
# stored in this project.
#
# Keep your other jobs out of these pipelines by adding to each of them:
#   rules:
#     - if: $TESTRELIC_SESSION_ID
#       when: never
#     - when: on_success   # (or your existing rules)

testrelic-ai-session:
  # Any image with git, curl and your toolchain. Running as root lets the
  # session install Playwright's browser system dependencies.
  image: node:20-bookworm
  rules:
    - if: $TESTRELIC_SESSION_ID
  # The session's own limit (maxDurationMinutes) ends it earlier; this is the
  # backstop GitLab enforces.
  timeout: 6h
  id_tokens:
    TESTRELIC_ID_TOKEN:
      aud: testrelic
  script:
    - curl -fsSL https://testrelic.ai/install.sh | sh
    - export PATH="$HOME/.testrelic/bin:$PATH"
    # `testrelic`, not `tr`: on Linux /usr/bin/tr is coreutils.
    - testrelic runner session --id "$TESTRELIC_SESSION_ID"

Cloud machines

Machines TestRelic creates come with the runner agent: their boot script installs the CLI and runs testrelic runner daemon --target <target-id> --base-url https://platform.testrelic.ai/api/v1 as a service. On first start the daemon enrolls the machine, and TestRelic accepts the enrollment only from the target's recorded public IPs. The daemon keeps its machine token in /var/lib/testrelic/machine-token (mode 600), or in %PROGRAMDATA%\TestRelic\machine-token on Windows, pulls sessions and runs them one at a time. The machine opens no inbound port for it. If TestRelic revokes the machine token, the daemon enrolls the machine again. A machine created before runner sessions existed shows No runner agent yet.

What a session does

  1. Clone: a shallow clone (--depth 50) of the session's branch into a new temporary directory. The Git credential is issued for this session only. It reaches git through the git process's environment, is never written to disk or passed on a command line, and is removed from every log line.
  2. Install: dependencies with the package manager the lockfile names (pnpm install --frozen-lockfile, yarn install --immutable or npm ci), npm install when there's no lockfile, and pip install -r requirements.txt for Python. When Playwright is a dependency, it also runs playwright install --with-deps chromium. A failed install doesn't end the session, and the agent can see what failed.
  3. Agent: the Ask AI agent runs in the checkout, starting from your task. Messages you send from Ask AI run as further turns. The session ends when you stop it, when it has been idle too long, or when it reaches its maximum duration.
  4. Pull request (optional): if the checkout has changes, the runner commits them, pushes testrelic/ai-<first 8 characters of the session id>, and TestRelic opens the pull request or merge request.

The runner always reports the end of the session, failures included, and deletes the checkout. On Linux, the CLI command is testrelic, not tr (/usr/bin/tr is coreutils).

The session's owner can also run a session by hand on any machine: sign in with testrelic login (or set TESTRELIC_TOKEN=tr_mcp_…), then run testrelic runner session --id <session-id>.

Credentials and placement

  • Credentials are stored encrypted, in a store separate from the target's own record — no API response ever returns a credential, only whether one is configured.
  • Placement — which target a given run actually uses — is decided server-side and recorded on the run, so "where did this run go, and why" has one authoritative answer instead of depending on whichever machine happened to pick it up.
  • Tearing down a machine only removes resources TestRelic's own record confirms it created — a target's teardown can't reach resources it doesn't recognize as its own.

Why this replaced the per-laptop config

Before Infrastructure, an execution target lived in a local config file and that machine's keychain. In practice, that meant a team could end up connecting the same cloud account multiple times — once per person who set it up — and a runner would silently stop working the day the person who configured it left. Infrastructure makes the target, its credentials, and its rules a property of the workspace, not any one laptop.

Was this page helpful?

On this page