Military drones are increasingly common, but they aren’t very smart; they need people to tell them where to go, what to do, and how to do it. Until a few years ago, drones still needed pilots-by-proxy, who essentially did everything pilots normally do, with inputs transmitted to the aircraft via datalink rather than cockpit wires. Today a ground-based pilot can simply pick a spot on the map or highlight a target, and the drone will fly itself there and maneuver to keep the target in view.

Now Lockheed Martin and the U.S. Air Force have demonstrated the next step: a drone that can detect and respond to unexpected threats on its own, with no human intervention required.

Have Raider II, a two-week series of demonstration flights, showed that a drone could carry out a mission autonomously even when interrupted by an unknown surface-to-air missile threat. Lockheed’s Skunk Works uploaded its autonomous mission-planning software onto the Air Force Test Pilot School’s venerable NF-16 VISTA experimental aircraft, and had the school’s students put it through its paces as their capstone project.

Have Raider II went well beyond its namesake. In 2015, Have Raider I tested whether or not the NF-16 could automatically detect, join up, and fly formation with a lead aircraft in the same way a human wingman could—and it worked.

“What we wanted to do with Have Raider II was really focus on how intelligent, if you will, can we make the unmanned asset from a mission planning and execution standpoint,” says Lockheed’s Loyal Wingman program manager, Sean Whitcomb. While VISTA was sent into the air by itself, a lead aircraft on the ground gave it commands over a datalink.

The pre-assigned mission was a ground attack. Then, while in flight, VISTA was told that the lead aircraft had detected an unexpected (simulated) surface-to-air missile site. VISTA’s onboard software automatically rerouted to avoid the SAM site while still carrying out its attack run. Testers threw still more problems at VISTA, including cutting off its datalink and adding multiple new SAMs and targets to the mix. Then they sat back to see how the software detected and responded on its own.

VISTA reacted just the way they hoped it would, according to Renee Pasman, Lockheed’s Missions Systems Roadmap director.

Afterwards, some of the student test pilots—experienced pilots all—flew the same missions with the same pop-up threats, without knowing what was coming or how Have Raider’s software handled the same problems, to see how their responses compared. Though the test results are still formally under evaluation, “What the computer can do is follow those concepts of operation for a particular mission perfectly, and as a result follow the mission intent to the letter,” says Whitcomb.

Lockheed stresses that Have Raider is a demonstration program, not an operational test, and bringing the software to operational status will take years. Some aspects, Pasman says, could quickly be made operational, should the Air Force choose to do so, but others would take years.

An operational rollout of this or similar software seems inevitable—eventually. The Pentagon has for years wanted autonomy for drones as well as long-range data sharing. A few years from now, if you see a military formation overhead, there may only be one human pilot in the whole flight.