LLM Concurrency Budget (runner/llm-budget.ts)

gbrain-evals · eval/runner/llm-budget.ts · typescript · MIT
ai, analytics, testing, tag:concurrency

Provides a shared, configurable budget to limit concurrent LLM calls (e.g., judge scoring) across evaluation runs, with reset and default handling.

// Source: https://github.com/garrytan/gbrain-evals | License: MIT | Copyright 2026 Garry Tan
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Shared LLM concurrency bucket.
 *
 * WHAT IS ACTUALLY WIRED (audit tests-audit-06 — the old header claimed this
 * wrapped "the agent adapter (Sonnet) and the judge (Haiku)" while nothing
 * imported the module; the tests exercised dead code):
 *
 *   - judge.ts `scoreAnswer` — every judge Haiku call runs under
 *     `withLlmSlot` (default budget unless `JudgeConfig.budget` overrides).
 *     Every scoreAnswer caller (cat9-workflows, cat20-brainstorm,
 *     cat25-trajectory-routing, cat29-think-vs-search) therefore shares
 *     this cap for its JUDGE calls.
 *
 * NOT wired (each still calls `client.messages.create` directly

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key