This seem to be a working solution for me:
Q: exists base package "-agent" whose (exists installed version whose ((it < "7.32.3-1") of (following text of first ":" of (it as string)as version)) of it) of debianpackages
A: True
T: 8085
Q: exists base package "-agent" whose (exists installed version whose ((it < "7.30.3-1") of (following text of first ":" of (it as string)as version)) of it) of debianpackages
A: False
T: 8300