engine: consider metadata when adding global unit to agents