MADISON, Wis. — A bipartisan deal struck Thursday designed to avoid the Wisconsin state Assembly debating and taking votes in the middle of the night hinges on Republicans and Democrats agreeing ahead of time how long they will spend on each measure that comes up for discussion.

Leaders of both parties, standing side by side at a news conference, said the deal heralded a new day in the Republican-controlled Assembly that in recent years has been torn apart by contentious debate that frequently stretched deep into the night and devolved into lawmakers hurling insults at one another.

Part of the deal included in a memo of understanding signed by Democratic and Republican leaders also includes a target start time for debate, something the Assembly has not done. There is no curfew for ending session days.

The deal passed its first test Thursday as lawmakers approved other new rules in just three hours, well within the five hours allotted.

“We do not want to have all night sessions,” said the new Republican Speaker Robin Vos in announcing the agreement struck over two days of private meetings. “We do not think that is in the interest of the public. … We do not do our best work with very little sleep, just like most Wisconsin citizens.”

Democratic Minority Leader Peter Barca said that while agreement couldn’t be reached on all changes to how the Assembly operates, both sides did find common ground on major issues.

“I’m not quite ready to say that all is going to be great this session, but this is a great start,” Barca said. “We want to start a new, cooperative culture.”

It’s not uncommon for state legislatures to work past midnight, but it typically only occurs when a deadline is nearing or the session is ending for the year. But in the Wisconsin Assembly, working well past midnight happens frequently. It became even more common in the past two years during the high-tension session highlighted by the 61-hour debate in 2011 over passage of Gov. Scott Walker’s proposal effectively ending collective bargaining for public workers.

The vote on that measure came at 1 a.m. and resulted in Democrats shouting “Shame!” at their Republican colleagues. One Democrat even cursed at a GOP lawmaker.

Vos, who talked for months about his desire to stop all-night debates, met Tuesday with Barca and other Democrats on a proposal. Barca said Thursday that the initial proposal included a “nuclear option,” which he did not describe but that Republicans eventually rescinded.

“To say they have me heartburn would be the understatement of the year,” Barca said of the initial Republican proposal.

Vos said that plan would be put forward for debate on Thursday, but no vote would be taken on it.

Besides having set start-times and limit on debate, the agreement also calls for minimizing the number of contentious issues scheduled to be taken up on any given day and strictly enforcing time limits on how long each lawmaker can speak.

New clocks designed to help enforce those rules were in place for the start of Thursday’s session.

The deal struck related to ending all-night debates did not require a vote of the full Assembly.

However, other changes that some Democrats opposed were passed Thursday after just three hours of debate. Those include a new dress code that requires male lawmakers to wear a coat and tie and female members to wear “appropriate attire.” Anyone who fails to meet the dress code would not be allowed to debate that day.

Another rule change approved over Democratic objections imposes new restrictions on what members of the public can do while observing the Assembly from galleries. It bars anyone from eating, using a cellphone, wearing a hat or carrying a briefcase, in addition to disrupting the Assembly.

Anyone who violates the rule could be removed for 24 hours. A second violation would call for removal until the next day the Assembly meets. A third violation would result in removal for the remainder of the two-year legislative session.