Tool use: from a proposed call to a checked result
Separate proposed actions from execution, validate arguments and permissions, and reason about retries and observations.
Preparation: basic arithmetic, units and structured data.
Plan 25–40 minutes with the activities; this is a study estimate, not a timed requirement. Both paths have complete narration. Your notes and progress are kept separately for each level.
FULL LOCAL NARRATION
Follow the complete explanation.
Narration includes worked solutions. Pause at each practice prompt before continuing. Formula notation has a spoken explanation; all teaching text remains readable.
A tool call is a proposal, not an accomplished action
College path. Separate proposed actions from execution, validate arguments and permissions, and reason about retries and observations. Preparation: basic arithmetic, units and structured data. Move between Signal Room, Workbench and Field Notes without losing your section. Pause before each worked solution.
A language model can propose using a calculator, searching a collection or creating a calendar item. The application decides whether and how to execute that proposal. Describing an action in text is not the same as performing it. A complete interaction includes a requested operation, validated arguments, execution, an observation and an answer that reflects the observation. This separation matters even for a calculator. If the application never runs the calculation, the model must not report a verified result. Our Workbench uses a local deterministic calculator and a simulated reservation ledger. It does not connect to an account or place a real reservation.
Toolformer studies learning when and how to call APIs using generated training examples filtered for usefulness. ReAct studies interleaving reasoning and actions with observations. These are related ideas, not the same training method or a guarantee of reliability. Our controller is hand-written and transparent, so it illustrates the execution boundary rather than claiming to reproduce either model. Tool invocation is an application protocol around a model, not a new mathematical attention operation.
Worked example. The proposed request is to divide 24 by six. A text response saying “calculator returned four” is not evidence unless the calculator actually ran and its result was received. The Workbench records whether execution was reached and shows the returned value.
The displayed notation records the process described in the example. Keep its assumptions and units attached to the result.
Try it yourself. Who should enforce the allowed operation: only the text-generating model, or also the application executing the call?
Pause the narration and explain your reasoning before continuing to the worked solution.
Reveal worked solution
The application must enforce its own rules before execution. The model can help propose a suitable call, but a generated proposal cannot authorize itself. Keep execution status and returned evidence separate from the model’s description of what it intended.
Section 02 / 07
Write a small contract for arguments
A tool contract states the operation name, required fields, types and allowed values. Our calculator requires exactly the fields numerator and denominator, each a finite number, with denominator nonzero. The Workbench can send a valid numeric denominator, a numeric-looking string, or omit the field. A string containing “6” is not the same typed value as the number six. This fixture rejects it rather than silently converting it. Real tools may choose explicit coercion rules, but those rules should be documented. Syntactically valid structured data is only the first gate; the operation must also make sense and be permitted.
In JSON Schema, declaring properties does not by itself make them required or reject additional fields. Required fields and extra-property behavior need explicit constraints. Our compact validator implements a stated subset directly rather than loading a schema library. It additionally rejects non-finite numbers and division by zero as semantic checks. Schema validity cannot establish that the operands correspond to the user’s intended quantities, so unit and task checks remain necessary.
Worked example. Three candidate objects carry denominator values six, the string “6”, and no denominator. Under our strict contract only the first passes type and presence checks. Changing the interface to allow strings would change the contract, not make these cases equivalent automatically.
The displayed notation records the process described in the example. Keep its assumptions and units attached to the result.
Try it yourself. Can an object with all required numeric fields still describe the wrong calculation?
Pause the narration and explain your reasoning before continuing to the worked solution.
Reveal worked solution
Yes. The numerator and denominator may be swapped, use incompatible units, or refer to the wrong question. Structural validation checks shape and types. Semantic validation checks whether the operation is meaningful for the intended task.
Section 03 / 07
Keep units and numerical meaning attached
Calculators make arithmetic reproducible, but they cannot repair a wrongly framed question. Dividing 24 meters by six seconds gives four meters per second; dividing six by 24 answers a different question. A zero denominator is not an invitation to guess. The Workbench numerator ranges from zero to 48 and denominator from zero to 12. The result is available only when validation passes and tool use is allowed. A zero numerator with a nonzero denominator is a valid result of zero. Do not confuse that legitimate zero with a blocked calculation. The status trace explains which case occurred.
Numerical tool design includes range, precision and representation choices. This teaching calculator uses ordinary floating-point division and displays rounded values while preserving the computed value in the detailed record. It is not an arbitrary-precision symbolic system. Compare values with a suitable numerical tolerance in tests. For physical measurements, uncertainty and units belong to the data contract; a perfectly executed quotient can still be scientifically inappropriate.
Worked example. Set numerator 24 and denominator six to obtain four. Set denominator zero and execution is rejected. Set numerator zero and denominator six and the result is zero with successful status. These last two runs must not share the same success flag.
24 meters / 6 seconds = 4 meters per second
The displayed notation records the process described in the example. Keep its assumptions and units attached to the result.
Try it yourself. Why is checking only whether the displayed numerical result equals zero insufficient?
Pause the narration and explain your reasoning before continuing to the worked solution.
Reveal worked solution
Zero can be a valid quotient, while a failed call may have no numerical result at all. Inspect the explicit status and observation. In our raw record, a missing result is null, and successful zero remains the number zero.
Section 04 / 07
Permission is separate from a valid request
A request can have perfect syntax and still be disallowed. Our permission control represents an application decision that is checked after argument validation and before execution. Turning permission off prevents the calculator from running. It is a teaching switch, not a real authentication service. For a real application, permissions should be tied to the user, operation and resource, and applied where the operation is executed. Reading information and changing something have different consequences. Asking an assistant for a draft does not automatically authorize sending that draft. The system should report the blocked status honestly instead of pretending the operation succeeded.
Use least privilege and narrow capabilities to limit what an executing component can do. Schema constraints reduce malformed inputs; authorization controls which valid operations are allowed. These are complementary rather than interchangeable. Separate a policy decision from a model-generated justification. A tool result can supply evidence, but cannot expand its own permission scope. Test denied operations as first-class outcomes rather than treating every refusal as an infrastructure fault.
Worked example. With 24 and six, the arguments are valid. Permission zero makes the run stop before division; permission one allows it. In a calendar application, a similar boundary could allow reading free times while requiring separate authority to create a booking.
The displayed notation records the process described in the example. Keep its assumptions and units attached to the result.
Try it yourself. Does a tool response asking the assistant to perform another operation grant permission for that operation?
Pause the narration and explain your reasoning before continuing to the worked solution.
Reveal worked solution
No. A response is an observation to interpret under the existing task and permissions. It does not become a new user request or an authorization token simply because it came through a tool channel.
Section 05 / 07
Handle missing responses without duplicating effects
A timeout is ambiguous: the operation may have failed, or it may have succeeded while its response was lost. Retrying a read is often different from retrying a reservation or payment. Our ledger fixture starts empty on every run. The first valid reservation request always commits once, but its acknowledgement is deliberately lost. You choose zero, one or two retries. Without deduplication, every retry creates another entry. With a stable request key and server-side deduplication, retries return the original receipt. No real reservation is made. This experiment illustrates why “I did not receive success” does not mean “nothing happened.”
Idempotency requires an explicit service contract: the key identifies the same intended operation, repeated parameters must agree, and retention or expiration behavior matters. A client-generated key alone is not enough if the server ignores it. Our ledger models one request, one key and an unbounded key lifetime within a single run. It does not claim exactly-once delivery over a network or model concurrent transactions and crash recovery.
Worked example. Use two retries. Without a key, the first request and both retries produce three ledger entries. With deduplication, there is one entry and the later acknowledgements refer to it. With zero retries, one entry exists but the client still has no receipt.
The displayed notation records the process described in the example. Keep its assumptions and units attached to the result.
Try it yourself. After the first acknowledgement is lost, is immediately repeating a non-idempotent write always safe?
Pause the narration and explain your reasoning before continuing to the worked solution.
Reveal worked solution
No. The write may already have committed. Use an appropriate reconciliation or idempotency mechanism according to the service contract. Our example makes the hidden committed effect visible so you can compare it with what the client knows.
Section 06 / 07
Inspect observations and distinguish kinds of failure
A tool can return a usable value, a validation error, a denial, a temporary failure or an ambiguous outcome. These should not all become the same generic “something went wrong” message. Preserve enough structured information to choose a sensible next step. A missing required field suggests repairing the proposal. A denial suggests respecting the boundary or asking the authorized user. A timeout after a write calls for checking whether it committed. In the Workbench, the trace shows validation, permission and execution stages, while the ledger separately reports effects and receipt availability. This keeps environmental facts separate from the assistant’s confidence.
Error categories are part of the tool interface. Retry only when the error type and operation semantics justify it, and impose a finite retry budget. Tool outputs can contain stale, malformed or instruction-like text, so validate the returned shape and treat content as data. Logging should support diagnosis without exposing secrets. A reliable observation includes the operation identity, status and relevant result, not just a natural-language assertion that everything worked.
Worked example. Compare a missing denominator with a lost reservation receipt. The missing denominator means the calculator never executed. The lost receipt occurs after the simulated ledger committed. Both lack a usable response, but only one has a side effect to reconcile.
No observation ≠ no effect; explicit status guides recovery
The displayed notation records the process described in the example. Keep its assumptions and units attached to the result.
Try it yourself. What fact should an assistant communicate if it cannot confirm whether a write completed?
Pause the narration and explain your reasoning before continuing to the worked solution.
Reveal worked solution
It should report the uncertainty and the evidence available, rather than claim either success or failure without support. Then follow the service’s documented status-check or deduplication procedure within the authorized scope.
Section 07 / 07
Test the contract and the complete task
Test both successful and unsuccessful paths. For this module, include a normal quotient, a zero numerator, a zero denominator, a string value, a missing field and denied permission. For the ledger, compare all retry counts with and without a stable key. Then ask whether the final response states the result and status accurately. A tool can pass unit tests while an assistant calls it with the wrong numbers. Conversely, a good plan can fail because the tool is unavailable. Keep these failures distinct. Save an experiment record containing your prediction, settings and interpretation, then compare it with the visible trace.
Evaluation should include task selection, argument correctness, permission compliance, execution reliability and answer fidelity. A single overall success rate can hide a dangerous error class. Use fixtures to test boundaries deterministically, then validate with representative end-to-end tasks. Our finite test domain proves properties of the teaching implementation, not the performance of an arbitrary tool-using model. No external account or model is involved in these experiments.
Worked example. A student sets numerator zero, denominator six, numeric mode and allowed permission. The correct report is “executed, result zero.” A program that tests only the truthiness of the result may incorrectly report failure. This is a useful regression case.
End-to-end task quality includes selection, arguments, execution and reporting
The displayed notation records the process described in the example. Keep its assumptions and units attached to the result.
Try it yourself. If every calculator execution returns the correct quotient, has the entire assistant been proven reliable?
Pause the narration and explain your reasoning before continuing to the worked solution.
Reveal worked solution
No. You still need evidence that it selects the appropriate tool, supplies the intended arguments, respects permissions and accurately communicates observations. Correct execution is one stage of a larger task.
Final checkpoint. Is a client request key sufficient for deduplication? Option 1: Yes. Option 2: No; the service must enforce its idempotency contract. Option 3: Only when the key is numeric.
Pause and choose an answer before continuing.
Reveal worked solution
Option 2 is correct. The server must recognize and enforce the repeated operation identity.
WORKBENCH / PREDICT → TEST → EXPLAIN
Inspect exact numerical data
These are computed teaching fixtures. No remote AI model or GPU is called by the experiment.
CHECK YOUR UNDERSTANDING
Commit to an explanation.
Keep your learning record.
INTEGRATED CAPSTONE
Turn evidence into a cited briefing
Worked examples, local narration and connected experiments at your level.
Original worked examples and teaching text, grounded in these primary references. Numerical fixtures explain mechanisms; model quality and hardware performance require separate measurements. Both levels share key examples, with different explanations and checkpoints.