It's not released yet, but check out
this file for the Artificer. The Steel Defender in there works very similarly to the Drakewarden, so the code should be quite usable for it. Search that file for everything related to the Steel Defender and try to replicate it for the Drakewarden.