Skip to content

feat: KEDA External Scaler for GitHub Issue-Driven Agent Autoscaling #516

Closed

Description

@tamirdresher

Feature: KEDA External Scaler for GitHub-Based Agent Workloads

Problem

Running Squad on Kubernetes means agents sit idle when no work exists. KEDA (Kubernetes Event-Driven Autoscaler) solves this for queue-based workloads — but GitHub Issues isn't a native KEDA trigger.

Without autoscaling:

  • Agent pods burn CPU/memory 24/7 even when there are 0 issues
  • Manual scaling needed for burst work (10 issues labeled at once)
  • No cost optimization — the cluster just runs

Proposed Solution: keda-copilot-scaler

A KEDA External Scaler (gRPC) that:

  1. Polls GitHub API for issues matching squad:copilot label
  2. Reports queue depth as a KEDA metric
  3. Handles rate limits gracefully (Retry-After, exponential backoff)
  4. Supports composite scaling (multi-metric decisions)
# ScaledObject example
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
spec:
  scaleTargetRef:
    name: picard-agent
  triggers:
  - type: external
    metadata:
      scalerAddress: keda-copilot-scaler.squad-scaler:6000
      owner: bradygaster
      repo: squad
      labels: squad:copilot

Scaling behavior:

  • 0 issues → scale to 0 (save money)
  • 1-3 issues → scale to 1 pod
  • 4-10 issues → scale to 2 pods
  • 10+ issues → scale to ceiling

Implementation Available

Complete Go implementation: tamirdresher/keda-copilot-scaler

  • gRPC external scaler (KEDA v2.19.0 compatible)
  • 51 passing tests
  • Helm chart + Kustomize manifests
  • Rate limit aware (tracks X-RateLimit-Remaining)
  • Running in production on AKS

The scaler is intentionally standalone (not embedded in Squad CLI) so it can run as a sidecar or separate deployment.

Integration Points

Activity

  1. added a commit that references this issue on Mar 26, 2026
    9d2e81d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions