We are delving into the realm of philosophy of the mind, and even epistemology, but what makes you think even human beings have what you call "agency" (which I think you are using as a stand-in for free-will)?
Common-sensical free-will is a nonsensical concept. We don't make decisions based on a roll of the dice[0]. We decide to do things for reasons, because justifications. We come up with a list of options, we weight those options by how well we predict they will fulfill our goals, and we take the action which bubbles to the top. Free will, which again is what I think you are calling agency, is merely what it feels like from the inside to make a choice based on a fully deterministic utility calculation. You can program a computer to do the same.
Now the difference is that our value system is hideously complex and highly interconnected, and the vast majority of it is not accessible to conscious introspection. When we say "I chose that because it felt right" we are saying "my insanely complex value system, which I have little insight into, assigned highest weight to that option."
A program, on the other hand, can be written with a very simple and straightforward goal system: maximize advertising revenue; maximize account value; maximize paperclip production. It has agency, as the word is typically used, to accomplish those goals.
Such a program would be simple-minded, but not stupid. It would be highly intelligent about how it goes about accomplishing its goals, but it would never question why it is working towards those goals and whether it should pick new goals. That's not part of its program, nor something which it would choose to do as it is trivial to show that changing to new goals leads to not working towards the old goals.
Now with all that out of the way, can you see how it can be said that the behavior of the simple program is restricted to those actions which it best feels accomplish its simple goals? Certainly the program could be wrong on occasion, but it will always take actions which it thinks will best achieve its goals with the limited information and processing power available to it.
[0] unless we previously committed to physically rolling dice and accepting the outcome, in which case how did we choose to do that?