pub struct ResourceBudget {
pub fuel: Option<u64>,
pub max_memory_bytes: Option<u64>,
pub wall_time_ms: Option<u64>,
pub max_tokens: Option<u64>,
pub max_cost_usd: Option<f64>,
pub max_output_bytes: Option<u64>,
}Expand description
The resource budget a capsule invocation may consume. Every field is
optional on the wire; None means the enclosing run’s own budget
bounds apply — never an invented default, per the AgentBudget
convention.
Fields§
§fuel: Option<u64>CPU budget in Wasmtime fuel units (deterministic, replay-stable).
max_memory_bytes: Option<u64>Linear-memory cap in bytes.
wall_time_ms: Option<u64>Wall-time bound in milliseconds, enforced by epoch interruption.
max_tokens: Option<u64>Token budget for model usage (evidence-grade, matching
AgentBudget).
max_cost_usd: Option<f64>Cost budget in USD for model usage (evidence-grade f64, matching
AgentBudget).
max_output_bytes: Option<u64>Upper bound on the guest’s result payload in bytes, checked before the host accepts the output.
Implementations§
Source§impl ResourceBudget
impl ResourceBudget
Sourcepub fn clamp(&self, ceiling: &ResourceBudget) -> ResourceBudget
pub fn clamp(&self, ceiling: &ResourceBudget) -> ResourceBudget
Field-wise minimum against an enclosing scope’s ceiling: the
effective budget is never wider than what either layer declared.
None in one layer means that layer imposes no bound, so the other
layer’s bound (if any) applies. This is the admission clamp the
design names — capsule budget ≤ the run’s budgets ≤ tenant quotas
— reduced to its wave-1 pair; the quota layers compose the same
way when they arrive.