Interest rates are constantly monitored, and an off-chain bot computes the exact allocations to maximize aggregated APY. If, for a given pool, the current on-chain allocations are different from the newly calculated one, the smart contract receive new allocations and the pool gets rebalanced.