Skip to content

feat: provider rotation strategy for agents #68

@alexsiri7

Description

@alexsiri7

Problem

Currently, each agent has a single provider field — resolved once at spawn time. For cost-conscious deployments, it would be useful to rotate providers across restarts. For example, a witness agent could randomly pick between gemini-flash and claude-haiku on each spawn, spreading token usage across providers and providing resilience when one provider hits rate limits.

Proposal

Add providers (list) and provider_strategy fields to the Agent config:

[[agent]]
name = "witness"
scope = "rig"
providers = ["gemini-flash", "claude-haiku"]
provider_strategy = "random"

Behavior:

  • When providers is set (list), ResolveProvider() picks one based on provider_strategy
  • When provider is set (string, existing behavior), nothing changes — full backward compatibility
  • provider_strategy is extensible (template method / strategy interface) but only random is implemented initially
  • Selection happens at spawn time in the controller, so each restart naturally gets a new provider

Config precedence: providers + provider_strategy takes priority over provider when both are set.

Scope

  • Add Providers []string and ProviderStrategy string to Agent struct
  • Add ProviderStrategy interface with Select(providers []string) string
  • Implement RandomStrategy
  • Update ResolveProvider() to check for multi-provider config
  • Update AgentPatch, AgentOverride, apply functions, pool deep-copy
  • Tests for strategy selection, config parsing, backward compat

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureNew capabilitypriority/p2Medium — real problem, workaround exists

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions