There are two basic solutions; one involves turning the agent so it's only ever moving forward, and the other involves figuring out how to move the agent left and right in addition to forward.
This solution uses the turn command so that the agent is only moving forward. The turn blocks mean this is a longer sequence.
This solution moves the agent left and right, negating the need for the turn command and shortening the whole sequence.