Question 24
An Agent SDK support agent handles returns, billing disputes and account issues through MCP tools like get_customer, lookup_order, process_refund and escalate_to_human. It aims to resolve most cases on first contact — and to know exactly when to hand off to a human.
Read the full scenario lessonYour 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?