Quite possibly, workable ethics will pretty much require full-fledged General Artificial Intelligence, verging on actual Self-Awareness.
There's a great discussion of this in the (Furry) web-comic Freefall:
(which is most easily read using the speed reader: https://tangent128.name/depot/toys/freefall/freefall-flytabl... )