We investigate an agent-based model for the emergence of corruption in public contracts. There are two types of agents: business people and public servants. Both business people and public servants can adopt two strategies: corrupt or honest behavior. Interactions between business people and public servants take place through defined payoff rules. Either type of agent can switch between corrupt or honest strategies by comparing their payoffs after interacting. We measure the level of corruption in the system by the fractions of corrupt and honest agents for asymptotic times. We study the effects of the group size of the interacting agents, the dispersion with respect to the average salary of the public servants, and a parameter representing the institutional control of corruption. We characterize the fractions of honest and corrupt agents as functions of these variables. We construct phase diagrams for the level of corruption in the system in terms of these variables, where three collective states can be distinguished: i) a phase where corruption dominates; ii) a phase where corruption remains in less than 50% of the agents; and iii) a phase where corruption disappears. Our results indicate that a combination of large group sizes of interacting servants and business people and small dispersion of the salaries of public servants, contributes to the decrease of systemic corruption in public contracts.