this happens with a lot of early models, mine included. the stock tune on these early cars is not great. I fixed mine with Stage1 tune when my vehicle was stock and that got rid of the erratic idle. (about two weeks later when my headers arrived I went to a Stage 2+ tune).
if you are not planning on any tuning mods to your car you should be able to get your Toyota dealer to reflash your ECU to fix it
https://jalopnik.com/heres-how-to-fi...ngines-5948647