Skip to main content

Synopsis

npx @refrainai/cli generate -- \
  --url <url> \
  --goal <goal> \
  --output <path> \
  [options]
AI opens a browser, explores the target web app to accomplish the given goal, records each action, reviews the steps, and outputs a clean runbook.

Required arguments

ArgumentDescription
--url <url>Starting URL to begin exploration
--goal <goal>Goal to accomplish (natural language description)
--output <path>Output path for the generated runbook

Optional arguments

Exploration

ArgumentDefaultDescription
--max-iterations <num>20Maximum exploration loop iterations
--step-delay <ms>500Wait time between steps (milliseconds)
--headless <bool>trueSet to false to show the browser window

Context & secrets

ArgumentDefaultDescription
--context <path>-Path to a supplemental context markdown file
--secrets <path>-Path to secrets JSON file ({"key": "value"} format, all values treated as sensitive)

Output & debugging

ArgumentDefaultDescription
--screenshots <dir>-Directory to save screenshots
--video <dir>-Directory for video recording output

AI model

ArgumentDefaultDescription
--model <id>claude-sonnet-4-6AI model ID
--model-provider <provider>anthropicAI provider: anthropic, openai, openai-compatible, google, azure, bedrock, vertex
--model-base-url <url>-Base URL for OpenAI-compatible endpoints

Advanced

ArgumentDefaultDescription
--locale <code>enUI and AI prompt language: en or ja
--stealthfalseEnable stealth mode (bot detection evasion)
--proxy <url>-Proxy URL (e.g., http://user:pass@host:port)
--skill <names>-Comma-separated skill plugin names (e.g., google-sheets)
--stealth and --proxy require Pro plan or higher. --skill requires Pro plan or higher.

Examples

Basic generation

npx @refrainai/cli generate -- \
  --url "https://app.example.com/login" \
  --goal "Log in with email and password, then navigate to the settings page" \
  --output ./login-settings.yaml \
  --context ./context.md \
  --secrets ./secrets.json \
  --model "claude-sonnet-4-6" \
  --model-provider anthropic
Set default model and provider via environment variables instead of passing them on every command. See default model configuration.

With browser visible

npx @refrainai/cli generate -- \
  --url "https://staging.example.com" \
  --goal "Create a new project named 'Test Project'" \
  --output ./create-project.yaml \
  --headless false

With context file

Provide additional context to help AI understand your app:
npx @refrainai/cli generate -- \
  --url "https://app.example.com" \
  --goal "Export the monthly report as CSV" \
  --output ./export-report.yaml \
  --context ./app-guide.md

With secrets

npx @refrainai/cli generate -- \
  --url "https://app.example.com/login" \
  --goal "Log in and view the dashboard" \
  --output ./login.yaml \
  --secrets ./secrets.json
Where secrets.json:
{
  "email": "[email protected]",
  "password": "s3cret!"
}

Using OpenAI

export OPENAI_API_KEY="sk-..."

npx @refrainai/cli generate -- \
  --url "https://app.example.com" \
  --goal "Fill out the contact form" \
  --output ./contact-form.yaml \
  --model "gpt-4o" \
  --model-provider openai

With screenshots and video

npx @refrainai/cli generate -- \
  --url "https://app.example.com" \
  --goal "Complete the onboarding flow" \
  --output ./onboarding.yaml \
  --screenshots ./screenshots \
  --video ./videos

Environment variables

VariableDescription
AI_MODEL_IDDefault for --model
AI_MODEL_PROVIDERDefault for --model-provider
REFRAIN_LOCALEDefault for --locale (en or ja)