The SARS-CoV-2 epidemic has had major impacts on children's education, with schools required to implement infection control measures that have led to long periods of absence and classroom closures. We develop an agent-based epidemiological model of SARS-CoV-2 transmission that is applied to model infection within school classrooms, with a contact model constructed using random networks informed by structured expert judgement. Mitigation strategies to control infection are modelled to allow analysis of their effectiveness in supressing infection outbreaks and in limiting pupil absence. The model is applied to re-examine Covid-19 in schools in the UK in autumn 2020, and to forecast infection levels in autumn 2021 when the more infectious Delta-variant is dominant and school transmission is likely to play a major role in a new wave of the epidemic. Our results indicate that testing-based surveillance of infections in the classroom population with isolation of positive cases is a more effective mitigation measure than bubble quarantine both for reducing transmission in schools and for avoiding pupil absence, even accounting for insensitivity of self-administered tests. Bubble quarantine results in large numbers of pupils absent from school, with only modest impact of classroom infection. However, maintaining a reduced contact rate within the classroom has a major beneficial impact for managing Covid-19 in school settings.