As budget deadline pressure builds, Congress and the White House have struck a budget deal, moving one step closer toward staving off an economic crisis.

The deal between congressional Democrats and the White House would raise spending caps by about $50 billion this year and another $54 billion the following year. It would also lift the nation’s debt limit for two years, while avoiding massive spending cuts.

That’s a good deal for Democrats and a big retreat from the Trump administration, which called for $150 billion in spending cuts. The budget cuts in this deal would likely go into effect down the road, which means there’s a chance a future Congress will overturn them down the line.

The deal still has to be passed by the House and Senate, and signed by Trump. But by striking such a deal, congressional leaders and the Trump administration are averting a disaster scenario. The two groups were staring down a final deadline of October 1, by which time the government would have run out of funding and shut down, and the current government budget caps would also expire, automatically triggering roughly $120 billion in across-the-board cuts to domestic and military programs.

“Importantly, Democrats have achieved an agreement that permanently ends the threat of the sequester,” House Speaker Nancy Pelosi and Senate Minority Leader Chuck Schumer said in a joint statement. “With this agreement, we strive to avoid another government shutdown, which is so harmful to meeting the needs of the American people and honoring the work of our public employees.”

During negotiations, there were several sticking points, specifically around funding for President Trump’s immigration agenda. Trump, said however, the final deal included no controversial “poison pills” — or partisan policy provisions.

“This was a real compromise in order to give another big victory to our Great Military and Vets!” Trump tweeted.

I am pleased to announce that a deal has been struck with Senate Majority Leader Mitch McConnell, Senate Minority Leader Chuck Schumer, Speaker of the House Nancy Pelosi, and House Minority Leader Kevin McCarthy - on a two-year Budget and Debt Ceiling, with no poison pills.... — Donald J. Trump (@realDonaldTrump) July 22, 2019

For months, both the White House and leaders in Congress have appeared interested in averting economic crisis, but Pelosi said Trump and fiscal hawks in his administration like White House acting chief of staff and Office of Management and Budget Director Mick Mulvaney, who has advocated for draconian budget cuts in the past, had walked away from early talks in May.

And Trump in April tweeted that a bipartisan budget deal was “not happening!” But recently, Pelosi and Treasury Secretary Steve Mnuchin have had regular phone calls to negotiate a deal. Senate Majority Leader Mitch McConnell reportedly had also been advocating for a middle-ground deal on budget caps and the debt ceiling.

Congress is set to go on its annual August recess next week, and Pelosi will likely want to pass a bill before Friday. She’s on a tight timeline.

We are here because of an Obama-era deal with Republicans

The need for budget caps goes back to 2011, when an Obama-era impasse over the debt ceiling brought the American economy to near calamity. Republicans in the House, led by then-Speaker John Boehner, refused to increase the debt limit without Congress addressing the national debt. It’s something Mulvaney played a role in back when he was one of the House’s archconservatives.

The face-off, which put the United States at risk of defaulting on its debt, pushed President Obama to sign the Budget Control Act. The law instructed Congress to find more than $1 trillion in government spending cuts by the end of the year or risk a sequester, which cuts all discretionary programs — defense and non-defense — across the board (except for entitlement programs like Medicaid and Social Security). Mulvaney was one of the Tea Party agitators who worked to block any increase to the debt limit, eventually forcing Obama’s hand to sign the BCA.

Congress failed to thoughtfully cut spending, which triggered automatic budget cuts in 2013 and imposed annual, more restrictive budget caps until 2021 — the sequester. The across-the-board budget cuts and established caps would amount to $1.2 trillion in cuts over the next 10 years. According to a 2015 report from the Center on Budget and Policy Priorities, funding for domestic programs was essentially flat between 2012 and 2015, meaning there were substantial cuts when adjusted for inflation.

Democrats and Republicans have repeatedly voted to raise the budget caps and give sequester relief, but those adjustments are set to expire this October.

Put simply, either Congress has to vote to raise the budget caps for defense and domestic spending or the country will go to sequester-level spending — which would mean roughly $71 billion in budget cuts to defense spending and $55 billion in cuts to domestic programs.

This is going to be a busy week for Pelosi. Now that a budget deal is coming together, she will want to act quickly and pass the budget bill before lawmakers are set to leave for August recess.