Galectins play significant roles in regulating immune responses, posing challenges for cancer immunotherapy. The development of galectin inhibitors has been limited by their high structural homology and the lack of noninvasive imaging tools to identify potential responsive patients. We developed 12 galectin-7-specific inhibitors using nanobodies (Nbs) and identified G7N8 as the lead Nb. G7N8 was conjugated with the NOTA chelator, labeled with copper-64 ([64Cu]Cu), and used as a radiotracer for PET imaging in a triple-negative breast cancer (TNBC) mouse model. Nbs demonstrated high affinity for galectin-7, with no binding activity for other galectins tested. The lead Nbs inhibited galectin-7 binding to T-cell glycoreceptors and reduced subsequent apoptosis. PET imaging with [64Cu]Cu-NOTA-G7N8 showed selective radiotracer accumulation at 20 h (P = 0.001). We developed galectin-7-specific Nbs that inhibit T-cell apoptosis and enable PET imaging of TNBC, providing novel tools for investigating immune regulation and enhancing cancer immunotherapy.