A Cognitive Framework for Delegation Between Error-Prone AI and Human Agents