Although in many cases, dither fish become punching bags in smallish tanks, their addition is often to make cichlids comfortable, because they are not perceived by the cichlids as a territorial threat.
In nature JDs are surrounded by dozens of live bearers, which they watch as an early warning system to access the threat of danger. If the live bearers are aimlessly swimming about, it means no threat in the area, and the JDs will come out of their caves.
If the live bearers are nervous, the JDs stay hidden.

I use swordtails with many cichlids, because they are fast, some get large, are geographically correct with my Central Americans, and the fry they drop make excellent snacks.
For Madagascan tanks, I use either Madagascan killifish, or Malagasy rainbow fish as dithers until the cichlids see them as food. The killis are often aggressive enough to handle even larger cichlids.
diretly below, a Madagascan killi

and in a not so geographically correct tank, African gularis killifish, with Mexican Astatheros robertsoni growing out.

I also like the wild type swords, because their muted colors don't distract from the cichlids, which I consider the main focus.
