Unfortunately, incidents are virtually certain to recur so long as the first line of monitoring and compliance policing is performed by armed officers.
In short: we must disarm most police officers.
The Castile shooting occurred at a stop due to a broken tail light. Consider: the city of Chicago uses cameras to asynchronously ticket red light violators. Running a red light is objectively more dangerous than driving with a broken tail light, but Chicago will allow you to continue driving unimpeded after doing so.
Further, consider: any number of other violations in Chicago --- expired plates, bad stickers, poor selection of parking places, failure to pay parking fees, outstanding warrants on your car --- are performed by parking enforcement officers who are not armed. Chicago also routinely deployed traffic direction officers who are themselves not armed.
The police force we have today will not allow itself to be disarmed. The realistic medium-term answer to this problem is not to change the culture of existing police --- we should do that, but we should be pragmatic about how far that will get us. Instead, cities that want to reduce police violence should stop hiring assault officers, and begin programs to replace them with monitoring and compliance officers who will accept jobs with a description that includes doing the work unarmed. Smart cities should find ways to offload monitoring and compliance work from assault officers onto unarmed officers. Police forces can be disarmed through attrition.
Cities are incentivized to do this anyways: assault officer hires come packaged with intractable pension problems. New job descriptions don't.
Consider also: "armed" and "unarmed" isn't binary. When approaching Philando Castile's car to inquire about the broken tail light, the officer was by default no more than 20-30 seconds away from being able to fire a bullet into Castile. Smarter public policy can increase that delay from 20 seconds to something far greater. For instance: general-purpose patrolling assault officers can be (are, in fact, today) issued rifles and shotguns stored in their trunk. Those officers can remain armed; just, not with handguns, and not wielded by default.
Modern assault officers are in a double bind. They're routinely required to work in high-crime neighborhoods, often minority-dominated, and thus subjected to constant cognitive strain: they're put into contact with far more minorities at work than at home, and those minorities are sampled from a cohort anomalously likely to include criminals. Further, assault officers are acculturated and in fact trained to believe (irrationally) that routine job activities, like making traffic stops, are among the most dangerous things that can be done in America. They're stuck in a vicious circle of cortisol spikes and negative reinforcement. It is not reasonable to expect them to safely handle continuously-available firearms.
I suspect we'll discover that confrontations between unarmed officers and armed suspects are less dangerous than confrontations between armed officers and armed suspects. Most (not all) suspects who shoot at cops aren't doing it out of spite, but instead of out self-preservation. Regardless, I think we already know what would happen if we reconstituted police forces to be 20% assault and 80% compliance, down from 90% assault: far less police violence, far fewer shooting incidents, less expense, and a greater civic recognition of the real risks of policing.
Disarm most police.