Long-Running Agent
Most agent demos finish while you watch. A different class of work does not: migrating a codebase, watching a feed for a week, draining a queue that keeps refilling. A long-running agent is one whose task outlives the session that started it — hours, days, or indefinitely — and that duration changes nearly every assumption around the loop.
What duration breaks
Time introduces failures a short run never meets:
- The process restarts — a deploy, a crash, a recycled machine — so state must live outside memory, in checkpoints the agent can resume from.
- The context window fills long before the task ends, so history must be compacted and the plan kept in durable notes rather than the transcript.
- Credentials expire and the environment the agent planned against moves underneath it.
- Cost accrues quietly; a merely inefficient loop becomes expensive over a weekend.
The standard answer is to stop treating the run as one long call and model it as a workflow. Durable execution engines such as Temporal, or graph runtimes like LangGraph with persisted state, replay completed steps from a record instead of redoing them.
Why it matters
Autonomy only pays off when nobody has to sit with the agent, and that means surviving everything that happens to a server over hours. Without durability, a six-hour job restarts from zero on the first hiccup. Without compaction, it forgets its own plan. Without budgets and progress checks, it can grind for a day on a task it stopped making headway on in the first ten minutes.
A long-running agent executes a task that outlives a single session — hours to days — rather than completing within one interaction. Duration forces durability: checkpointed state, resumption after restarts, compaction of a context window that will overflow, and explicit cost and progress bounds. Without these, any crash restarts the work from zero. It is the difference between an agent you watch and one you deploy.
Some jobs are done in a minute. Others take all weekend — clearing a mountain of paperwork, or keeping watch on something and reacting whenever it changes.
A long-running agent is AI software set on one of those longer jobs. Nobody sits and watches it work. That means it has to cope with ordinary interruptions: the computer it runs on might restart, a connection might drop, the task might turn out to be far bigger than expected.
So it keeps notes on its own progress as it goes. Like a builder who leaves a half-finished job on Friday and picks it up on Monday exactly where the work stopped — rather than starting the whole house again.