In a situation where the country's banking system is vulnerable, the behavior of depositors based on their assessment of the banks' risk level can lead to an increase in the probability of systemic crises and instability of the banking network. Recently, network theory and agent-based simulation are used to investigate complex banking systems. Agent-based modeling (ABM) is a new computational method that studies economic phenomena by representing the behavior of individuals and agents. Using this approach, the present study evaluates the phenomenon of bank runs and the effect of deposit insurance on the country's banking network. The agents in this ABM include banks, central bank, firms and depositors. Banks and depositors are intelligent agents that operate on an adaptive learning model. This research was conducted with the aim of investigating the effect of depositors' behavior on the banking network and the safety policy of deposit insurance based on the balance sheets of 25 banks that are members of the Iranian interbank market during the years 2006 to 2019. We find that when depositors act strategically, bank operations occur and banks choose adaptive strategies with lower capital adequacy ratios (CARs). Also, our findings are that the safety of the banking network through deposit insurance has not been significantly successful in reducing the risk of contagion in the system.