Agatha has her dybbuk because Aaronev Wilhelm Sturmvoraus attempted to use the mysterious Mind Transfer Machine on her. The intention was to erase Agatha's personality and mind while replacing it with a copy of Lucrezia Mongfish's mind and personality. This did not work out as planned by Lucrezia because one of her Priestesses, one Loremistress Milvistle, was disillusioned with her and sabotaged the machine causing it to malfunction during the copying process. Agatha's mind and personality were not erased, so Lucrezia's mind and personality were forced to occupy only part of Agatha's brain. Lucrezia's is the stronger personality, so she can suppress Agatha's personality until she put on Agatha's Locket. This locket was made by Barry Heterodyne to help hide Agatha's spark. Fortunately, it had an even harsher effect on Lucrezia's personality suppressing her enough for Agatha to regain control over her mind and body. Agatha has been in control of herself from that time until the present.
Klaus, on the other hand, Klaus Wulfenbach is deeply frightened of Lucrezia-in-Agatha, and is torn because his son is irretrievably in love with Agatha. He later takes the radical step of imprinting a dybbuk of his own in Gil's brain. By doing this, he is carrying the battle to Lucrezia by using her own mind transfer tricks against her.by Lucrezia while she was in control of Agatha's body, and he remains extremely suspicious of Agatha, thinking that she is, in essence, a copy of her mother.
She has Manifested twice within Castle Heterodyne, and never under her own power. However Agatha has suppressed this Dybbuk by herself.