If your build agent is not installed on the same computer with your TFS server (which VS2017 is installed). Try installing Visual Studio on your build agent , then reregister the build agent using TFS.
If your build agent and TFS VS2017 server are on the same machine, but VS is installed after you configure the build agent. Then re-register the build agent using TFS, since system capabilities are detected only during the first setup of the agent - any changes made after this are not fixed.
More ways, please refer to this similar question: No agent was found with the following features: msbuild, visualstudio, vstest?
source share