Altruism and selfishness are highly transmissible. Either can easily cascade through human communities. Effective approaches to encouraging group cooperation—while also mitigating the risk of spreading defection—are still an open challenge. Here, we apply recent advances in deep reinforcement learning to structure networks of human participants playing a group cooperation game. We leverage deep reinforcement learning and simulation methods to train a "social planner" capable of making recommendations to create or break connections between group members. This social planner learns a strategy from scratch, through repeated trial and error. The strategy that it develops succeeds at encouraging prosociality in networks of human participants (_N_ = 208 participants in 13 sessions) playing the group cooperation game for real monetary stakes. Under the social planner, groups finished the game with an average cooperation rate of 77.7%, compared to 42.8% in static networks (_N_ = 176 participants in 11 sessions). In contrast to prior strategies that separate defectors from cooperators (tested here with N = 384 participants in 24 sessions), the social planner learns to take a conciliatory approach to defectors, encouraging them to act prosocially by moving them to small, highly-cooperative neighborhoods. A subsequent validation study (_N_ = 224 participants in 14 sessions) confirms that this encouraging approach can scaffold group cooperation absent the "black box" of deep learning. Deep learning can help explore and identify new approaches to support human cooperation and prosociality.