A Utility Based Approach to Cooperation among Agents