This study elucidates the autophagy-related gene signatures (PIK3R1, TRIM21, TRIM22, and ITPR3) in epilepsy and clarifies their association with immune infiltration and their role in anti-epileptic drug responsiveness, which provide a novel target for future therapeutic interventions and disease markers in epilepsy. Here, TRIM21 is linked to epilepsy.