Command Palette

Search for a command to run...

Hectal
Phase 8: Tools and Human Approval
AI Frontend · Exercise 2 of 5 PreviousNext
Intermediate

When the Tool Fails

This time lookupOrder throws. The model still writes an answer, but the tool part ends in output-error.

When the tool part is in output-error, show in #error exactly I could not look up your order. Nothing was changed. and show a button #retry with the text Try again that calls regenerate(). Disable #retry while a request is running (status is submitted or streaming). Show neither before the question is asked, and never show the raw error text.

What Check tests

  1. Before the question, there is no #error and no #retry
  2. After the tool fails, #error shows the friendly sentence
  3. The raw error text is not shown anywhere
  4. #retry says Try again and is enabled when the answer is complete
  5. The code calls regenerate

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.