Biochar combined with gypsum reduces both nitrogen and carbon losses during agricultural waste composting and enhances overall compost quality by regulating microbial activities and functions.