Prerequisites
- Node.js 18 or later
- An AI provider API key (Anthropic recommended)
Install
npx @basemachina/agentic-browser-cli generate -- --help
AI provider setup
Anthropic (default)
OpenAI
OpenAI-compatible
Google AI Studio
Azure OpenAI
Amazon Bedrock
Google Vertex AI
export ANTHROPIC_API_KEY="sk-ant-..."
Default model is claude-sonnet-4-6. To use a different Anthropic model:npx @basemachina/agentic-browser-cli generate -- \
--model "claude-sonnet-4-6" --model-provider anthropic \
...
export OPENAI_API_KEY="sk-..."
npx @basemachina/agentic-browser-cli generate -- \
--model "gpt-4o" --model-provider openai \
...
export OPENAI_COMPATIBLE_BASE_URL="https://your-endpoint.com/v1"
export OPENAI_COMPATIBLE_API_KEY="your-key"
npx @basemachina/agentic-browser-cli generate -- \
--model "your-model" --model-provider openai-compatible \
...
export GOOGLE_GENERATIVE_AI_API_KEY="..."
npx @basemachina/agentic-browser-cli generate -- \
--model "gemini-2.5-pro" --model-provider google \
...
export AZURE_RESOURCE_NAME="your-resource"
export AZURE_API_KEY="..."
npx @basemachina/agentic-browser-cli generate -- \
--model "gpt-4o" --model-provider azure \
...
export AWS_REGION="us-east-1"
export AWS_ACCESS_KEY_ID="..."
export AWS_SECRET_ACCESS_KEY="..."
npx @basemachina/agentic-browser-cli generate -- \
--model "anthropic.claude-sonnet-4-6-v1:0" --model-provider bedrock \
...
export GOOGLE_VERTEX_PROJECT="your-project"
export GOOGLE_VERTEX_LOCATION="us-central1"
npx @basemachina/agentic-browser-cli generate -- \
--model "claude-sonnet-4-6@20250514" --model-provider vertex \
...
You can also set defaults via environment variables:
| Variable | Description |
|---|
AI_MODEL_ID | Default AI model ID |
AI_MODEL_PROVIDER | Default AI provider |
AGENTIC_BROWSER_LOCALE | Default locale (en or ja) |
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.):
# App context
- Login page: https://app.example.com/login
- After login, the dashboard is at /dashboard
- The "Export CSV" button is in the top-right toolbar
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 YAML runbook.
npx @basemachina/agentic-browser-cli generate -- \
--url "https://app.example.com/login" \
--goal "Log in and navigate to the dashboard" \
--output ./login-flow.yaml \
--context ./context.md \
--secrets ./secrets.json \
--headless false \
--model "claude-sonnet-4-6" \
--model-provider anthropic
Use --headless false to watch the AI explore your app in real time. Remove it for headless execution.
You can also set model defaults via environment variables instead of passing --model and --model-provider on every command:export AI_MODEL_ID="claude-sonnet-4-6"
export AI_MODEL_PROVIDER="anthropic"
AI will:
- Open the browser and navigate to the URL
- Explore the page, deciding which actions to take
- Record each step (clicks, inputs, navigations)
- Review the steps and remove unnecessary ones
- Output a clean YAML runbook
Step 3: Execute the runbook
Before your first run, open login-flow.yaml and review the generated steps. Check sensitive values — consider using variables with source: env or source: secrets instead of hardcoded values.
Run the generated runbook:
npx @basemachina/agentic-browser-cli execute -- \
--runbook ./login-flow.yaml \
--context ./context.md \
--secrets ./secrets.json \
--headless false \
--model "claude-sonnet-4-6" \
--model-provider anthropic
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.
- Open the browser and navigate to the starting URL
- For each step, resolve the selector to find the target element
- Execute the action (click, input, etc.)
- 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:
npx @basemachina/agentic-browser-cli execute -- \
--runbook ./login-flow.yaml \
--context ./context.md \
--secrets ./secrets.json \
--self-heal \
--model "claude-sonnet-4-6" \
--model-provider anthropic
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:
npx @basemachina/agentic-browser-cli fix-runbook -- \
--runbook ./login-flow.yaml \
--report ./login-flow-report.md
With the Web Console, you can generate, execute, schedule, and self-heal runbooks from a browser UI — no CLI required.
What’s next?