Skip to content

[Substrate] Cost & autoscaling — KEDA on the WorkerPool, 3-node budget #78

Description

@Sam123ben

Part of the Agent Substrate epic ⬆️. Depends on #A (budget) + #B (WorkerPool).

Goal

Keep Substrate within the 3-node budget and scale it to demand — ideally scale-to-zero when idle.

Today (grounded)

3-node GKE, autoscaling pool maxes ~5/zone but the operator constraint is "can't go beyond 3 nodes atm." Classic kagent's standing pods is exactly what we avoided. We have a KEDA pattern in mind (we wrote a nats-jetstream ScaledObject for the run-dispatch worker in docs/plans/nats-dispatch-workqueue/).

Tasks

  • Decide WorkerPool sizing: min replicas (0 = scale-to-zero cold start, vs 1 = always-warm).
  • KEDA ScaledObject on the WorkerPool driven by pending Actor demand (or queue depth); activation from zero on the first dispatch.
  • Node budget: pin/limit WorkerPool resources so it can't crowd devai-api/sre/postgres on 3 nodes; node-pool selectors if a sandbox-capable pool is needed.
  • Cost model: standing WorkerPool cost vs per-run Job cost — when is Substrate cheaper? (likely: many short agent calls = Substrate wins; rare long runs = Jobs).
  • Alerts on WorkerPool saturation / Actor scheduling failures.

Open decisions

  • Scale-to-zero (cold start per first call) vs warm floor (cost) — depends on #A cold-start numbers.
  • Dedicated sandbox node pool (cleaner isolation/scaling) vs shared.

Acceptance

Substrate runs within the 3-node budget, scales up under load and down (toward zero) when idle, with no impact on core DevAI services.

Refs: docs/plans/nats-dispatch-workqueue/IMPLEMENTATION-PLAN.md (KEDA pattern), KAGENT-INTEGRATION.md §0 (3-node rationale); memory: NATS WorkQueue Dispatch, Agent Harness + kagent.

— Part of #69

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-substratekagent Agent Substrate adoptionenhancementNew feature or requestkagentkagent / agent runtime

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions