Skip to content

Configuration ​

The engine has three configuration surfaces:

  1. Monkey constructor — which LLMs to use for which phase.
  2. executeAndTriage options — explorer / planner / runner tuning.
  3. Environment variables — provider API keys (or pass apiKey inline). The CLI reads the same variables, plus its flags (--provider, --model, --base-url, --quality, --max, --flows).

monkeytest init writes .monkeytest/config.json, including a $schema URL (https://docs.monkeytest.ai/config-schema-v1.json) that is not published. The CLI does not load config.json. Editing it has no effect on the next run. Use flags and environment variables. The file is safe to delete, or to keep as notes.

Monkey constructor ​

ts
new Monkey({
  llm: {
    explorer: { provider: 'gemini',    model: 'gemini-flash-lite-latest' },
    planner:  { provider: 'openai',    model: 'gpt-4o' },
    runner:   { provider: 'groq',      model: 'llama-3.3-70b-versatile' },
    triager:  { provider: 'anthropic', model: 'claude-haiku-4-5' }, // optional polish pass
  },
});

Tier semantics:

TierCalls per runRecommendation
explorer1 per crawled page (maxPages, default 8)Cheap, fast. Same model you'd use for a chatbot.
planner1 per run.Smart. This is where you actually pay for intelligence.
runner1 per step (maxFlows × steps, typically 10–40)Cheap, fast. Hot path.
triager1 per bug (capped at 25, concurrency 4). Opt-in.Cheap, fast. Rewrites bug copy from evidence. See Triager polish.

If you omit runner, the engine reuses the planner model for runner calls (back-compat). If you omit triager, the deterministic rule-based triager runs alone (zero extra LLM cost).

The same shape works for mixed providers — there's no constraint that all phases use the same vendor.

LLMConfig ​

ts
interface LLMConfig {
  provider: 'openai' | 'gemini' | 'anthropic' | 'mistral' | 'groq' | 'openai_compatible';
  model?: string;       // provider-specific; cheap default per provider if omitted
  apiKey?: string;      // falls back to provider env var if omitted
  baseURL?: string;     // for `openai_compatible` (Ollama, vLLM, OpenRouter, …)
  temperature?: number; // default 0.2 (JSON tasks)
}

See LLM providers for env var names, recommended models, and per-provider quirks.

executeAndTriage options ​

ts
const { siteMap, plan, run } = await monkey.executeAndTriage(url, {
  events,
  explore: { /* ExploreOptions */ },
  plan:    { /* PlannerOptions */ },
  run:     { /* RunnerOptions  — required */ },
});

ExploreOptions ​

OptionDefaultMeaning
maxPages8Hard cap on pages crawled. Each page = one LLM call.
pageTimeoutMs20000Per-page navigation timeout.
headlesstrueSet false to watch it crawl.
screenshotsDir(none)If set, take a viewport-sized PNG of every page; path stored on SiteMapPage.screenshotPath.
onPage(none)Per-page callback (used internally by Monkey.run).
events(none)EventBus for live events.

PlannerOptions ​

OptionDefaultMeaning
maxFlows6Soft cap on flows the planner can return.
includeAuthFlowstrueInclude flows the LLM tagged auth_required (the runner surfaces them as "needs creds").
events(none)EventBus.

RunnerOptions ​

OptionDefaultMeaning
screenshotsDirrequiredWhere step PNGs and per-flow WebMs are written.
stepTimeoutMs15000Per-step navigation/action timeout.
flowTimeoutMs180000Hard cap on a flow's wall clock.
headlesstrueSet false to watch flows run.
strictOraclesoff on runPlan; on via new Monkey()Fail a step on a page error, a document HTTP 404, an action HTTP ≥500, or a disabled control.
failOn5xxoff on runPlan; on via new Monkey()Also fail a passed or skipped step that saw a same-origin HTTP ≥500 (document, xhr, or fetch).
onEvent(none)Legacy per-step callback. Same data as the runner-phase events on events.
events(none)EventBus.

Depth presets via autoLLMConfig ​

If you don't want to think tiers at all:

ts
import { autoLLMConfig } from '@monkeytestai/monkeytester';

new Monkey({ llm: autoLLMConfig({ quality: 'balanced' }) });
qualityExplorerPlannerRunner
cheapcheapcheapcheap
balanced (default)cheapsmartcheap
smartsmartsmartsmart

You can override individual tiers:

ts
autoLLMConfig({
  quality: 'balanced',
  overrides: { runner: { provider: 'groq', model: 'llama-3.3-70b-versatile' } },
});

Environment variables (full list) ​

VariablePurpose
OPENAI_API_KEYOpenAI provider
OPENAI_MODELOptional default OpenAI model id
GEMINI_API_KEY / GOOGLE_API_KEYGemini provider
ANTHROPIC_API_KEYAnthropic provider
MISTRAL_API_KEYMistral provider
GROQ_API_KEYGroq provider
OPENAI_COMPATIBLE_API_KEYAPI key for any OpenAI-compatible server
OPENAI_COMPATIBLE_BASE_URLURL for any OpenAI-compatible server (Ollama / vLLM / OpenRouter / …)
PLAYWRIGHT_BROWSERS_PATHWhere Chromium binaries live; standard Playwright env.

Next: LLM providers →

AGPL-3.0 · Made for the testing community