#1172·kaggle-cli

Add a CLI command to cancel an active kernel session

Author: ternausCreated Aug 10, 2026Updated Aug 22, 2026
Labelsenhancement

Workflow

Automated GPU jobs need a way to stop a stale or runaway kernel session without deleting the kernel or using the web UI. The public SDK already exposes ApiCancelKernelSessionRequest at POST /api/v1/kernels/cancel-session/{kernel_session_id}, but the official CLI has no corresponding kaggle kernels command.

kaggle kernels push already prints the numeric versionNumber; that value is accepted by the cancellation endpoint as the kernel session id.

Expected CLI

bash
kaggle kernels cancel <SESSION_ID>

The command should issue the existing SDK cancellation request and report that cancellation was requested. It should reject non-positive IDs and surface a backend rejection.

Proposed scope

A small wrapper in KaggleApi, an argparse subcommand, focused unit coverage, and one documentation section. No change to the backend API or existing CLI behavior.

I have a tested implementation ready and can open a PR.