Key lawmakers said Wednesday they have reached a tentative deal on a massive farm bill, breaking a months-long impasse over legislation that doles out more than $400 billion in federal funds for farm subsidies, food stamps and conservation efforts.

Lawmakers have been at odds over a House GOP proposal to boost work requirements for food stamp recipients, but Sens. Pat Roberts (R-Kan.) and Debbie Stabenow (D-Mich.), the leaders of the Senate Agriculture Committee, said they had resolved the debate over the work requirements and other outstanding issues.

The senators declined to offer details of the emerging compromise, cautioning that it was not final and could change pending completion of cost analyses and legislative language. Nonetheless, both expressed optimism the legislation could pass before the conclusion of Congress’s lame-duck session next month.

“We have an agreement on the outstanding issues,” Roberts said. “But until you get that language on the bill, and you know where we are with the scoring, it’s premature to say that we have a complete agreement.”

A massive legislative package that oversees a range of farming, conservation and nutrition programs, the farm bill is reauthorized every five years — generally on a bipartisan basis. Separate bills passed the House and the Senate over the summer, and negotiators have spent months trying to reconcile the differences between the two versions, even as the existing farm bill expired Sept. 30.

The compromise bill now being developed must pass each chamber again before heading to the president’s desk.

The biggest debate over this year’s farm bill was over food stamps, as House Republicans pushed much stricter work requirements for “able-bodied” adults seeking to benefit from the program.

The Republican plan would have added new work requirements for those between age 49 and 59 and made it more difficult for states to waive some food stamp work requirements. Among other changes, the GOP plan would have also removed the existing work requirement exemption for parents with children older than 6.

But those positions ran into opposition in the Senate, where the bill requires votes from Democrats to be approved. Between 800,000 and 1.1 million households would have faced food stamp benefit cuts under one of the House Republican proposals, according to a study by the Mathematica Policy Research, a policy research organization.

Sen. John Thune (R-S.D.), the No. 3 Senate Republican, said that his understanding was that the compromise language on food stamps was likely to hew closer to the initial Senate version of the bill — which did not have the new work requirements.

“It was pretty clear you weren’t going to get a single Democrat vote in the Senate for what the House had passed,” Thune said.

Stabenow and Roberts said both parties should be able to live with the compromise legislation and that their House counterparts also had signed off.

Lawmakers faced pressure from farmers and ranchers to get a deal done, particularly amid a steep decline over the last several years in farm incomes as commodity prices have sagged, said Dale Moore, executive vice president of the American Farm Bureau Federation, an industry group.

“Reaching an agreement gives farmers and ranchers certainty that a farm bill is getting done and will help them weather the economic storms in their way,” Moore said. “It’s especially important as banks are beginning to look with farmers at the next financial year.”

Stabenow said the pending agreement would provide much-needed stability to farm country.

“Farmers and ranchers need certainty right now with everything that’s going on, and trade and tariffs and everything, prices, you know,” she said. “Rural America needs certainty, and this would give them that.”