Agents Should Be Durable, Not Long-Lived
Published on julin.ai A common way to build an AI agent is to treat it as a long-running process. A worker receives a request, enters an agent loop, calls models and tools, waits for results, and eventually returns an answer. This works well until agents start doing real work. An agent may spend twenty minutes researching a problem, wait ten minutes for a build, ask a user for approval, or come…
In the world of AI agents, a common approach is to treat them as long-running processes. However, this model presents challenges when agents perform real-world tasks such as research, building, approvals, or waiting for external jobs. Keeping a worker alive for the entire duration of an agent's work is inefficient and can result in significant resource waste and difficulties with failures.
A better approach is to separate the agent's run from the process executing it. The agent run should be durable, storing its state, messages, tool results, budget, and current position outside the worker. Meanwhile, the worker is temporary, leasing a runnable agent to perform useful work for a short period, checkpointing the new state, and disappearing afterwards.
Conceptually, an agent run loads, cycles through the think and tool steps inside a durable session, checkpoints, and the worker exits. Another worker can later resume from the checkpoint. This does not imply that every model or tool call requires its own process, as that would introduce unnecessary scheduling and state-reconstruction overhead.
Instead, a worker might receive a 30- or 60-second lease to execute several agent steps while progress is being made. The crucial distinction lies in waiting. If an agent needs to wait for an external process, it should not idle for an extended period. Instead, it records its waiting status and exits. When the waiting condition is resolved—be it the completion of CI, a timer, or approval from a user—the run can be relaunched.
This model extends to rate limits, human approval, scheduled actions, external callbacks, and communication between agents. The benefits of this approach include a scalable system where one million active agent runs can be maintained without the need for one million running processes. Most agents will typically be waiting, using only the computation resources necessary when they have a task to perform.
However, this model is not without challenges. The state must be cheap to reconstruct, side effects must survive retries without being executed twice, and certain environments like browsers, shells, and sandboxes may require their own longer-lived services. Streaming also needs to be independent from the currently owning worker.
Nevertheless, these are infrastructure challenges that have been addressed in large web systems where permanent server processes are no longer assigned to individual users. The key takeaway is that the useful abstraction is not a short-lived agent, but rather a durable agent paired with a leased executor.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.