Hi @Swahela Mulla ,
Thanks for reaching out to Microsoft Q&A.
It looks like you’re running into two related limits on Microsoft-hosted agents:
- Hosted-agent built-in timeouts
- On a private project with the free tier, each job can only run for 60 minutes.
- If you’ve purchased parallel jobs, that limit goes up to 360 minutes (6 hours).
- Setting
timeoutInMinutes: 420in your YAML won’t help if the hosted-agent cap is still 360 minutes—or 60 minutes if you’re on the free tier.
- Agent “heartbeat” disconnects
- The agent process sends a heartbeat every minute.
- If the server doesn’t hear back for 5 consecutive minutes, it marks the job as failed with “We stopped hearing from agent…”.
- Long-running install scripts that monopolize CPU, I/O or suppress all output for more than a few minutes can starve the agent’s heartbeats and trigger a hard disconnect—even if your job timeout is set high.
What you can try:
Verify your hosted-agent limits
- Are you on a private repo using the free grant? That’ll cut you off at 60 minutes no matter what.
- If you need longer on MS-hosted, you must purchase extra parallel jobs to unlock the full 360 minutes per job.
Add “keep-alive” output
- Break your big script into smaller steps or periodically
echoprogress so the agent thread doesn’t starve.- You can even insert a snippet like
while someLongInstall; do echo "$(date): still working"; sleep 240; done.
- You can even insert a snippet like
Split or optimize your pipeline
- Pre-bake your images (for example, with Packer or Azure Image Builder) outside of DevOps so the pipeline just picks up a finished VM image.
- If you must install in-pipeline, split into multiple jobs/tasks, each staying well under your hosted-agent cap.
Consider self-hosted agents
- No built-in timeouts. You decide how long a job can run.
- You can dedicate machines with enough CPU, RAM and disk so your install steps won’t starve the agent process.
References:
- Job timeouts & hosted-agent limits
- Timeouts and disconnects (heartbeats)
- Licensing & parallel jobs (to extend hosted limits)
- Self-hosted agents (no job-length cap)
Hope this helps!
If the resolution was helpful, kindly take a moment to click on and click on Yes for was this answer helpful. And, if you have any further query do let us know.