How to switch rendering engine via python script
You can set the engine before rendering like this:

bpy.context.scene.render.engine = 'BLENDER_WORKBENCH'


Its possible multiple scenes are involved in the render so you may want to do...

for scene in bpy.data.scenes:
    scene.render.engine = 'BLENDER_WORKBENCH'


Note: If you select the Scripting screen, then change the engine, the code to do this is printed at the top of the screen (called the Info view), eg:

bpy.context.scene.render.engine = 'BLENDER_WORKBENCH'
bpy.context.scene.render.engine = 'CYCLES'