Abstract Piper longum is a well‐known spice and traditional medicine. It was revealed to possess anti‐diabetic activity, but few information about its active component and underlying mechanism could be available. In this study, retrofractamides A ( 1 ) and C ( 2 ) isolated from P. longum showed potent inhibitory activity against PTP1B. Therefore, the potential mechanism was predicted by network pharmacology and molecular docking. PI3K/AKT was obtained as the most remarkable pathway against type 2 diabetes mellitus (T2DM), and AKT1 and GSK3 β were yielded as the top two core targets of retrofractamides A ( 1 ) and C ( 2 ). Molecular docking of compounds with AKT1 and GSK3 β showed strong binding affinity between them. Additionally, cellular experiments with a L6 cell model was conducted to further verify the above predictions. Results indicated that retrofractamides A ( 1 ) and C ( 2 ) exerted anti‐diabetic effect via activating PI3K/AKT pathway, and they promoted glucose consumption, glucose uptake, glycogen synthesis and glycolysis.