For too long, a bipartisan, commonsense agreement to fix America’s broken gun laws has seemed out of reach. A new effort in Congress offers reasons for optimism.

In the wake of multiple mass shootings this year — including the slaughter of 19 students and two teachers at an elementary school in Uvalde, Texas, last month — Sens. Chris Murphy and John Cornyn have reached a tentative bipartisan agreement on the first significant national gun reform in many years.

It won’t please everyone, of course. But there’s no doubt it represents progress.

Although negotiations continue, the broad outlines are clear. Crucially, the framework would close the so-called boyfriend loophole, ensuring that domestic-violence records are more widely included in background checks. It would allow for some sealed juvenile records to be available for similar purposes, while boosting penalties for crimes such as straw purchases and gun trafficking. It would also boost funding for mental-health programs and for improving security at schools.

Perhaps most important, it would create federal incentives for states to enact so-called red-flag laws, which allow courts to temporarily ban individuals from purchasing or possessing firearms if a judge determines that they’re a threat to themselves or others.

Such laws are relatively new. But early evidence — and common sense — suggest that they’re likely to be an effective tool in stopping mass shooters, most of whom exhibit clear warning signs before they kill. One study looked at 21 red-flag orders issued against individuals in California who had made explicit shooting threats; no violence was subsequently attributed to any of them.

(Everytown for Gun Safety, which advocates gun reform measures, is backed by Michael Bloomberg, founder and majority owner of Bloomberg LP.)

It’s true that this effort falls short of the reforms that President Joe Biden outlined in a recent prime-time address, which included bans on assault weapons and high-capacity magazines and a repeal of gun manufacturers’ liability protection. It also doesn’t go as far as a package passed by the House last week, which would (among other things) raise the minimum age for purchasing certain rifles to 21 from 18. And there’s no shortage of other reforms that could help impose sanity on America’s gun culture.

But something is better than nothing, which is essentially what the country has gotten in the decade since 20 other children were murdered by a deranged gunman in Newtown, Conn. Many thought that slaughter would be a turning point — an act so horrifying that Americans would finally come to their senses on guns.

Instead, a much-hyped reform effort in Congress failed within months of the shooting. About two-thirds of the relevant state laws passed from 2012 to 2018 actually loosened gun restrictions. Meanwhile, hundreds more people have been murdered in additional mass shootings.

That carnage can never become acceptable to Americans. Should this deal advance, it ought to be seen as a starting point for wider change. A more comprehensive background-check overhaul should be next. Strengthening concealed-carry permitting requirements and secure-storage laws must remain a priority. So should extending red-flag measures to every state. Biden should also continue to work to get a new ATF director in place.

Although plenty of work remains, every step forward in Congress, however small, should be welcomed. The fight goes on.