An agent that never stops also never gets a fresh start. Its context grows stale and expensive, its small errors compound into its working assumptions, and its spend becomes a utility bill nobody itemises. Sessions are how long-running work gets edges.
The short answer
Give always-on agents sessions with real boundaries: a maximum duration, a step and spend budget per session, and a structured handover — a written state summary the agent itself is not the sole author of — when one session ends and the next begins. Checkpoint durable state outside the context so a restart loses nothing but the drift. Treat session restarts as routine hygiene, scheduled and logged, rather than as failures; the agents that need them most are precisely the ones whose operators have started calling their quirks 'personality'.
Check your own setup as you read: run the free Spend Guard self-check or test a policy in the playground — five minutes, no signup, and the gaps it names map to the controls below.
Worked example: the inbox agent that got stranger by the month
A fictional property manager, Fernbank Lettings, ran an always-on inbox agent that had been continuously active for five months. Its context had accreted thousands of messages; its per-reply cost had crept from $0.11 to $0.47 as the context grew; and it had begun confidently applying rules from a tenancy dispute in March to unrelated tenants in August, because the dispute still sat in its working memory as precedent. No single day looked wrong. The trend lines, once anyone plotted them, were unmistakable.
Fernbank moved the agent to weekly sessions with a structured handover: open threads with their states, standing instructions from the policy store, and a one-page summary of the week generated from the decision log rather than from the agent's own recollection. Per-reply cost returned to $0.12. The March dispute stopped haunting August tenants. And the handover documents became an unexpected asset — when the agent's owner went on leave, her cover ran the service from the handovers alone, something the previous five-month continuous memory would never have permitted.
Context is a cost centre and a quality risk
Every step of a long session re-reads a growing context, so cost per action climbs even when behaviour is perfect — Fernbank's fourfold creep came from arithmetic, not failure. Quality drifts with it: old instructions, resolved disputes and superseded facts remain in context with the same weight as today's, and the agent cannot reliably tell precedent from history. Session boundaries with curated state are how you pay for the context the work actually needs and retire the rest on purpose.
Handovers must be built from records, not recollection
An agent summarising its own session will preserve what it found salient, which includes its mistakes, presented as facts. Build the handover from the durable records — the decision log, the task store, the policy store — and let the agent annotate rather than author. The test of a handover is substitution: could a fresh session, or a human cover, continue the work from this document alone? If not, state is still hiding in the old context, and the boundary is decorative.
Budgets per session make always-on spend legible
A monthly total for an always-on agent answers no useful question. Per-session budgets — this week, this shift, this watch — create units a review can grip: sessions that overrun, sessions whose cost per task climbs, sessions that end by budget rather than by schedule. Those units feed the month-end review with something finer than a single utility line, and they give the session itself a tripwire: a session burning at three times its class's rate is an incident this week, not a discovery next quarter.
Restart is maintenance, not failure
Teams resist session restarts because the agent 'loses its memory'. Reframe what is being lost: unrecorded state that no one can audit, priced per token on every call. Anything worth keeping belongs in a store the new session can read. Schedule restarts like any other maintenance, log them with the handover reference, and measure the agent before and after — cost per task and error rate usually both improve, which converts the sceptics faster than any policy argument.
Choosing what survives a session boundary
The handover forces a useful argument: what, exactly, does the next session need? In practice it is four things — open work with honest states, commitments made to customers with their deadlines, standing instructions as currently approved, and a short list of watch-outs from the period just ended. Everything else the old session 'knew' is either in a system of record already, or was never knowledge — it was residue. Teams that hold this line find their agents cheaper, calmer and easier to hand over between humans. Teams that do not are not preserving intelligence; they are declining to decide what the agent should remember, and paying per token for the indecision.
Five actions to bound long-running agent sessions
- Set a maximum session duration and per-session step and spend budgets for every always-on agent.
- Checkpoint durable state in stores outside the context — tasks, decisions, policies — never only in the agent's memory.
- Build session handovers from the decision log and task records, with the agent annotating rather than authoring.
- Schedule restarts as routine maintenance and log them against the agent's registry entry.
- Track cost per task by session so creep and drift show as trends, not as a quarterly surprise.
Source note and related guides
Figures in the worked example are illustrative, drawn from a fictional company created for this guide; the controls, failure patterns and procedures described are the gateway's documented behaviour — see the Agent Auth Gateway documentation and the policy patterns in allowlists vs denylists, spend caps and the agent kill switch. Reviewed by the Ingenious AI team, 2026-11-14.
Sources
- NIST AI Risk Management Framework (AI RMF 1.0), the voluntary framework for managing AI risk across design, development and use: nist.gov, 2023
- OWASP Top 10 for Large Language Model Applications, the OWASP GenAI Security Project's risk list for LLM and agent systems: owasp.org, 2025
- RFC 6749, The OAuth 2.0 Authorization Framework, the IETF standard behind scoped, expiring access tokens: rfc-editor.org, 2012