Recently, the US Department of Transportations Federal Aviation Administration and other international organizations have proposed a set of requirements for small unmanned aerial vehicles (UAVs) to operate for nonrecreational purposes. However, existing UAV architectures fulfill only some of the established requirements, and not all in one solution. This paper presents an unprecedented event-driven service-oriented architecture that allows autonomous UAVs to satisfy all these requirements and to detect critical situations, performing real-time decision making. The core of this architecture is based on the use of complex event processing (CEP) onboard. The results obtained involve advances in terms of the number of events processed per second, response time, ease of use for nontechnological users, and code reconfiguration before or during the UAV flight. These results have been validated by implementing the architecture.