An agent thinks for a second, runs a tool for a minute, and repeats a hundred times over an hour. The session state machine and where each piece lives, the sandbox per session with its cold-start budget, the KV cache that should survive the tool call, and checkpoints that resume a step rather than an hour.
Design the runtime for long-running agents: sessions, tool sandboxes, KV that lives for hours, and checkpoints.
An agent thinks for a second, runs a tool for a minute, and repeats a hundred times over an hour. The session state machine and where each piece lives, the sandbox per session with its cold-start budget, the KV cache that should survive the tool call, and checkpoints that resume a step rather than an hour.
Updated Sep 2026 · Grounded in real AI infrastructure interview loops and written to a senior-engineer editorial bar, with every number worked and every diagram hand-built.
The concepts behind this question
Ranked by how closely each one overlaps this question's topic, so the first card is the thing to read if the answer above moved too fast.
Scored on separating the three lifetimes (model call, tool execution, session), on sandbox isolation with a cold-start and cost number, on treating the agent's context as a growing prefix the KV tier serves, and on checkpointing the session at step boundaries.
No comments yet — be the first to share your approach.
