Humanity is embarking on a potential golden age of astrobiology, with numerous current and future space missions being tasked with the explicit goal of searching for evidence of habitability and life within our Solar System. However, the science of biosignatures—the detection and interpretation of signs of extant or extinct life—remains incomplete. Here, we report a flight-ready, robust, agnostic molecular biosignature detection technique based on pyrolysis–gas chromatography–mass spectrometry (py–GC–MS) combined with machine learning. To develop this technique, we used py–GC–MS to collect rich chemical spectra from hundreds of carbon-rich samples, including but not limited to: biological specimens from all three domains of life, taphonomically altered/fossilized life forms, carbonaceous meteorites, and laboratory organic synthesis experiments. We trained a machine learning algorithm on the presence, absence, and magnitude of tens of thousands of unique chemical features in the dataset. The final algorithm can: (1) predict the biogenicity of an unknown sample to greater than 90% accuracy, (2) detect signs of life even when biotic matter is mixed with organics of abiotic origin, and (3) discriminate among kinds of biota, such as photosynthetic vs. non-photosynthetic life. We hope to use our technique on future astrobiology missions to identify “potentially biological anomalies,” i.e., possible signs of life with non-Earthly biochemistry. Similar machine learning approaches may be applicable to other kinds of instruments, and to create a unified framework for biosignature assessment that takes into account data from multiple analytical instruments at once. Overall, our general technique has the potential to serve life-detection missions to the diverse rocky worlds of our Solar System.