The session is automatically extended with %v every time the user is active. If you get a warning that expiry of the session is near then simply pressing any key on the keyboard will extend it. If the last users logs out, then by default the agent will exit with status 0. To prevent this, create a .hold file in the agent directory as follows: {{ if eq .os "windows" -}} # cmd echo > %agentdir%\.hold # powershell $null > $env:agentdir\.hold {{- else -}} touch $agentdir/.hold {{- end }} The expiry time is equal to the modification time of the .hold file with the expiry duration added. By creating a .hold file with a timestamp in the future, the session can be extended beyond the default session timeout.