# `AgentWorkshop.Budget`
[🔗](https://github.com/joshrotenberg/agent_workshop/blob/main/lib/agent_workshop/budget.ex#L1)

Cost budget enforcement for Workshop agents.

Configurable budgets at global and per-agent levels. When a budget
is exceeded, `ask/2` and `cast/2` return `{:error, :budget_exceeded}`.

## Usage

    configure(max_cost_usd: 10.00)
    agent(:impl, "Coder", max_cost_usd: 2.00)

    budget()          # show global remaining
    budget(:impl)     # show per-agent remaining
    reset_budget()    # reset global tracking

# `check`

```elixir
@spec check(atom(), float(), float()) :: :ok | {:error, :budget_exceeded, String.t()}
```

Check if spending `cost` for `agent` would exceed any budget.

Returns `:ok` or `{:error, :budget_exceeded, reason}`.

# `clear`

```elixir
@spec clear() :: :ok
```

Clear budget limits (does not reset cost tracking — costs are in ETS agent entries).

# `info`

```elixir
@spec info(atom() | :global) :: map()
```

Get budget info for a specific agent or global.

# `set_agent`

```elixir
@spec set_agent(atom(), float()) :: :ok
```

Set a per-agent budget limit.

# `set_global`

```elixir
@spec set_global(float()) :: :ok
```

Set a global budget limit.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
