Voters, take heart. You may be able to turn on your televisions and open your mailboxes this spring without being inundated with slashing political propaganda, at least from Democratic groups.

Representatives Edward J. Markey and ­Stephen F. Lynch said Wednesday that they have signed a pact designed to keep outside groups from running ads or sending mailers in their fight for the Democratic nomination for the ­Senate. The so-called People’s Pledge aims to hold the candidates accountable for the messages voters receive and to limit the shadowy ­attacks that characterize modern political campaigns.

The pact is modeled on an agreement that Elizabeth Warren and Scott Brown pioneered in their Senate race last year. To the surprise of many, that pact held up and successfully kept outside groups from entering one of the nation’s most competitive and closely watched Senate races.

As Markey and Lynch announced their ­accord, they called on the candidates running for the GOP nomination to join them in signing it. But the Republicans were not quick to embrace the idea.

A spokesman for Gabriel E. Gomez said Wednesday that the private equity investor and former Navy SEAL is busy building a campaign and “no decisions on this or on anything else have been made.” A spokeswoman for state Representative Daniel B. Winslow said the former aide to Governor Mitt Romney was meeting with GOP activists and “would have no comment.”

The agreement signed by Lynch and Markey, like the one hammered out by Brown and Warren, does not legally prohibit outside groups from running ads in the runup to the April 30 primary. It says, however, that if a group runs an ad on behalf of one of the candidates, that candidate has to ­donate 50 percent of the cost of the ad campaign to a charity of his rival’s choosing.

The penalty was the same in the Brown-Warren race and was triggered twice early in the contest, prompting Brown to donate a total of $36,000 to an autism charity.

The Lynch-Markey pact does not cover automated phone calls, meaning outside groups can still interrupt dinner with recorded messages blasting one candidate or another. It does, however, cover ads on television, radio, and the Web, as well as propaganda sent by mail, which was not ­included in the Brown-Warren agreement.

It is not clear whether the pact will be renewed between the Democratic and Republican nominees once the primary is over. Lynch and Markey both said they would extend the pledge through the general election on June 25, as long as the GOP candidate signs on.

Lynch, of South Boston, was the first to express an interest in signing the pact for the primary, saying in early January that he wanted to push for it. Markey, of Malden, backed the idea soon afterward.

With about $3.2 million in his campaign account, Markey currently has more money to spend on ads than Lynch, who has about $800,000.

Both candidates, however, have undertaken aggressive fund-raising efforts.

“This race should be decided in debates and on the stump, not by third-party advertisements or special-interest mailers,” Lynch said in a statement.

Markey echoed the sentiment.

“Outside money has no place in the Massachusetts ­Senate race,” he said.