Reasoning about Agents and Protocols via Goals andCommitments