← All examples
AgentSpendBudget
examples/AgentSpendBudget.thunder
AgentSpendBudget.thunder
1# area: Agent safety2mission AgentSpendBudget34goal5 Admit an agent step only when its reserved cost fits the remaining budget.67why8 Repeated model and tool calls need a predictable spending boundary.910guarantee a proposed charge stays inside the remaining budget11 verify test SpendAdmission1213never admit negative cost or negative remaining budget14 verify test SpendAdmission1516decision SpendAdmission17 inputs18 remainingCents19 reservedCents20 rule affordable step21 when remainingCents >= 0 and reservedCents >= 0 and reservedCents <= remainingCents22 return Admit23 default24 return Stop2526test SpendAdmission27 case below the budget28 given remainingCents 100, reservedCents 9929 expect Admit30 case exactly at the budget31 given remainingCents 100, reservedCents 10032 expect Admit33 case above the budget34 given remainingCents 100, reservedCents 10135 expect Stop36 case exhausted budget37 given remainingCents 0, reservedCents 138 expect Stop39 case negative reservation40 given remainingCents 100, reservedCents -141 expect Stop42 case negative budget43 given remainingCents -1, reservedCents 044 expect Stop4546note engineering47 The host must validate integer cents, reserve atomically across concurrent calls, and reconcile actual cost. These cases test admission only.Draft syntax. This file is illustrative and does not run yet.
More examples
AgentToolAuthorizationAlertRoutingApiGatewayBillingServiceCalculateRiskScoreCertificationAttemptCertificationCheckoutCertificationEligibilityCertificationStudyPlanCreateInvoiceCreateStudyPlanCustomerDataRequestDuplicateInvoicePreventionGroundedAnswerIngestClickstreamInvoiceCreatedNetworkEgressPolicyPlaceOrderResearchAgentRunResetPasswordStorefrontStyleSubscriptionUpgradeTenantIsolationTwelveFactorAgentUploadStudyMaterial