> ## Documentation Index
> Fetch the complete documentation index at: https://smithers.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# <Aspects>

> Propagate token and latency budgets to descendant tasks.

```ts theme={"theme":{"light":"github-light","dark":"github-dark"}}
import { Aspects } from "smithers-orchestrator";

type TokenBudgetConfig = {
  max: number;
  perTask?: number;
  onExceeded?: "fail" | "warn" | "skip-remaining"; // default "fail"
};

type LatencySloConfig = {
  maxMs: number;
  perTask?: number;
  onExceeded?: "fail" | "warn"; // default "fail"
};

type TrackingConfig = { tokens?: boolean; latency?: boolean };

type AspectsProps = {
  tokenBudget?: TokenBudgetConfig;
  latencySlo?: LatencySloConfig;
  tracking?: TrackingConfig; // default all true
  children?: ReactNode;
};
```

```tsx theme={"theme":{"light":"github-light","dark":"github-dark"}}
<Workflow name="budgeted-workflow">
  <Aspects
    tokenBudget={{ max: 100_000, perTask: 25_000, onExceeded: "warn" }}
    latencySlo={{ maxMs: 30_000, onExceeded: "fail" }}
  >
    <Task id="analyze" output={outputs.analysis} agent={codeAgent}>
      Analyze the repository.
    </Task>
    <Task id="review" output={outputs.review} agent={reviewAgent}>
      Review the analysis.
    </Task>
  </Aspects>
</Workflow>
```

## Notes

* Nested `<Aspects>` inherit outer budgets wholesale: an inner `tokenBudget` or `latencySlo` replaces the parent's config for that field (no per-field merge), though `tracking`'s `tokens`/`latency` each fall back to the parent independently.
* Budgets enforce at task-dispatch time, independent of `tracking` (which only controls metric emission). Before each task, the engine checks accumulated tokens against `tokenBudget.max` and elapsed wall-clock against `latencySlo.maxMs`, then applies `onExceeded`: `fail` raises `ASPECT_BUDGET_EXCEEDED` and fails the run, `warn` logs and continues, `skip-remaining` skips the task; `perTask` limits aren't enforced yet.
* Accumulated token usage is per run, survives resume, and re-seeds from persisted token-usage events.
