Movement of cargos along microtubules plays key roles in diverse cellular processes, from signalling to mitosis. In cilia, rapid movement of ciliary components along the microtubules to and from the assembly site is essential for the assembly and disassembly of the structure itself1. This bidirectional transport, known as intraflagellar transport (IFT)2, is driven by the anterograde motor kinesin-23 and the retrograde motor dynein-1b (dynein-2 in mammals)4,5. However, to drive retrograde transport, dynein-1b must first be delivered to the ciliary tip by anterograde IFT6. Although, the presence of opposing motors in bidirectional transport processes often leads to periodic stalling and slowing of cargos7, IFT is highly processive1,2,8. Using cryo-electron tomography, we show that a tug-of-war between kinesin-2 and dynein-1b is prevented by loading dynein-1b onto anterograde IFT trains in an autoinhibited form and by positioning it away from the microtubule track to prevent binding. Once at the ciliary tip, dynein-1b must transition into an active form and engage microtubules to power retrograde trains. These findings provide a striking example of how coordinated structural changes mediate the behaviour of complex cellular machinery.