The veteran writer and producer talks about AI’s uneasy arrival in Hollywood and the enduring appeal of the sitcom format.