Issues / #1727

#1727 [Feature Request] Native prevent-sleep option during active inference (Windows)

open · @Normandanny · 0 commentaires · Sur GitHub

Server & APIWindows

Description

## Summary

Please consider adding a native, opt-in "Prevent Sleep" feature to Strata.

The goal is simple:
- While Strata is actively processing inference requests, prevent Windows from automatically entering sleep mode.
- Once all requests have finished, restore normal Windows sleep behavior.
- Allow the system to sleep normally when Strata is running but idle.

## Use Case

I run Strata as a local LLM server on a Windows 11 PC, with Hermes Agent running separately on my NAS and sending inference requests over the local network.

I want the PC to sleep automatically when idle to save electricity, while ensuring that long-running inference tasks are never interrupted by Windows automatic sleep.

Currently, this requires either:
1. Disabling Windows sleep entirely, wasting power.
2. Using external scripts to monitor Strata and dynamically prevent sleep, adding unnecessary complexity and potential reliability issues.

A native implementation would be much cleaner and more reliable.

## Proposed Feature

Add an optional setting, such as:

`--prevent-sleep-while-busy`

Or a checkbox in the Strata configuration UI:

`Prevent system sleep during inference`

### Expected Behavior

1. **Inference starts:** Strata requests the OS to prevent automatic system sleep.
2. **Inference is running:** The system stays awake throughout model loading, prompt processing, and token generation.
3. **Inference finishes:** Strata releases the sleep-prevention request.
4. **Strata is idle:** Windows resumes its normal sleep behavior based on the existing power plan.
5. **Strata exits or crashes:** Sleep prevention is automatically released.

The feature should not permanently modify Windows power settings or prevent manually initiated sleep.

## Optional: Configurable Idle Grace Period

For AI agent workflows, there may be short gaps between consecutive inference requests while the agent executes tools or processes files.

An optional idle grace period (e.g., 2–5 minutes) would help:

- Keep the system awake briefly after the last request.
- Reset the timer whenever a new request arrives.
- Release sleep prevention once the grace period expires.

This would help avoid unwanted sleep during multi-step agent workflows.

## Implementation Suggestion

On Windows, this could use native Windows power management APIs, such as `PowerCreateRequest`, `PowerSetRequest`, and `PowerClearRequest`.

The implementation should account for concurrent requests and reliably release the power request on completion, cancellation, timeout, or shutdown.

## Why This Matters

Strata is well suited for running local LLMs as network inference servers.

For users running unattended AI agents or dedicated home LLM servers, this feature would provide:

- Reliable long-running inference.
- Lower idle power consumption.
- No external scripts or workarounds.
- Better integration with Windows power management.

Windows support alone would already be very useful. Other platforms could be considered later.

Thanks for considering this feature!

Sur le site

Liens install, modèles, releases.