Graceful error handling
We build for failure, not just the happy path. APIs fail, return empty, or time out. Without handling this, agents loop infinitely or silently die mid-workflow.
Agent calls a CRM, gets null back, tries to access contact.email, and crashes the entire run.
if (!contact || !contact.email) { // log · notify · fallback // NEVER continue blindly return fallback_action() }