Token LabSearch

← All experiments
Bounded agent workflows / 4 OF 5

Budget exhaustion

The second paid action is blocked before exceeding budget.

Local calculation / simulation

Local educational experiment. No external API calls. Synthetic fixtures are not production measurements.

Study guide & lesson outlineLEARNING CONTRACT

Understand → implement → investigate

Goal: explain the mechanism in this lesson, reproduce one example and test a failure case. Reading alone does not mark mastery.

02 · Predict & configure

Technical scenario notes, parameter names and reference answers are currently in English.

03 · Inspect the evidence

Run this experiment to see results.

Methods & references

A deterministic state machine executes your plan against mock tools, not an autonomous language model. Each executed tool costs a synthetic $0.01. The write action never changes external data. Each mock result is truncated to 1,000 characters to bound memory. Guards are illustrative policy rules, not a complete security system.

Text / 原始公式
Plan → allowlist → approval → budget → mock tool → FIFO memory → next step

A tool allowlist alone cannot prevent data exfiltration or prompt injection in a real agent.

ReAct · reasoning and tool actions ↗

Practice questions

agent-4 / 01What does “Budget exhaustion” test?

The second paid action is blocked before exceeding budget.

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
agent-4 / 02Which computation produces the result in “Budget exhaustion”?

Plan → allowlist → approval → budget → mock tool → FIFO memory → next step

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
agent-4 / 03What is the baseline configuration for “Budget exhaustion”?

{"plan":"search,calculator,recall,write","allowed":"search,calculator,recall,write","steps":6,"budget":0.01,"memory":3,"approval":0}

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
agent-4 / 04What numerical result should you check for “Budget exhaustion”?

{"Executed / observed steps":1,"Simulated cost (USD)":0.01,"Memory entries":1}

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
agent-4 / 05How would you run a controlled comparison for “Budget exhaustion”?

Keep the supplied fixture and other settings fixed; change steps. Inspect the trace, stopping reason, simulated spend and retained memory.

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
agent-4 / 06What failure could invalidate a conclusion from “Budget exhaustion”?

A tool allowlist alone cannot prevent data exfiltration or prompt injection in a real agent.

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
agent-4 / 07Is “Budget exhaustion” a benchmark of a deployed language model?

No. A deterministic state machine executes your plan against mock tools, not an autonomous language model. Each executed tool costs a synthetic $0.01. The write action never changes external data. Each mock result is truncated to 1,000 characters to bound memory. Guards are illustrative policy rules, not a complete security system.

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
agent-4 / 08Which evidence should you report for “Budget exhaustion”?

Inspect the trace, stopping reason, simulated spend and retained memory. Export inputs, engine, result and method; distinguish synthetic fixtures from observed production data.

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
agent-4 / 09How can another researcher reproduce “Budget exhaustion”?

Open agent-4, reset the preset, retain the exact inputs and run. The calculation is deterministic for identical inputs.

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
agent-4 / 10What is the next validation step after “Budget exhaustion”?

A tool allowlist alone cannot prevent data exfiltration or prompt injection in a real agent. Test the hypothesis on a representative held-out workload and document a baseline, success metric and stopping rule before claiming deployment readiness.

Original teaching answer / local derivation. Method reference: ReAct · reasoning and tool actions ↗

Open lab →
MATHEMATICAL REVIEW · 2026-10-26

Assumptions, implementation & acceptance

Tool budgets are nonnegative integers. Allowlist checks precede execution; exhausted budgets stop the loop. This deterministic mock tests orchestration, not an LLM’s planning competence.

Engine formulas, scenario presets and numerical safeguards reviewed. Seeded synthetic inputs are not a production benchmark.

Proposed tool and arguments → Allowlist + approval gate → Check step and cost budget → Mock result → bounded memory
Mechanism map: follow the transformations from top to bottom.

Before running: predict a boundary case

The second paid action is blocked before exceeding budget.

Hint: isolate the assumption

Keep the baseline input fixed, change one parameter or boundary, and compare both the numerical result and the claimed units. A passing example verifies this fixture only.

Minimal executable example

Save the example and linked modules in one folder. Use Node.js 22 or newer, then run node agent-4.mjs. No third-party runtime dependencies.

import {calculate,network} from './academy-core.mjs';
const params={
  "plan": "search,calculator,recall,write",
  "allowed": "search,calculator,recall,write",
  "steps": 6,
  "budget": 0.01,
  "memory": 3,
  "approval": 0
};
const result=calculate('agent',params);
console.log(result.metrics);

Test and transfer

The second paid action is blocked before exceeding budget.

Record input, code version, expected result and observed result in the notebook below. Then construct a counterexample that violates the assumption above and explain why the original conclusion no longer follows.

Download complete kit (.tar.gz) · Complete reference kit and regression checks

Predict, test and keep evidence

Before revealing an answer, predict one result. After the exercise, record the discrepancy and a transfer test. Saved locally across language editions.

Open notebook / export / clear →

The mathematical review scope is recorded per lesson. It does not establish empirical paper reproduction; report suspected errors in your notes. Review scope