Use these notes to review a concept or read at your own pace. The interactive workspace above adds predictions, editable code, and actual run results.
IDEA 1
Follow a trace and its spans
A trace records observable events during one run, such as a tool request, its response, and an error. A span describes an operation within that trace, often with start and end times. These records help explain where work happened. They do not reveal a model's private reasoning, and a long trace is not automatically a thoughtful one.
The browser runner records your real JavaScript tool calls and a measured overall duration. Its data and decisions are authored simulations. It does not send tokens to a model or receive an API bill. Read the metrics according to what was actually measured, and keep private inputs out of logs when designing a real application.
Connect an output to observable events
- Request. The controller asks for item A.
- Response. The tool returns the fixture value.
- Run report. Inspect real call count and measured duration.
Follow this authored example, then test the idea in the lab.
Read the example
const item = tools.readItem("A");
return { value: item ? item.value : null };The trace can show that readItem was called and what it returned. It cannot establish an unrecorded live-model cost.
Think it through: What can this lab's trace directly establish?
IDEA 2
Find repeated work
Look for repeated operations with the same inputs. If a task reads item A three times from a fixed catalog, the second and third reads may add no information. Reusing the first observation can reduce work while preserving the requested result. First identify the repetition in the trace, then make a small change and compare behavior.
Correctness still comes first. A program that makes zero calls and guesses values is cheaper by call count but does not satisfy the evidence requirement. In this lab the output must preserve request order, including repeated values, while reading each distinct item only once. The trace exposes whether the code achieves both goals.
One observation can serve repeated requests
- Requests. The caller asks for A, B, then A again.
- Reads. Fetch each distinct item once.
- Output. Return values in the original request order.
Follow this authored example, then test the idea in the lab.
Read the example
if (!cache.has(id)) cache.set(id, tools.readItem(id));
const item = cache.get(id);Map.has distinguishes a cached missing result from an item that has never been requested. A truthiness check would read missing items repeatedly.
Think it through: Why can if (!cache.get(id)) cause extra reads for missing items?
IDEA 3
Cache only when the key and lifetime are valid
A cache is a stored observation reused instead of a new lookup. Its key must include everything that affects the result. An item ID is enough for this fixed catalog within one run. In a real service, the result might also depend on the user, location, permissions, catalog version, or time. Leaving those out can reuse the wrong information.
This cache is created inside solve and disappears when the run ends. A new case receives a new catalog and a new cache. That deliberately avoids pretending that old availability or prices remain fresh forever. Also distinguish caching a confirmed missing record from caching a temporary failure: the latter may hide recovery. Our readItem tool returns a record or confirmed fixture absence, not a transient network error.
Give every cache a scope
- Key. Item ID is valid within this one fixed catalog.
- Lifetime. A new solve call starts an empty cache.
- Fresh run. Changed fixture values are read again.
Follow this authored example, then test the idea in the lab.
Read the example
function solve(input, tools) {
const cache = new Map();
// This cache belongs to this run only.
}Local scope is the expiration rule here. It is not a production cache invalidation strategy for changing external data.
Think it through: A real room-availability result depends on both room and date. Which cache key is sufficient?
Put it into practice
Return one value for each request in order while reading each distinct ID at most once per run.
- Read the selected case and predict its expected result.
- Run the starter once. Use the failed check and tool trace to locate the missing rule.
- Insert the explained snippet at the TODO, then run the case again.
- Test all three cases. Change the experiment input and explain whether the same rule still works.
Your next experiment: Add two more requests for A and one new request for C. Predict the output length and the number of distinct tool reads before running.
Measure the work that actually happened, then reduce repetition without weakening evidence or freshness.
Key terms
- Trace
- A record of observable operations and results in a run.
- Span
- A recorded operation within a trace, often with start and end times.
- Cache key
- The inputs used to identify which stored observation can be reused.
Sources and scope
Original Stemtiq teaching, reviewed 2026-09-14. The named researchers and organizations do not endorse this course. Classroom cases are authored exercises, not published findings.
AWS · Amazon Bedrock AgentCore: Observe your agent applications on Amazon Bedrock AgentCore Observability
Reviewed 13 September 2026 · undated documentation
Use instrumented traces and operational measurements to inspect execution, intermediate outputs, duration, errors, and reported model usage.
Monitoring does not enforce a budget or make an answer correct. Tool calls, tokens, elapsed time, and money are different quantities; simulated models provide no real token bill.
NVIDIA: Agent Evaluation in NVIDIA NeMo Agent Toolkit
Version 1.8 observed · reviewed 13 September 2026
Run curated cases, inspect generated answers and intermediate steps, retain effective configurations, and enable profiling when operational measurements are needed.
Different artifacts require different configuration. Scores depend on cases and graders; timing measurements do not establish correctness, and model-based grading is fallible.
Amazon Builders’ Library: Caching challenges and strategies
Reviewed 13 September 2026 · undated guidance
Reusing observations can reduce dependency calls; cache scope, freshness, and failure behavior need deliberate design.
A room ID is a sufficient classroom cache key only while the task and room facts remain unchanged. Caching does not itself refresh stale information.