Modeling cooperation in multi-agent communities