How it works
After a period with no work (
cooldownPeriod, 300 seconds by default), KEDA scales the agent back
to zero.
Turn it on for a self-hosted agent
Before you start
- KEDA 2.10 or later in the agent’s cluster. On a deploy target, koperator can install KEDA for you (see KEDA).
- KEDA reaches KAOP. KEDA asks KAOP for the agent’s queue depth, with the agent’s worker token, over outbound HTTPS to your KAOP host. If the cluster’s egress goes through a proxy, KEDA needs it too. No replica has to run for KEDA to find the agent.
- On a deploy target, the guardrails allow it. The deploy target’s
guardrails.runBehavioursmust includescale_to_zero, and Max replicas must not be above itsguardrails.maxReplicas. If the deploy target cannot scale to zero, the wizard says why.
Set the run behaviour
In the create or edit wizard, on the Where it runs step, choose Scale to zero instead of Always on. Then set:
On a deploy target, koperator applies the change. For an agent you install with Helm yourself, run
helm upgrade with the values KAOP generates; they set autoscaling.keda.enabled: true and
minReplicaCount: 0 (see Scaling with
KEDA). To wake faster,
lower autoscaling.keda.pollingInterval (30 seconds by default). KAOP refuses a value below 5
seconds.
Set the run behaviour in KAOP, not only in your values file. KAOP holds runs only for an agent whose
run behaviour is Scale to zero. An agent with
minReplicaCount: 0 in its values but Always
on in KAOP shows as offline when it has no replica, and its runs are not held.Turn it on for a Komodor-hosted agent
In the create or edit wizard, on the Where it runs step, set Min replicas to 0. Max replicas must be 1 or more, up to your account’s limit. Komodor runs KEDA for you, so there is nothing to install. A Komodor-hosted agent differs from a self-hosted one:- The hold timeout is 300 seconds, and KEDA polls every 30 seconds. You cannot change these values.
- A Komodor-hosted agent that you deliver from a Git repository has a fixed replica count, so it cannot scale to zero.
- If scale to zero is turned off for your account, the agent runs one replica. Its saved setting does not change, and the agent goes back to zero when scale to zero is turned on again.
- At zero, no pod pulls the image during a deploy, so KAOP asks the image’s registry whether the image exists. If the registry says it does not, the deploy fails with “the image … was not found in its registry”. KAOP cannot check an image in a private registry: a wrong tag then shows only when the first run starts a pod.
While the agent is idle
Fleet shows the agent as Idle, not offline. Run, chat, Slack, direct invoke and A2A requests to an idle agent are accepted, and each one wakes it:
The first reply after idle waits while a replica starts, which can take a minute or more. If no
replica takes the run before the hold timeout, the run fails with “The agent did not wake up in time
(5 min). Try again.”, with the hold timeout in place of 5 min.
A stopped agent is not idle. A request does not wake it.
When the agent does not wake
Next steps
Deploy a self-hosted agent
The Helm values, including the KEDA block.
Configure koperator
KEDA and the guardrails on a deploy target.