Argonautes are an evolutionary conserved family of programmable nucleases that identify target nucleic acids using small guide oligonucleotides. In contrast to eukaryotic Argonautes (eAgos) that act on RNA, most studied prokaryotic Argonautes (pAgos) recognize DNA targets. Similarly to eAgos, pAgos can protect prokaryotic cells from invaders, but the biogenesis of guide oligonucleotides that confer them specificity to their targets remains poorly understood. Here, we have identified a new group of RNA-guided pAgo nucleases and demonstrated that a representative pAgo from this group, AmAgo from the mesophilic bacterium Alteromonas macleodii, binds guide RNAs of varying lengths for specific DNA targeting. Unlike most pAgos and eAgos, AmAgo is strictly specific to hydroxylated RNA guides containing a 5′-adenosine. AmAgo and related pAgos are co-encoded with a conserved RNA endonuclease from the HEPN superfamily (Ago-associated protein, Agap-HEPN). In vitro, Agap cleaves RNA between guanine and adenine nucleotides producing hydroxylated 5′-A guide oligonucleotides bound by AmAgo. In vivo, Agap cooperates with AmAgo in acquiring guide RNAs and counteracting bacteriophage infection. The AmAgo-Agap pair represents the first example of a pAgo system that autonomously produces RNA guides for DNA targeting and antiviral defense, which holds promise for programmable DNA targeting in biotechnology.