Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add khalilbenaz/claude-skills-collection --skill load-balancergit clone --depth 1 https://github.com/khalilbenaz/claude-skills-collectionWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/load-balancer)<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/load-balancer"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/load-balancer/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/load-balancer"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/load-balancer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00073 | $0.03152 |
| Opus 5.5 | $0.00029 | $0.01261 |
| Sonnet 5.5 | $0.00015 | $0.00630 |
| Haiku 4.5 | $0.00007 | $0.00315 |
Grade A, and why
load-balancer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 316 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agent Load Balancer
Quand utiliser ce skill
Utiliser ce skill lorsque plusieurs sous-agents traitent des tâches en parallèle et qu'une distribution naïve ne suffit pas : agents aux capacités hétérogènes, spécialisations différentes, coûts variables, ou contraintes de SLA. Indispensable dans les architectures à haute disponibilité et dans les systèmes sensibles aux coûts.
Critères de choix de la stratégie
| Situation | Stratégie recommandée |
|---|---|
| Agents homogènes, charge uniforme | round-robin |
| Agents homogènes, tâches longues variables | least-connections |
| Agents de capacités différentes | weighted |
| Agents spécialisés (code, résumé, analyse…) | capability-based |
| Multi-modèles (Haiku + Sonnet + Opus) | cost-based |
| Contexte utilisateur persistant | sticky session + TTL |
Workflow
1. Profiler les agents disponibles
Avant tout routing, établir un profil par agent :
from dataclasses import dataclass, field
import statistics
@dataclass
class AgentProfile:
id: str
capabilities: list[str] # ex: ["code", "research", "summarize"]
model: str # ex: "claude-3-5-sonnet"
cost_per_1k_tokens: float # ex: 0.003
weight: float = 1.0
active_tasks: int = 0
total_tasks: int = 0
error_count: int = 0
latencies: list[float] = field(default_factory=list)
healthy: bool = True
canary_traffic_pct: float = 100.0
@property
def avg_latency(self) -> float:
return statistics.mean(self.latencies[-20:]) if self.latencies else 0.0
@property
def error_rate(self) -> float:
return self.error_count / max(self.total_tasks, 1)
Checklist profil agent :
- Capabilities déclarées (types de tâches maîtrisées)
- Modèle LLM et coût/1k tokens
- Poids relatif (pour weighted routing)
- Limites connues (context window, rate limits)
2. Implémenter le routeur central
import random
from enum import Enum
from typing import Optional
class RoutingStrategy(Enum):
ROUND_ROBIN = "round_robin"
LEAST_CONNECTIONS = "least_connections"
WEIGHTED = "weighted"
CAPABILITY_BASED = "capability_based"
COST_BASED = "cost_based"
class AgentLoadBalancer:
def __init__(self, strategy: RoutingStrategy = RoutingStrategy.LEAST_CONNECTIONS):
self.strategy = strategy
self.agents: list[AgentProfile] = []
self._rr_index: int = 0
self._affinities: dict[str, tuple[str, float]] = {} # session_id → (agent_id, timestamp)
self._affinity_ttl: int = 300 # secondes
def register(self, agent: AgentProfile):
self.agents.append(agent)
def _healthy_agents(self, capability: str = None) -> list[AgentProfile]:
candidates = [a for a in self.agents if a.healthy]
if capability:
candidates = [a for a in candidates if capability in a.capabilities]
# Filtrer selon le pourcentage canary
candidates = [a for a in candidates if random.random() * 100 <= a.canary_traffic_pct]
return candidates
def route(
self,
task_type: str = None,
session_id: str = None,
priority: str = "normal",
max_cost_per_1k: float = None,
) -> Optional[AgentProfile]:
import time
# Sticky session — vérifier TTL
if session_id and session_id in self._affinities:
agent_id, ts = self._affinities[session_id]
if time.time() - ts < self._affinity_ttl:
agent = next((a for a in self.agents if a.id == agent_id and a.healthy), None)
if agent:
return agent
else:
del self._affinities[session_id]
candidates = self._healthy_agents(capability=task_type)
if max_cost_per_1k:
candidates = [a for a in candidates if a.cost_per_1k_tokens <= max_cost_per_1k]
if not candidates:
return None
selected = self._apply_strategy(candidates, priority)
if session_id and selected:
self._affinities[session_id] = (selected.id, time.time())
return selected
def _apply_strategy(self, candidates: list[AgentProfile], priority: str) -> AgentProfile:
if self.strategy == RoutingStrategy.ROUND_ROBIN:
agent = candidates[self._rr_index % len(candidates)]
self._rr_index += 1
return agent
elif self.strategy == RoutingStrategy.LEAST_CONNECTIONS:
return min(candidates, key=lambda a: a.active_tasks)
elif self.strategy == RoutingStrategy.WEIGHTED:
total = sum(a.weight for a in candidates)
r = random.uniform(0, total)
cumul = 0
for a in candidates:
cumul += a.weight
if r <= cumul:
return a
return candidates[-1]
elif self.strategy == RoutingStrategy.CAPABILITY_BASED:
return min(candidates, key=lambda a: (a.error_rate, a.avg_latency))
elif self.strategy == RoutingStrategy.COST_BASED:
if priority == "urgent":
return min(candidates, key=lambda a: a.avg_latency)
return min(candidates, key=lambda a: a.cost_per_1k_tokens)
return random.choice(candidates)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 316 lines · 73 tokens per session scan A 15728be37a39
load-balancer is a skill published in the GitHub repository khalilbenaz/claude-skills-collection (27 stars, last pushed 3mo ago), licensed MIT. It adds 73 tokens to every session and 3,152 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
load-balancer compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| load-balancerkhalilbenaz/claude-skills-collection | Skill | 27 | 3mo ago | MIT | A | 73 | Claude Code, Codex |
| explainsoftspark/ai-toolkit | Skill | 180 | 13d ago | Apache-2.0 | A | 34 | Claude Code |
| finance-econ-literacymodu-ai/moai-cowork | Skill | 320 | 1mo ago | Apache-2.0 | A | 128 | Claude Code |
| exposure-guidanceellmos-ai/skills | Skill | 10 | today | MIT | A | 117 | Claude Code, Codex |
| systemisch-loesungsfokussiertellmos-ai/skills | Skill | 10 | today | MIT | A | 127 | Claude Code, Codex |
| trauma-psychoeducationellmos-ai/skills | Skill | 10 | today | MIT | A | 40 | Claude Code, Codex |
| act-techniquesellmos-ai/skills | Skill | 10 | today | MIT | A | 127 | Claude Code, Codex |