You can read more about proxy configuration for agents
here.
It seems that this is it - a happy ending to the story, but it was not there. While I was dealing with the problem, I decided to reinstall the agent software. To do this, you need to delete the old one and install the new one with a powershell script. Moreover, in general, there can be several agents on the machine that will perfectly work in parallel with each other.
How to remove an agent is written
here. To do this, use the
.\config remove command
But the problem is that in order to completely remove the agent with this command, you need to have an active Personal Access Token for an account that has the right to add agents to AzureDevOps. The token with which the agent was created was expiring a long time ago, and my account did not have enough rights. Moreover, from the Azure DevOps side, the agent can be easily removed, but it is simply impossible to correctly deactivate the agent software without the appropriate PAT. You can only stop the corresponding Windows service and make it not start again.
In general, in the end, I had to raise a devops who had the appropriate rights to add agents and ask him to make a temporary PAT, with which I managed to completely remove the old agent software and install a new one with the correct proxy server configuration.
That's what we need to learn all the time. You will never know where you will get an issue…