A structured lesson workspace with readable content, hands-on examples, and a clean path to completion.
Our conference offers inline, corner, and peninsula booths. Each has different minimum sizes and pricing tiers. If you ask an LLM to calculate a multi-tier discount with tax, it will hallucinate the numbers. LLMs are text generators, not calculators.
Build the offer calculation tool
This video requires an access code. Enter your code below to unlock it instantly.
Don't have a code? Contact us to get access.
We offload deterministic math to a JavaScript Code node. This tool takes the booth type and requested square footage as inputs, runs the arithmetic, and returns a strict JSON object containing the subtotal and registration fees.
const type = $input.item.json.exhibit_type;const size = $input.item.json.size_sqft;if (type === 'inline' && size < 100) throw new Error('Minimum 100 sqft');const base = size * 50;const fee = 500;return [{ json: { total: base + fee } }];
Add this as a 'Code Tool' to the agent. Define the input schema so the LLM knows it must provide 'exhibit_type' and 'size_sqft'. Include the minimum size requirements directly in the tool description to prevent the agent from triggering unnecessary error loops.
Notice how the agent automatically translated '150 square meters' into '1615 square feet' before calling the tool. The LLM handles the semantic translation; the Code node handles the strict arithmetic.
Finish the lesson once you have worked through the material. This awards ★ 30 XP.