You could write that pseudocode as a prompt for the agent and get the same result. Use plan mode to understand what agent wants to do.

Am i missing anything?