Your AI agent works great. Then the phone gets warm. Then it doesn’t.

2026-10-12来源 dev.toEnglish

There’s a failure mode in on-device AI agents that doesn’t show up in testing.

It shows up five minutes into a real session.

The device gets warm. The CPU downclocks. Latency spikes. The agent that responded in 200ms is now taking 800ms. Users don’t report “thermal throttling” — they report “it got slow” or “it stopped working.”

By the time you’re debugging, it looks like a model problem. It’s not.

What’s actually happening

Android’s thermal system throttles CPU and GPU frequency when the device temperature rises. Continuous inference — running a model repeatedly over several minutes — generates heat. On flagship devices with good thermal management, you might not notice. On a mid-range device from two years ago, you will.

PowerManager.getThermalHeadroom() gives you a 1-second forecast of available thermal headroom, from 0.0 (throttling now) to 1.0 (full capacity). Most agents never check it.

The fix: proactive throttling

Don’t wait for the device to throttle you. Monitor headroom and throttle yourself first.

`

`kotlin
private fun getThermalHeadroom(context: Context): Float {
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
powerManager.getThermalHeadroom(1) // 1-second forecast
} else {
1.0f // Assume full capacity on older APIs
}
}

fun shouldThrottleInference(context: Context): Boolean {
val headroom = getThermalHeadroom(context)
return headroom < 0.3f // Throttle when less than 30% headroom remains
}
`
`

When headroom drops below your threshold:

`when { headroom < 0.2f -> switchToLighterModel() // Critical — swap model headroom < 0.3f -> reduceInferenceFrequency() // Warning — slow down headroom < 0.5f -> skipNonCriticalInference() // Caution — defer optional calls }` 

Why proactive beats reactive

If you wait for the device to throttle, latency has already spiked and the user has already noticed. Proactive throttling keeps the experience degrading gracefully — slower responses, deferred non-critical actions — rather than suddenly breaking.

The lighter model running at 400ms is a better user experience than the full model stuttering at 1200ms because the CPU is thermal-limited.

Test for this

Your emulator won’t reproduce it. Your Pixel 9 probably won’t either.

Run sustained inference on a 3-4 year old mid-range device for 10 minutes. Watch the latency numbers. If they climb, you have a thermal problem. Firebase Test Lab’s device matrix is the fastest way to find which devices in your target market are affected.

Thermal throttling isn’t a model problem or a code problem. It’s a physics problem. The only fix is building around it.

StareBrain is an on-device AI agent for Android. Pre-launch — waitlist on the product page.

原文:https://www.a8q9.cn/en/article/your-ai-agent-works-great-then-the-phone-gets-warm-then-it-doesn-t-ef574a.html

相关文章