Skip to content

Autonomy pilot runbook

This pilot starts in safe practice mode where nothing merges unattended, and the Slack Autonomy dial pauses new auto-merge grants without redeploying (details). If your install does not use Slack, see Without Slack.

Upgrade to a release with risk-gated post-merge verification (Upgrade). On an install.sh install, merge these switches into TF_VAR_extra_helm_values in install.env with your Slack member IDs and run ./upgrade.sh --upgrade-mode=full (see Helm YAML and multi-project setup):

Terminal window
TF_VAR_extra_helm_values='{platformAgent={deployment={env=[
{name="KUBEAGENTS_DIAL",value="on"},
{name="KUBEAGENTS_DIAL_ADMINS",value="U0123ABCD,U0456EFGH"},
{name="KUBEAGENTS_POST_MERGE_CHECK",value="report"},
{name="KUBEAGENTS_AUTOMERGE",value="practice"},
{name="KUBEAGENTS_AUTOMERGE_MAX_RISK",value="low"}
]}}}'

Commit this file to your GitOps repository’s base branch (the pinned baseBranch, or default branch if unset) and protect .kube-agents/ with CODEOWNERS so edits require human review (rules, environment mapping):

version: 1
automerge:
allow:
- fix: no-pdb
environments: [dev]
- max_risk: low
environments: [dev, test]
deny:
- fix: "*"
environments: [prod]

Open the app’s Home tab in Slack (Slack setup) and leave the Autonomy dial on Propose fixes (restart note). Observe kube-agents/risk statuses, kube-agents:would-auto-merge labels (GitHub and Gitea), and post-merge comments for 2-4 weeks before enabling Phase 2.

What works out of the box. Risk classification inspects flat rendered Kubernetes YAML and static local Kustomize overlays, and post-merge sync checks read in-cluster Argo CD Application objects (including ApplicationSet-generated ones), Git-backed Flux Kustomization and HelmRelease objects, and Git-backed Config Sync (details). With unrendered Helm, Terraform, or Kustomize overlays using generators, remote bases, components, replacements, or plugins, pull requests stay human-reviewed; with other reconcilers or non-Git sources, kube-agents still opens normal pull requests and reports unknown for post-merge sync checks.


Start in Phase 1 (practice mode) above, validate signals on real pull requests, and move to Phase 2 only when your repository and merge pipeline are ready.

Set KUBEAGENTS_AUTOMERGE=on to enter Phase 2. kube-agents never merges a pull request itself; the credential broker signals qualifying pull requests so your own pipeline can merge them:

  • Risk-based (max_risk) pull requests receive a green kube-agents/auto-merge commit status on the current head SHA (on all supported forges) plus kube-agents:auto-merge on GitHub and Gitea.
  • Recipe (no-pdb) pull requests receive the kube-agents:auto-merge label on GitHub and Gitea only (no kube-agents/auto-merge commit status).

Complete these checks before switching KUBEAGENTS_AUTOMERGE from practice to on:

  • GitHub App permissions (Commit statuses: write). Risk-based (max_risk) auto-merge fails closed unless the broker’s minted token carries Commit statuses: Read and write (statuses: write) to record kube-agents/auto-merge and kube-agents/risk on the head SHA. Grant it on both the GitHub App installation and platform-agent-scope in github-token-minter-config (default.yaml, plus <repo>.yaml if maintained by hand). Chart upgrades overwrite github-token-minter-config, so re-apply that scope edit after upgrades.
  • Branch protection and approvals. GitHub, GitLab, and Bitbucket cannot exempt pull requests from required human approvals by label or path. Use a dedicated zero-approval dev or test branch or repository gated on CI and the qualifying auto-merge signal.
  • Merge pipeline. For max_risk rules, configure a CI workflow (GitHub Actions or GitLab CI) that merges only when the head SHA carries a green kube-agents/auto-merge commit status and the branch is up to date (or queued in a merge queue). Do not merge max_risk pull requests on the label alone. For no-pdb recipe fixes on GitHub or Gitea, gate on CI plus the kube-agents:auto-merge label.
  • Shared-path safety for max_risk. Before enabling KUBEAGENTS_AUTOMERGE_MAX_RISK alongside KUBEAGENTS_AUTOMERGE=on, verify that no dev or test synced directory or path glob is shared with a staging or prod reconciler. Post-merge health verification (verified_healthy) and automatic step-down (writing a reason: deny rule) cover registered fix recipes (no-pdb) and clusters/<cluster>/ max_risk merges when KUBEAGENTS_POST_MERGE_CHECK is enabled.

To enable Phase 2:

  1. Update KUBEAGENTS_AUTOMERGE from practice to on in platformAgent.deployment.env and apply the upgrade.
  2. In Slack, an admin listed in KUBEAGENTS_DIAL_ADMINS selects Auto-merge proven fixes on the Home tab’s Autonomy dial panel.
  3. For recipe fixes such as no-pdb, click Request auto-merge on the repository row (or merge an allow rule directly in .kube-agents/automation.yaml).

If an auto-merged no-pdb fix or clusters/<cluster>/ max_risk pull request is still broken after merge, kube-agents opens a revert pull request and a step-down pull request. The step-down pull request adds a deny rule (fix: for recipes, reason: for risk-classified changes) to .kube-agents/automation.yaml (When an auto-merged fix is still broken).

Verify locally and observe Phase 1 signals

Section titled “Verify locally and observe Phase 1 signals”

In Phase 1 (Trusted Propose with practice mode), kube-agents proposes fixes as pull requests, classifies risk on every broker-opened pull request, verifies merged no-pdb fixes and clusters/<cluster>/ risk-classified changes, and marks qualifying pull requests with kube-agents:would-auto-merge. Nothing merges unattended.

From the shell sandbox Pod (assuming the default kubeagents-system namespace and platform-agent name), validate .kube-agents/automation.yaml and inspect a pull request’s deterministic risk classification. When testing a max_risk rule inside the sandbox, pass KUBEAGENTS_AUTOMERGE_MAX_RISK=<level> inline because that variable is not forwarded to the sandbox Pod:

Terminal window
kubectl exec -n kubeagents-system platform-agent-shell-0 -c shell -- \
python3 /opt/defaults/scripts/automation_rules.py <checkout> --fix no-pdb --environment dev
kubectl exec -n kubeagents-system platform-agent-shell-0 -c shell -- \
python3 /opt/defaults/scripts/vcs_client.py proposal-classify-risk <pr-number> --repo <owner/name> --format summary

During Phase 1, observe four signals:

  • Risk labels and commit statuses. Every broker-opened pull request receives a tamper-proof risk:* label (on GitHub and Gitea) and a SHA-bound kube-agents/risk commit status citing the base SHA and driving reasons.
  • Practice labels. Qualifying pull requests receive kube-agents:would-auto-merge on GitHub and Gitea. Compare these pull requests against the ones your team reviews and merges.
  • Post-merge verification. Merged no-pdb fixes and clusters/<cluster>/ risk-classified pull requests receive a post-merge comment confirming whether the reconciler applied the change and the workload is healthy.
  • Baseline metrics. Record your team’s merge rate and review time on proposed pull requests before considering unattended merges.

On an install.sh install, merge the platformAgent.deployment.env entries into TF_VAR_extra_helm_values in install.env (Operator settings). On a Helm install, set the list directly under platformAgent.deployment.env:

platformAgent:
deployment:
env:
- name: KUBEAGENTS_DIAL
value: "on"
- name: KUBEAGENTS_DIAL_ADMINS
value: "U0123ABCD,U0456EFGH"
- name: KUBEAGENTS_POST_MERGE_CHECK
value: "report"
- name: KUBEAGENTS_AUTOMERGE
value: "practice"
- name: KUBEAGENTS_AUTOMERGE_MAX_RISK
value: "low"
- name: GKE_PROJECTS
value: "dev-fleet-project,prod-fleet-project"

Omit KUBEAGENTS_AUTOMERGE_MAX_RISK if you only want to pilot recipe-based no-pdb fixes. Omit GKE_PROJECTS on a single-project install.

GKE_PROJECTS is separate from spec.scope.projects and replaces GKE_PROJECT_ID when set, so include the management project if it holds target clusters. The credential broker’s service account must be able to list clusters in every listed project, or environment resolution fails closed.

Every current install routes Slack through the A2A gateway (the former spec.mode: next path; spec.mode is deprecated). Confirm your Slack app manifest enables features.app_home.home_tab_enabled: true, subscribes to app_home_opened, and has interactivity turned on (Slack app setup). If allowedUsers is empty, the Home tab also requires the users:read scope.

Apps migrated from the older Hermes Slack listener must drop features.slash_commands and add the Home tab settings (Moving an app made for the Hermes listener). On Slack, the Autonomy dial panel appears above the Home channel panel (The Slack Home tab).

Installs that use the Web Console or another chat interface without Slack can control the same three autonomy levels through platformAgent.deployment.env (or spec.deployment.env on a standalone PlatformAgent CR):

Autonomy level Environment settings Behavior
Explain KUBEAGENTS_WRITE_MODE=none Broker opens no pull requests (audit issues and reads still work). Any misspelt value fails closed to none (details).
Propose Default (KUBEAGENTS_WRITE_MODE unset or propose), plus optional KUBEAGENTS_AUTOMERGE=practice and KUBEAGENTS_POST_MERGE_CHECK=report Broker opens pull requests for human review. Practice mode adds kube-agents:would-auto-merge labels without allowing unattended merges.
Auto-merge Leave KUBEAGENTS_DIAL off (off or unset), set KUBEAGENTS_AUTOMERGE=on (plus optional KUBEAGENTS_AUTOMERGE_MAX_RISK and KUBEAGENTS_POST_MERGE_CHECK=report), and commit .kube-agents/automation.yaml With KUBEAGENTS_DIAL off, there is no dial ceiling; qualifying pull requests receive the auto-merge signal for your merge pipeline.

Do not set KUBEAGENTS_DIAL=on — and do not enable the platformAgent.deployment.autonomyPilot Helm preset, which sets KUBEAGENTS_DIAL=on — on an install without Slack. When KUBEAGENTS_DIAL=on, session-kv reports the stored default level (Propose fixes) to the credential broker, and only the Slack Home tab can raise the dial to Auto-merge proven fixes — keeping the install capped at Propose even when KUBEAGENTS_AUTOMERGE=on.

Changing levels without Slack requires editing platformAgent.deployment.env and running an upgrade, which rolls the Pods; there is no one-click instant pause like the Slack dial. To stop unattended merges or all pull requests, set KUBEAGENTS_AUTOMERGE=off or KUBEAGENTS_WRITE_MODE=none and apply the upgrade, or pause your repository’s merge workflow for an immediate halt.

The stored default level is Propose fixes. After a credential-broker Pod restart, the broker stays at Explain until session-kv reports the stored level (reported on startup and every minute). Leave the dial at Propose fixes throughout Phase 1.

Reconciler and environment isolation details

Section titled “Reconciler and environment isolation details”
  • Flat rendered Kubernetes YAML or static Kustomize overlays. Deterministic pull request risk classification inspects rendered Kubernetes manifests and statically renders local Kustomize overlays that use only resources/bases, patches (Strategic Merge and JSON 6902), images, replicas, namespace, and commonAnnotations. Unrendered Helm charts (values.yaml), Terraform files, and Kustomize overlays using generators, remote bases, components, replacements, or plugins post an unsupported kube-agents/risk commit status and stay human-reviewed.
  • Supported GitOps reconciler. Post-merge sync verification reads in-cluster Argo CD Application resources, Flux Kustomization and HelmRelease resources backed by a GitRepository (with reconcileStrategy: Revision so deployed releases carry the Git commit suffix), and Config Sync RootSync or RepoSync (Git source). Argo CD support covers single-source and multi-source spec.sources (including Helm $values ref sources) as well as Application objects generated by an ApplicationSet targeting the local cluster. HelmRelease checks require read access to helmreleases. Non-Git Helm chart repositories (HelmRepository), ChartVersion-only releases without a Git commit link, OCI sources, and remote-cluster Argo CD Application resources report unknown for post-merge sync checks.
  • Environment mapping and isolation. Label each GKE cluster with environment (or fallback env, stage, or tier). If your repository organizes manifests by directory or branch instead of clusters/<cluster>/, declare environments: path and branch bindings in .kube-agents/automation.yaml (The environment of a fix). Keep dev and test synced paths isolated from staging and prod so a non-production rule cannot reach production through a shared directory.

All Earned Autonomy switches ship off by default. Configure them in platformAgent.deployment.env (Helm or Terraform) or spec.deployment.env (standalone PlatformAgent CR). Changing KUBEAGENTS_DIAL, KUBEAGENTS_POST_MERGE_CHECK, or KUBEAGENTS_AUTOMERGE rolls the agent, sandbox, and credential-broker Pods. KUBEAGENTS_AUTOMERGE_MAX_RISK and GKE_PROJECTS apply to the credential-broker Pod, and KUBEAGENTS_DIAL_ADMINS applies to the agent Pod.

Variable Default Phase 1 value Phase 2 value Purpose
KUBEAGENTS_DIAL off on on Shows the Autonomy dial on the Slack Home tab and lets the dial bound broker writes.
KUBEAGENTS_POST_MERGE_CHECK off report report Verifies merged no-pdb fixes and clusters/<cluster>/ risk-classified changes against the reconciler and cluster, and comments the result on the pull request.
KUBEAGENTS_AUTOMERGE off practice on Reads .kube-agents/automation.yaml and marks qualifying pull requests (kube-agents:would-auto-merge in practice, kube-agents:auto-merge in on).
KUBEAGENTS_AUTOMERGE_MAX_RISK off low (opt.) low or medium Optional install ceiling for max_risk rules in dev or test. Unset or off disables risk-tier auto-merge even when on is set.
KUBEAGENTS_DIAL_ADMINS (none) Member IDs Member IDs Comma-separated Slack member IDs (U… or W…) allowed to change the dial or toggle per-kind auto-merge.
GKE_PROJECTS (none) Project IDs Project IDs Optional comma-separated GCP project IDs for multi-project fleets when resolving clusters/<cluster>/ environment labels.

KUBEAGENTS_DIAL_ADMINS accepts Slack member IDs only; emails and display names never match. When unset, the dial panel is read-only for everyone.

To stop new auto-merge grants without redeploying, an admin in KUBEAGENTS_DIAL_ADMINS moves the Autonomy dial on the Slack Home tab back to Propose fixes (or Explain to pause all pull requests). The credential broker immediately blocks new grants and removes existing ones when a pull request is re-evaluated. For already-eligible open pull requests that must not merge before re-evaluation, hold or close them or pause your merge workflow.

To turn the switches off permanently, set KUBEAGENTS_AUTOMERGE (and optionally KUBEAGENTS_DIAL and KUBEAGENTS_POST_MERGE_CHECK) back to off in platformAgent.deployment.env (or spec.deployment.env on a standalone PlatformAgent CR) and apply the upgrade.