At AGP yes you should be fine, mixed departure and arrival area so just walk off, wait, walk back on.
They very occasionally sometimes use a gate which forced you landside, I think I saw that once last year although i was not doing a b2b myself that day. however, even if that does happen you can easily get back through security (presume you will be in J so have fast track) and back to the gate in time.