A practical guide to designing typed error codes, structured telemetry, and failure contracts for AI agents and cloud services that debug cleanly.