Autonomous Mode

In autonomous mode, a worker-side LLM drives the observe-decide-act loop inside the karate-agent container. Submit a job, close your laptop — come back to a completed report.

When to Use Autonomous

  • CI/CD pipelines — submit jobs from GitHub Actions, Jenkins, or any CI that can curl
  • Scheduled tests — batch jobs that run overnight or on a cadence
  • Regression suites — run flow-based test suites with LLM recovery for failures
  • Exploratory testing — let the LLM explore an app and report what it finds

Submitting a Job

curl -X POST http://localhost:4444/api/jobs \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Log into PolicyCenter and create a Personal Auto submission",
    "flowFiles": ["gw/login.js", "gw/pa-submission.js"],
    "model": "openrouter/anthropic/claude-sonnet-4-6",
    "maxIterations": 25
  }'

Job Parameters

Parameter Description
prompt The task description for the LLM
flowFiles Optional array of .js flow files to run first (fast path)
model LLM model to use (overrides default)
maxIterations Token budget — max LLM iterations before stopping

How It Works

  1. Flows first — if flowFiles are specified, they execute at native JS speed. No LLM tokens consumed.
  2. LLM takes over — if a flow step fails, or after flows complete, the LLM drives the remaining work via the observe-decide-act loop.
  3. Report generated — session produces transcript, screenshots, structured report, and optional video.

LLM Configuration

Configure the default LLM via environment variables:

# OpenRouter (100+ models)
KARATE_LLM_MODEL=openrouter/anthropic/claude-sonnet-4-6
KARATE_LLM_API_KEY=sk-or-...

# Anthropic (direct)
KARATE_LLM_MODEL=anthropic/claude-haiku-4-5
KARATE_LLM_API_KEY=sk-ant-...

# Ollama (local, no API key needed)
KARATE_LLM_MODEL=ollama/gemma3

Per-job model override lets teams use smaller, cheaper models for routine jobs and reserve larger models for exploratory work.

Monitoring Jobs

Dashboard

The dashboard shows all active and completed jobs. Click a job to see:

  • Live browser view (noVNC) while running
  • Session transcript
  • Screenshots at each step
  • Structured report

API

# Check job status
curl http://localhost:4444/api/jobs/{jobId}

# Download report when complete
curl http://localhost:4444/api/jobs/{jobId}/download -o report.zip

CI/CD Integration

Any CI system that can run curl can submit jobs and check results:

# GitHub Actions example
- name: Run browser tests
  run: |
    JOB=$(curl -s -X POST $GRID_URL/api/jobs \
      -H "Content-Type: application/json" \
      -d '{"prompt":"...", "flowFiles":["e2e/full-suite.js"]}')
    JOB_ID=$(echo $JOB | jq -r .sessionId)
    while true; do
      STATE=$(curl -s $GRID_URL/api/jobs/$JOB_ID | jq -r .state)
      [ "$STATE" = "completed" ] && break
      [ "$STATE" = "failed" ] && exit 1
      sleep 10
    done
    curl -s $GRID_URL/api/jobs/$JOB_ID/download -o test-report.zip