Skip to main content

Prerequisites

  • Node.js 18 or later
  • An AI provider API key (Anthropic recommended)

Install

AI provider setup

Set your AI provider API key. Anthropic is the default:
Refrain supports 7 AI providers (OpenAI, Google, Azure, Bedrock, Vertex, and OpenAI-compatible endpoints). See Set up your AI provider for full setup instructions and environment variables.

Step 1: Prepare context and secrets

Before generating a runbook, you can optionally create: context.md — supplementary information about the target app (login URL, navigation hints, special UI patterns, etc.):
secrets.json — credentials and sensitive values when needed. All values are treated as sensitive:

Step 2: Generate a runbook

Tell AI what you want to accomplish, and it will explore your web app and build a runbook.
Use --headless false to watch the AI explore your app in real time. Remove it for headless execution.
You can set default model and provider via environment variables instead of passing --model and --model-provider on every command. See default model configuration.
AI will:
  1. Open the browser and navigate to the URL
  2. Explore the page, deciding which actions to take
  3. Record each step (clicks, inputs, navigations)
  4. Review the steps and remove unnecessary ones
  5. Output a clean runbook

Step 3: Execute the runbook

Run the generated runbook:
The execute command resolves selectors deterministically — no AI tokens are consumed on reruns (except when fallback features are triggered). Whether you run it once or a hundred times, the cost stays at zero.
  1. Open the browser and navigate to the starting URL
  2. For each step, resolve the selector to find the target element
  3. Execute the action (click, input, etc.)
  4. Report the results

Step 4: Self-heal when UIs change

When the target app’s UI changes and steps start failing, use --self-heal to let AI diagnose and suggest fixes:
Self-heal mode enables aggressive retry strategies, AI-powered repair suggestions, and a diagnostic report. Review the suggestions, then apply them with the fix-runbook command:
With the Web Console, you can generate, execute, schedule, and self-heal runbooks from a browser UI — no CLI required.

What’s next?

Generate command

All options for runbook generation.

Execute command

All options for runbook execution.

CLI overview

See all available commands.

Plan tiers

Unlock advanced features with Pro, Team, or Business.