Senators seeking a solution to a deadlock over border security have reached a tentative agreement they believe could win the votes of a significant number of Republican lawmakers for the Gang of Eight comprehensive immigration reform bill.

Republican Sens. John Hoeven and Bob Corker have been working on an amendment to the Gang bill that would satisfy Republicans who say the legislation as currently written does not have strong triggers to make the awarding of green cards, or permanent legal status, conditional on the completion of strict border control measures. A Senate aide familiar with the talks says the agreement would require that such measures be in place before immigrants could win permanent legal status.

The key feature of the deal is a massive increase in the number of Border Patrol agents. The Hoeven and Corker amendment would call for the number of agents to be essentially doubled, to about 40,000 from its current force of 20,000. “It’s hard to contend that you can’t control the border with about 40,000 Border Patrol agents,” says the Senate aide.

The deal would also call for an increase in the miles of fencing along the U.S.-Mexico border. It appears the amendment will provide for a total that is near the 700 miles of fencing called for in the Secure Fence Act, which Congress passed in 2006 but watered down a year later.

The plan would also include what the aide calls “a whole gaggle” of border security infrastructure — infrared sensors, drones, and other high-tech devices, which the aide says would be “enough to give situational awareness along the whole border.”

The deal also calls for the full implementation of the E-Verify employment security system, which is already a part of the Gang bill as it is today.

Finally, the arrangement calls for the implementation of an entry-exit system at the nation’s airports and other entry points. But it would be a biographic system, not a higher-tech biometric system that many Republicans have wanted. The biographic versus biometric issue has been a point of contention throughout negotiations over the Gang bill, but Hoeven and Corker appeared to have resolved it in favor of the lower-tech solution.

The deal also reaches an agreement in a dispute over who should design the border security plan — the Department of Homeland Security, as the current bill provides, or Congress, as some Republicans prefer. According to the aide, under the Hoeven-Corker amendment, DHS would have to submit a comprehensive border security plan to Congress, but it would have to include all the minimum requirements that Congress dictates in the amendment.

The key to all this, for many Republicans, will be whether the amendment specifies that the security measures have to be in place — not planned, not just funded, but actually in place — before immigrants can move on to permanent legal status. The aide contends that there is indeed a hard trigger in the amendment, and that immigrants will not be able to move forward unless the security measures are completed. “Legal permanent resident status will be granted only after these conditions are met,” the aide says. “There is a trigger.”

Some Republicans will likely oppose the plan because even though it sets a trigger before immigrants can move to permanent legal status, it does not require security enhancements to be in place when most of the estimated 11 million illegal immigrants in the United States are granted an initial, six-year legal status. Under the Gang scenario, that would happen within months of the bill becoming law, long before the new security measures are required to be completed.

The aide stresses that while the outlines of the deal appear to be set, it is still tentative and not yet a sure thing. The negotiators thought they had a deal on Tuesday night, only to see it fall apart on Wednesday. Now, they again think they have an arrangement, which they plan to announce Thursday. “I caution you to sit tight, because last night we thought we had a deal, and we didn’t,” the aide says. “We won’t know until it’s all done.”