Measurements of the cross sections for top quark pairs produced in association with a W or Z boson are presented, using 8 TeV pp collision data corresponding to an integrated luminosity of 19.5 fb −1 , collected by the CMS experiment at the LHC. Final states are selected in which the associated W boson decays to a charged lepton and a neutrino or the Z boson decays to two charged leptons. Signal events are identified by matching reconstructed objects in the detector to specific final state particles from t t ¯ W tt¯W or t t ¯ Z tt¯Z decays. The t t ¯ W tt¯W cross section is measured to be 382 − 102 + 117 fb with a significance of 4.8 standard deviations from the background-only hypothesis. The t t ¯ Z tt¯Z cross section is measured to be 242 − 55 + 65 fb with a significance of 6.4 standard deviations from the background-only hypothesis. These measurements are used to set bounds on five anomalous dimension-six operators that would affect the t t ¯ W tt¯W and t t ¯ Z tt¯Z cross sections.