Your track_shipment(tracking_id) tool queries an external logistics API that sometimes fails - the API may be temporarily unavailable, the tracking ID may be malformed, or the shipment may not exist. Currently, your tool raises a Python exception when errors occur. Users report the agent gives unhelpful responses like "I'm having trouble with that request" instead of suggesting alternatives such as verifying the tracking number format or checking by order number. How should you handle errors in tool results?
Select one answer.
Marked answer: A
Community Discussion
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
Chose A0
- Structured error output gives the agent enough information to respond usefully. Including the error type, whether the issue is recoverable, and actionable guidance allows the agent to distinguish malformed tracking IDs, missing shipments, and temporary API failures, then suggest the correct next step to the user.