P141 · Tool use

REPL as Tool Composition

Compose documented tool calls with explicit data flow in a programming layer.

Editorially reviewedSource unconfirmed

These examples and illustrative results are independently authored teaching materials, not measured model results.

Use case

Read two permitted logs then summarize. Teaching readLog returns ok/text/path or ok=false/error, and transport can reject. A fulfilled Promise is not necessarily successful business reading.

Mechanism

Compose documented APIs, parallelize independent reads and inspect every settled transport/business result. Preserve observed text/provenance and failures separately; summarize actual data only and sequence dependent actions afterward.

Bad example

Invent convenience APIs, lose remaining results on Promise.all rejection or treat fulfilled error objects as log content.

Good example

Use verified teaching readLog(path) on logs/a.log/b.log with Promise.allSettled. Inspect rejection and fulfilled ok=false; send successful text/path to synthesis while listing failures/unread scope. Execute dependencies after inspection without invented data or assuming readLog exists on the real host.

Why the change matters

Executable flow makes waits/branches/errors inspectable. Business-state checks prevent returned objects from becoming false success while independent valid data remains useful.

Observable expectation

A success/B rejection retains A plus B transport failure; fulfilled ok=false is a read failure, not content. Both requested paths have dispositions.

Inspect no hidden errors/unread summaries and verified API/scope. No real logs are read.

Limits

Envelope/error shapes vary and need documentation. REPL permission/lifetime/output limits remain; composition authorizes no concurrent writes. Provenance is unconfirmed.

Sources and evidence

Source text has not been located. This method meets the editorial criteria; its examples are independent teaching constructions.

Read the editorial criteria

Related methods