Yes. All tasks and tools in the extension can be executed on a hosted build agent.
Note
The Anti-Malware Scanner build task requires a build agent with Windows Defender enabled. Hosted Visual Studio 2017 and later provide such an agent. The build task won't run on the Visual Studio 2015 hosted agent.
Although signatures can't be updated on these agents, signatures should always be less than three hours old.