October workshops are openBuild a Search AI Agent$99 early bird

Enroll now
Skip to content

PATHWAY PROJECT · STARTER PROJECT · 2 SMALL IDEAS + A GUIDED LAB

Fundraiser budget checker

The supplies cost $6.00. Does a $7.00 budget still work after delivery?

You will learn to: Calculate a fictional supply basket using integer cents, preserve unknown prices, and report stock and budget constraints independently.

Preparing your lesson and this browser’s progress…
Read the complete lessonAll the ideas in one place · works without the editor

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

A total needs all the included costs

A budget is a spending limit. A subtotal adds the item costs; a total includes the other costs defined by your specification. This project uses fictional supplies and one delivery charge. Taxes are outside this fixture, so the result must not be described as a real purchase quote.

Store cents as integers for this small currency exercise: 250 means $2.50. Multiplying integer cents by an integer quantity avoids common decimal-rounding surprises for these fixture amounts. Use ordinary arithmetic tools for exact calculations; fluent model text is not a substitute for an auditable total.

From catalog to budget decision

  1. Read prices. Get each unit price from the catalog fixture.
  2. Multiply. Three units cost 600 cents.
  3. Add delivery. Include the quoted 100-cent delivery charge.
  4. Compare. An exact 700-cent budget is sufficient.

This is a deterministic tool workflow over invented data, with no payment or investment action.

Exact boundary

const totalCents = 200 * 3 + 100;
const withinBudget = totalCents <= 700; // true

The <= comparison includes a total exactly at the budget. It should fail when the total is even one cent above it.

Think it through: A basket costs 600 cents plus 100 cents delivery. What fits a 700-cent limit?

IDEA 2

Unknown is different from zero

A missing price is not a free item. If an item price or delivery quote is unknown, the complete total is unknown too. Return null for the total and budget comparison, and name the missing evidence. That lets a reviewer distinguish an unanswered question from a valid zero-cost quote.

Stock is a separate constraint. A basket can fit its budget while requesting more units than the catalog says are available. Report the stock issue even if another cost is missing; do not let one failure hide the others. These flags explain the fictional plan, and do not reserve supplies or authorize a purchase.

Keep cost and stock separate

  1. Missing price. Preserve the absence of evidence.
  2. Unknown total. Do not silently substitute zero.
  3. Independent stock. Compare requested quantity with the supplied stock.

The output contains an explicit issue for each observed limitation.

Unknown budget status

const withinBudget = totalCents === null ? null : totalCents <= input.budgetCents;

A null comparison means insufficient cost evidence. False means the complete known total exceeds the budget; they require different next steps.

Think it through: The delivery quote is missing. Which result is honest?

Put it into practice

Complete an exact-cent total and keep missing evidence and stock issues visible.

  1. Run the exact-budget case and compare the starter's total with the delivery quote.
  2. Insert the delivery tool call.
  3. Run all three cases, including the unknown price and insufficient stock.
  4. In custom input, try a missing delivery quote or a total one cent above budget.

Your next experiment: Set deliveryCents to null. Then restore 100 and lower the budget by one cent. How do unknown and over-budget outputs differ?

Calculate with explicit units and keep unknown costs separate from known failures.

Key terms

Subtotal
The sum of item costs before the other specified charges.
Integer cents
Whole-number hundredths of a dollar used as the unit for this exercise.
Constraint
A condition a plan must satisfy, such as budget or stock availability.

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.

MDN Web Docs: JavaScript Guide

Updated 7 November 2025

Functions, objects, conditions, loops, and asynchronous code provide the programming foundations for an agent controller.

Ordinary JavaScript rules do not imply that a language model is running. An execution environment may support only part of the language or its host APIs.

Anthropic: Writing effective tools for agents — with agents

11 September 2025

Design distinct tools with clear parameters, relevant returned information, and evaluations of how the agent actually uses them.

A description or schema does not guarantee the right action. A live tool can return different data for the same arguments as its environment changes.

Anthropic: Building effective agents

19 December 2024

Distinguish fixed workflows from model-directed actions; start simply, use tool observations as feedback, and set stopping conditions.

The article notes that its tooling landscape has changed. Its patterns do not establish that a more autonomous or complex system is better for every task.

Your JavaScript really runs. The model decisions and school data are authored simulations, so you can learn without an API key. Every workspace also includes a separate real SDK example to explore next. Passing the lab’s cases is practice, not proof that an agent is ready for real-world use.