When building an engine do you work how many of each component you will buy before the game starts? Is it just a matter of self control and a plan or do you work things out as the game progresses?
I do not make exact plans like this before the game starts, and I would encourage you not to. The main reason is that the shuffles and your opponent are unpredictable. You must adapt your strategy to the cards you draw every turn, as well as how your opponent is doing (their shuffles and decisions). Sometimes the shuffles let you do better than you would have reasonably planned for, and sometimes they force you to make compromises from your plan.
However, there are engines where you can know with high confidence what your deck will be capable of each turn. This usually happens in the middle or latter parts of a game. If you reach that point, now is a good time to start planning ahead, maybe several turns in advance. What do I want my deck to be capable of two turns from now? What pieces do I need to gain to reach $16 and two buys? I kind of suck at this, because I find it a little boring, but this is exactly the kind of play that makes Stef clearly better than everyone else (at least, I believe this is a big factor).
Thinking ahead in these situations should include thinking about how/when the game will end: start watching piles and figure out the score if you don't know it already. What can you do to end the game with more points than your opponent?
The other general case where you can make plans on exact numbers of pieces is when your opponent isn't contesting you for a card. If you have unrestricted access to all 10 cards, it is sometimes worth it to figure out how many you want to buy. But this also depends on how the game is progressing, and you can't know these things before the game starts.