Skip to main content
Agent Mode outputs structured NDJSON instead of the interactive terminal UI. It’s how AI coding agents (Claude Code, Codex CLI, Gemini CLI) consume Kane CLI results: parse events programmatically, extract the final result, and present it to the user.

Enable Agent Mode

Add --agent to any run command:
When --agent is active:
  • The interactive TUI is fully suppressed (no boot screen, no menus)
  • Stdin is not used (no interactive prompts)
Always combine --agent with --headless in non-interactive environments (CI/CD, agent contexts) to avoid display server errors.

Output Format

Kane CLI outputs one JSON object per line (NDJSON) to stdout:

Event Schema

Step Events

*optional
**event values: screenshot, reasoning, action, vision, assertion, evaluation

Flow Events

Unresolved-Variable Warning

Kane CLI checks every {{name}} in the objective before the run starts. If a name has no value, Kane CLI prints a warning and the run continues. The name is typed literally as written, unless a step sets its value first. With --agent, the warning is a single typed event, sent before the first progress event:
reason is value_missing, not_declared, or not_a_dataset_column. The warning does not change the exit code. See Unresolved variables for what each reason means and which names are never checked.

The run_end Event

run_end is the last line of a one-shot run. It contains the complete test result. Always check the process exit code too: an early refusal can exit without a run_end event.

Key Fields


The .evidence proof pack

Every Kane CLI run produces an .evidence pack stored natively in the results folder, so failure context travels with the run instead of living in a separate dashboard. Each pack contains the full execution proof for the run: step-by-step traces, screenshots, video, and command, network and console logs, plus the NDJSON event stream and result codes. Coding agents and humans read the same evidence to see exactly what happened, where it failed, and why.

Parsing Output

Get the run_end event:

Command-Specific Completion

Reading the last run_end event works for one-shot run only. Other commands end with their own completion event:
  • testmd run: read test_md_done for overall_status, duration_s, session_id, and the optional share_url. The stream can also contain run_end events; these finish individual steps, not the file.
  • Local testrun run suites: end with testrun_done. Suites dispatched to the remote grid then also emit remote_done; keep its status, exit, and sessions_path fields.
  • generate: ends with generate_done.
  • Assurance commands: conversational agent streams end with done. The review and read commands have their own completion contracts.
Always check the process exit code too: an early refusal, an invalid plan, or a dry run can exit without the normal completion event. Progress events are meant for live display. When you count completions, count only done and failed. Step indices can repeat, so keep track of which child agent and execution each event belongs to. testrun run prints its NDJSON stream when stdin is not a TTY, or when you pass --agent. See Batch runs (testrun).

Handling ask_user Events

If an objective requires user input mid-run, Kane CLI fires ask_user:
ask_user is turned off automatically when stdin is not a TTY. In CI/CD and AI agent contexts, stdin is never a TTY, so ask_user never fires. Write objectives that don’t require interactive prompts.
If stdin IS a TTY, respond by writing JSON to stdin:
To cancel:

Agent Mode vs Interactive Mode


Next Steps

  • Error Codes: Complete reference of result_code values and recommended actions
  • Parallel Execution: Run multiple tests concurrently
  • Skills: Install the Kane CLI skill for Claude, Codex, or Gemini
  • CLI Reference: Full flag and command reference