---
name: "tool-call-budget-guard"
description: "Plan and enforce explicit limits around a tool-calling workflow. Use when the user needs: Get a budget ledger, stopping condition and graceful partial-result plan."
metadata: {"version": "2026-10-17.1", "category": "agents-workflows", "publisher": "AIDiveForge"}
---

# Tool-Call Budget Guard

Get a budget ledger, stopping condition and graceful partial-result plan.

## Requirements

Provide tool names, per-call cost assumptions and the allowed total budget.

## Workflow

1. Represent budget units explicitly: calls, tokens, money or elapsed time are not interchangeable.
2. Reserve budget for the next operation before dispatch and deny operations that exceed the remaining allowance.
3. Reconcile known actual cost after the call and keep failed/unknown-cost calls visible.
4. Define the useful partial result to return when a limit is reached; never silently raise the cap.
5. Test the boundary case where remaining budget equals one call and the case where it is insufficient.

## Worked example

Read `examples/input.txt` and `examples/expected.txt` before adapting the workflow.

## Acceptance checks

No more than one additional call may run. A batch must be reserved before dispatch, not checked after it spends the budget.

## Limits

This recipe is an integration contract, not a built-in billing control. An actual tool dispatcher must enforce the ledger atomically.

Worked example included. Model-specific performance and vendor compatibility have not been benchmarked.
