For many, like me, who worked on policy toward Afghanistan for years, recent leaks about an impending agreement between the U.S. and the Taliban bring mixed emotions. It is impossible to separate any deal from President Donald Trump’s persistent declarations that he wants to withdraw U.S. troops from Afghanistan now. Such assertions weakened the hand of America’s negotiators and inevitably color any agreement — whatever its merits — with “America First” and the sense that the U.S. is cutting and running. Nevertheless, if a deal materializes, it could represent the best opportunity in years to secure American interests and downsize U.S. military commitment in Afghanistan.

What appears to be on offer does fall far short of what most Americans and Afghans hoped would mark the end of America’s long military engagement. After nearly two decades of conflict, continuing this week with a deadly bombing, we’re expecting a deal that cements a (partial) American withdrawal in exchange for important, but easily reversible, commitments by the Taliban — and only a pledge to start intra-Afghan negotiations on the shape of the new political order. This is beyond disappointing.

However, the reality is that such a deal is the best of the feasible alternatives. Since the U.S. intervention began in 2001, three administrations have tried to use military force, not to end the conflict, but to bring the Taliban to the negotiating table directly with the Afghan government and to cobble out an agreement protecting everything from American security interests to Afghan human rights. Three presidents failed in this, and the Taliban today controls more of Afghanistan than it did last year.

The details of any deal will ultimately determine its success. Here is what I will be looking for in the agreement to increase my confidence in its prospects to deliver on its promise.

First, there needs to be a firm and explicit presidential declaration that U.S. troops will return if the Taliban reneges on its commitments. This may sound unrealistic, but without such a pledge, there is little to keep the Taliban from waiting until American troops withdraw and then resuming their fight against the Afghan government. Given that the Taliban is not a conventional force, no commitments from it to disarm or disband are particularly meaningful; the organization will only keep to an agreement if it sees the value of doing so — and finds the costs of not doing so too large.

Trump’s public oscillation on Afghanistan over the past two years will make any presidential statement suspect. However, the world should take a U.S. pledge to return to Afghanistan more seriously in light of the fact that the U.S. did exactly that in Iraq. After a full withdrawal in 2011, American troops swiftly returned to Iraq in 2014 when ISIS overtook much of the country.

Second, although this level of detail may not be immediately public, it will be important that the agreement involves a clear understanding about what some of the commitments of each side entail. For example, what is expected of the Taliban when it undertakes to deny safe haven to terrorists? Does it have an obligation to capture or kill suspected terrorists, or just keep them from organizing on Afghan soil? Who determines who in fact is a terrorist?

Third, the U.S. needs to demonstrate an enduring interest in Afghans reaching an accord among themselves on a new constitutional order – and be willing to play whatever role the parties ask it to. The real work that will determine the future for Afghanistan’s people will begin when multiple Afghan parties — not just the Taliban — start to grapple with defining a political order within which they can all live. There are already sharp differences among the non-Taliban Afghan parties about what level of decentralization is desirable — and a failure to reach agreement is both entirely feasible and a death blow to future Afghan stability.

Fourth, the sequence and timing of the various steps matter. There is no good reason for the Taliban to wait for the agreed number of American troops to leave before enacting their ceasefire. At a minimum, the drawdown and the ceasefire should be simultaneous. In addition, although outside the contours of an agreement with the Taliban, the U.S. must tackle with Afghans the question of the presidential elections scheduled for next month. While some will be eager to complete the elections before the government’s talks with the Taliban begin, the fact that it took five months from the first-round vote for a government to be formed after the last elections suggest that postponing the presidential poll may be the smartest course of action, so the nation’s current government can begin and complete talks.

Fifth, in an ideal scenario, there would be some defined mechanism to harness the support of the region and Afghanistan’s neighbors. They all have interests in how events unfold in that country and – should they agree on the broad contours of a desired outcome — its chances of materializing go up significantly. Trump seems to have put U.S.-Pakistani relations on firmer footing during the White House visit of Pakistani President Imran Khan last month, which bodes well for Afghanistan. But Washington’s strained relations with Tehran, Beijing and Moscow all make it unlikely that even Khalilzad’s best efforts can harmonize the region right now.

Finally, the best indicator of whether this agreement will secure American security interests over the long run and lead to lasting improvements for the maximum number of Afghans is whether the U.S. is allowed to maintain a counter-terrorism force in Afghanistan. At least initially, the U.S. seems to be committing only to a partial drawdown of its 14,000 troops in Afghanistan, so perhaps an enduring counter-terrorism force is possible.

No doubt, American negotiators are doing their utmost to secure the best possible outcome on all these fronts. An agreement that encompasses the above would not only be superior to the status quo, but also could safeguard American security interests. While it is harder to be confident about the fate of the Afghan people, such an agreement would provide support to Afghans as they do the hard work of coming up with a new political compact – which will be the key to future Afghan stability.