fabric/budget

A family budget: one bound shared by a root run and every run it delegates to, below each run’s own turn, token and sub-agent limits. Admission counts are conservative: a saved grant is never refunded implicitly, even when its work fails or is lost.

agent.new("desk", model, tools, policy)
|> agent.with_family_budget(
  budget.limits(work: 200) |> budget.with_children(10) |> budget.with_depth(2),
)

Types

Why the family budget refused work.

pub type Denial {
  WorkLimit(limit: Int)
  ChildLimit(limit: Int)
  DepthLimit(maximum: Int, requested: Int)
}

Constructors

  • WorkLimit(limit: Int)
  • ChildLimit(limit: Int)
  • DepthLimit(maximum: Int, requested: Int)

The bounds of one family. Build them with limits.

pub type Limits =
  @internal Limits
pub type Usage {
  Usage(work: Int, children: Int)
}

Constructors

  • Usage(work: Int, children: Int)

Values

pub fn limits(work work: Int) -> Limits

At most work units of work in the whole family: each model attempt, tool action and graph attempt counts one. As many sub-agent runs as units of work, nested at most 16 levels below the root.

pub fn with_children(limits: Limits, children: Int) -> Limits

At most children sub-agent and child runs in the whole family.

pub fn with_depth(limits: Limits, depth: Int) -> Limits

Child runs nest at most depth levels below the root (at most 63).

✨ Search Document