Skip to content

v0.14.5: super on budget checks

Latest

Choose a tag to compare

@eadwinCode eadwinCode released this 03 Nov 21:02
f7e8a6d

A replaced budget check can now call the default as super, and a run always stops at its cap even when its budget event fails to send. Go module github.com/eadwinCode/agentic-kit/packages/go-agentenkit@v0.14.5, npm agentenkit@0.14.5 and use-agentenkit@0.14.5.

No breaking changes for checks the loop builds. A check object you build by hand to pass to your own hook must now set super (Go: Super).

New: super on budget checks (#46)

TS: c.super(c). Go: c.Super(ctx, c).

  • It is the default check: the token cap or the money cap. Call it to keep the cap and add your own rule on top.
  • When it returns true it has already sent TOKEN_BUDGET_EXHAUSTED or COST_BUDGET_EXHAUSTED. Don't send it again.
  • The TS defaults (defaultCheckTokenBudgetExhausted, defaultCheckCostBudgetExhausted) still take a check without super, so calling them directly still compiles.

Fixed (#47)

  • A budget event that fails to send no longer lets a run go past its cap. In TS, a failed send inside the default check threw, and the loop read that as "don't stop". Go ignored the error and stopped. The publish a check gets now logs a failure and never throws (Go: returns nil), so both runtimes stop.

Docs

  • The package READMEs and Multi-tenancy point to the budget check hooks. Multi-tenancy says to refuse an empty balance in billingPreCheck, since the first step of a segment runs before any check.

See Your own budget checks.