With a possible government shutdown looming Senate leaders announced late Monday that a deal had been reached to provide funding for government agencies until mid-November. Paul Kane and Rosalind Helderman reported the details of the bipartisan deal:

Senate leaders agreed to a deal Monday evening that is almost certain to avert a federal government shutdown, a prospect that had unexpectedly arisen when congressional leaders deadlocked over disaster relief funding.

After days of brinkmanship reminiscent of the budget battles that have consumed Washington this year, key senators clinched a compromise that would provide less money for disaster relief than Democrats sought but would also strip away spending cuts that Republicans demanded. The pact, which the Senate approved 79 to 12 and the House is expected to ratify next week, is expected to keep federal agencies open until Nov. 18.

“It will be a win for everyone,” said Majority Leader Harry M. Reid (D-Nev.).

Minority Leader Mitch McConnell (R-Ky.) called the plan “a reasonable way to keep the government operational.”

Aides to House Speaker John A. Boehner (R-Ohio) said he will support the compromise.

The spending battle marked the third time this year that congressional acrimony has brought the government to the edge of calamity. In April, Boehner and President Obama reached a deal on funding for 2011 about 90 minutes before a government shutdown was to begin. On Aug. 2, just hours before the deadline, Congress gave final approval to legislation lifting the government’s borrowing authority, averting a partial shutdown and the potential for a default on the federal debt.

FEMA, whose funding was at the center of the dispute, revised their estimates of how long their current funding could last, which may have played a large role in defusing the showdown in Congress. As Ezra Klein explained:

It's not exactly right to say that congressional leaders cut a deal last night. Rather, they learned that they didn't have to cut a deal. The Federal Emergency Management Agency (FEMA) realized it could stretch its resources through the end of the week, which happens to be the end of the fiscal year (yeah, fiscal years end in September). Since Republicans and Democrats have already agreed to a baseline level of funding for the agency in the next fiscal year, there was no need to reach a deal on the funds this week. But let's be clear about what happened here: It's not that our legislators averted a crisis. It's that the crisis averted itself.

We're going to have a bigger funding showdown, and soon. The real work on 2012's budget needs to be completed by November 18th or -- and stop me if you've heard this one before -- the federal government shuts down. As my colleague Suzy Khimm reports, this negotiation is vastly bigger and vastly more complicated than anything the two parties were considering this week. And the events of this week shouldn't leave anyone feeling confident about that fight.

I don't know a single observer who doesn't believe that funding fight will lead us very close to a shutdown, and, of course, when you get close to a shutdown, there's always some chance of tipping over the edge entirely. Either way, that will make it our fourth shutdown threat in 2011 alone. And I don't say that to make you roll your eyes at Washington dysfunction. As I argue in my column today, the continuous brinksmanship in Washington is doing real, measurable harm to economic confidence, and thus to the economy. Perhaps this is why Peter Orszag, ex-director of the Congressional Budget Office, is arguing that to save American policymaking, we need to do everything we can to wrench it out of the hands of Congress.

While the government will be funded until November 18th, this latest spat over disaster relief has led many to believe the next round of budget negotiations could be much worse. As Suzy Khimm reported:

Think this budget fight is bad? Just wait a few weeks. Even if Congress manages to resolve its differences over the current budget extension, the continuing resolution funds the government only until Nov. 18. And the next round of budget negotiations will feature much larger stakes, much more consequential differences, and many more opportunities and excuses for mischief. Here are five potential flash points:

1) The entire 2012 budget will be under negotiation, not just emergency funds: The rapid escalation of the current shutdown fight is over a small sliver of emergency disaster aid money. That has obscured the broad bipartisan consensus over the vast majority of government spending — at least until Nov. 18. Both parties have agreed to abide by the debt-ceiling agreement’s overall budget target of $1.043 trillion, and they have decided to meet that number by freezing funding for all non-defense spending at last year’s levels minus a 1.5 percent, across-the-board reduction.

That’s not going to happen the next time around, when the funding for all of FY2012 is at stake. Party leaders say they’ll continue to abide by the overall $1.043 trillion funding limit under the debt-ceiling deal, which requires$21 billion in spending cuts for 2012. But neither party is pushing for across-the-board cuts again to reach that target. Instead, legislators want to cut more money from some places than others. And that could spark many turf battles over spending priorities.

More from The Washington Post

Opinion: Shutdown threat was absurd

Sarah Palin, second-tier candidate

Obama gets feel-good moment on jobs