Skip to main content

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​

ParameterDescription
promptThe task description for the LLM
flowFilesOptional array of .js flow files to run first (fast path)
modelLLM model to use (overrides default)
maxIterationsToken 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​

The allowed models list lives in karate-agent.json — the first entry is the default for new autonomous jobs:

{
"models": [
"openrouter/anthropic/claude-sonnet-4-6",
"openrouter/google/gemma-4-26b-a4b-it",
"anthropic/claude-haiku-4-5"
]
}

API keys come from the shell environment:

OPENROUTER_API_KEY=sk-or-...   # for openrouter/ models
ANTHROPIC_API_KEY=sk-ant-... # for anthropic/ models

See Configuration for the full reference.

Per-job model override (via the model field in the POST body) 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 $DASHBOARD_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 $DASHBOARD_URL/api/jobs/$JOB_ID | jq -r .state)
[ "$STATE" = "completed" ] && break
[ "$STATE" = "failed" ] && exit 1
sleep 10
done
curl -s $DASHBOARD_URL/api/jobs/$JOB_ID/download -o test-report.zip