Female halfbeaks are reasonably gregarious (though they still chase one another at times) whereas males are highly antagonistic towards one another once mature. There is variation between species: the males of some species are fairly easy going most of the time, but in other species the dominant male can become quite the bully. I had a male Nomorhamphus of unknown species (medium size, uncoloured fins, almost no beak) that fit into this latter category.
You can keep singletons perfectly easily if you wish, and if the tank is big enough, pairs are fine too (just make sure the female has some space so she can keep away from the male should she wish to). I like to keep halfbeaks in big groups though, 6-8 specimens, as this allows you to keep more than one male, and that ensures plenty of liveliness. Do keep more females than males though, ideally twice as many females (or more).
Cheers, Neale