Tenkai is a Go-based experimentation framework designed to evaluate and test different configurations of coding agents with statistical rigor. It provides a structured environment for A/B testing system prompts, tool availability, and agent configurations across a variety of standardized coding scenarios.
Tenkai operates on a Single Source of Truth principle using a persistent SQLite database (experiments/tenkai.db). All execution events are streamed in real-time from the runner to the database, ensuring that the web dashboard and analysis tools always reflect the exact state of the agent execution.
- Go 1.22+: For the backend runner.
- Node.js 20+: For the frontend dashboard.
- Gemini CLI: The agent executable being tested (usually
gemini).
-
Build the Backend:
go build . && go install .
-
Start the Application: The recommended way to run Tenkai is to launch the API server and the frontend simultaneously.
tenkai --serve & (cd frontend && npm run dev)
-
Access the Dashboard: Open your browser to http://localhost:3000.
A Scenario represents a standardized coding task. To add a new one:
- Create a new directory in
scenarios/(e.g.,scenarios/api-refactor). - Create a
scenario.yamlfile inside that directory:
name: "API Refactor"
description: "Refactor a monolithic handler into clean architecture."
task: |
Refactor the code in main.go.
Create a separate package for the business logic.
assets:
- type: "file"
source: "initial_code.go"
target: "main.go"
validation:
- type: "lint"
max_issues: 0
- type: "test"
target: "./..."A Template defines what you want to test (Alternatives) against which tasks (Scenarios).
- Create a new directory in
experiments/templates/(e.g.,experiments/templates/prompt-test). - Create a
config.yamlfile:
name: "System Prompt A/B Test"
repetitions: 5
max_concurrent: 4
timeout: "5m"
control: "baseline"
scenarios:
- "api-refactor"
alternatives:
- name: "baseline"
command: "gemini"
args: ["-y", "", "-o", "stream-json"]
- name: "strict-mode"
command: "gemini"
args: ["-y", "", "-o", "stream-json"]
system_prompt_file: "strict_prompt.md"- Navigate to the New Experiment page in the Web UI.
- Select your Template from the dropdown.
- (Optional) Override the number of repetitions or concurrency.
- Click Launch.
The dashboard will update in real-time as agents pick up tasks. You can click on individual runs to inspect the live event stream, tool usage, and error logs.
Tenkai employs two primary statistical tests to determine if the difference in performance between an alternative and the control is significant.
Used for continuous metrics (Duration, Token Usage, Lint Issues).
- Hypothesis: The mean performance of Alt A is different from the Control.
- Why Welch?: It assumes unequal variances and sample sizes, which is typical for agent runs.
- Significance: Displays
*(p < 0.05) or**(p < 0.01).
Used for Success Rates.
- Hypothesis: The proportion of successful runs for Alt A is different from the Control.
- Why Fisher?: It is ideal for small sample sizes (e.g., 5-20 repetitions) where the normality assumption of a Chi-Squared test fails.
cmd/tenkai: Main entryway (binary).internal/runner: Core execution engine. Handles process groups, timeouts, and log streaming.internal/workspace: Manages file system isolation and asset injection.internal/db: SQLite access layer. Storesrun_resultsandrun_events.scenarios/: Global library of available coding tasks.experiments/:runs/: Output directory for generated artifacts and logs.templates/: Configuration templates for experiments.
frontend/: Next.js web dashboard.