The habenula (Hb) is a brain region with increasing popularity due to its strong link to addiction, mood disorders and experience dependent fear. We demonstrated that Hb neurons respond to odors and light asymmetrically. Moreover, we showed that Hb neurons exhibit structured spontaneous activity that is spatially and temporally organized. This spontaneous activity resembles neural attractors, which can switch the preferred state of the Hb and regulate the transmission of sensory information to downstream monoaminergic brainstem nuclei. In order to explore the source of Hb spontaneous activity, we investigate the local connectivity within Hb and the global functional inputs to Hb. Our results showed that recurrent excitatory connections within Hb is important for maintaining spatio-temporal organization of Hb activity. Moreover, we observed that functional inputs form zebrafish homologues of hippocampus (Dl) and amygdala (Dm) and sensory inputs from visual and olfactory systems are the major drivers of spontaneous Hb activity. Our results suggested that these limbic and sensory inputs are integrated in Hb in a non-linear fashion and can regulate sensory representations in Hb. We propose that Hb lies in the heart of a brain wide network and act as “a hub” or “a switchboard”, which can regulate or gate the communication of sensory systems and limbic forebrain areas with the monoaminergic brainstem nuclei that control animal behaviors.