A long-running agent loop can be useful precisely because you do not have to watch it. But if you pay a model provider by the token, the hour at which the loop makes its next call may matter.
Model windows give Aii CLI's /loop an allowed schedule. Outside that schedule, the loop holds before starting another model turn. When the window opens, it resumes on its own.
A provider schedule, expressed as a window
DeepSeek is a useful example. Its current pricing page lists peak hours as 01:00–04:00 and 06:00–10:00 UTC, Monday through Friday. If you use your own DeepSeek API key, you can allow the other hours in your global ~/.aii/config.yaml:
schedule:
windows:
deepseek-hours:
timezone: UTC
allow:
- "Mon-Fri 00:00-01:00"
- "Mon-Fri 04:00-06:00"
- "Mon-Fri 10:00-24:00"
- "Sat-Sun"Now opt one loop into that schedule:
aii loop "migrate the test suite" --duration 1w --window deepseek-hoursShortcut: Aii CLI also ships a built-in deepseek-offpeak window with those same allowed hours. Use --window deepseek-offpeak without adding the YAML. It conservatively holds during weekday peak hours on Chinese public holidays, even though DeepSeek currently prices those holidays as off-peak. Check the provider's pricing page before relying on either schedule; hours can change.
The flag applies to this loop only. Another loop runs normally unless you give it a window too. You can define different hours and an IANA timezone for any provider. Windows live in your global config because a checked-out project should not get to decide when your provider key is used. On the local lane, Aii refuses to start a loop if the named window is missing or invalid.
What happens at closing time?
Aii checks the window between iterations. It lets a model turn already in progress finish, then holds before dispatching the next one. The hold message shows when the window reopens; the loop checks the clock as it waits and continues automatically when allowed.
You stay in control. /resume during a hold runs through the window for the rest of that loop, and /stop ends it. Held time appears separately from active and user-paused time in /stats and the exit summary. It still counts toward --duration, which is a wall-clock limit.
One boundary matters: background subagents started by an earlier iteration keep working while the main loop is held, and their model calls may continue. The window prevents new main-loop turns during a hold; it is not a guarantee that every model call from already-running work stops at closing time.
Model windows apply to loops using your own provider key on the local lane. Aii Cloud uses flat retail pricing, so its session tells you that --window is ignored and runs the loop without a window. Windows do not currently apply to /goal or individual interactive turns.
Install or update Aii CLI:
npm i -g @aiiware/aiiThen give your next long /loop a window that fits the hours you want it to work.
Aii is the AI assistant for everything—terminal, editor, and browser. Model windows are available in Aii CLI.