The chemical reactions and pathways resulting in the formation of agmatine ((4-aminobutyl)guanidine, NH2-CH2-CH2-CH2-CH2-NH-C(-NH2)(=NH)). Agmatine is the decarboxylation product of the amino acid arginine and is an intermediate in polyamine biosynthesis. It is synthesized in the brain, stored in synaptic vesicles, accumulated by uptake, released by membrane depolarization, and inactivated by agmatinase.