The paper presents an agent-based model reproducing a stylized credit network that evolves endogenously through the individual choices of firms and banks. We introduce in this framework a financial stability authority in order to test the effects of different prudential policy measures designed to improve the resilience of the economic system. Simulations show that a combination of micro- and macroprudential policies reduces systemic risk but at the cost of increasing banks’ capital volatility. Moreover, the agent-based methodology allows us to implement an alternative meso regulatory framework that takes into consideration the connections between firms and banks. This policy targets only the more connected banks, increasing their capital requirement in order to reduce the diffusion of local shocks. Our results support the idea that the mesoprudential policy is able to reduce systemic risk without affecting the stability of banks’ capital structure.