Skip to content
Français

WorkflowBudget

import type { WorkflowBudget } from "@elie-laloum/outpost/workflows";
  • pricesOptional
    ModelPriceTable | undefined
    Model rates per million tokens. Enables model attribution in built-in workflow task helpers and adds cost to result.usage, even without a monetary limit. Copied when accounting starts.
  • costOptional
    { readonly currency: "EUR" | "USD"; readonly limit: number; } | undefined
    Shared monetary limit with currency and finite nonnegative limit. Requires prices in the same currency; reaching it cancels running attempts and blocks admissions. Unknown cost fails even with an attempts limit.
  • attemptsOptional
    number | undefined
    Maximum attempts admitted across the workflow or speculation and its checkpoint resumes. Refuses further admissions while running attempts may finish. A later token or cost limit still cancels running work. Using the last allowed attempt alone is not a failure.
  • usageOptional
    Partial<Omit<Usage, "models" | "complete">> | undefined
    Token limits per counter (input, cached, cacheCreated, output). Reaching one cancels running tasks too; usage reported late can exceed it.
export interface WorkflowBudget {
  readonly prices?: ModelPriceTable;
  readonly cost?: {
    readonly currency: "EUR" | "USD";
    readonly limit: number;
  };
  readonly attempts?: number;
  readonly usage?: Partial<Omit<Usage, "complete" | "models">>;
}