← All terms

Long-Lived Agent

An AI agent instance that persists across tasks and sessions instead of being recreated each time.

What Is a Long-Lived Agent

A long-lived agent is an AI agent instance that persists across multiple tasks and sessions, retaining its state, workspace, and history over time, rather than being created fresh and discarded after a single request. Instead of spinning up a new agent for every task and tearing it down once the task finishes, a long-lived agent stays available, ready to receive further instructions whenever they arrive.

How Long-Lived Agents Differ From Ephemeral Ones

An ephemeral agent is created to handle one task and shut down immediately afterward; any files it produced, context it built up, or state it accumulated are typically discarded unless explicitly exported. A long-lived agent keeps its environment, such as a persistent file system and any accumulated context, intact between tasks. This means a second task sent to the same long-lived agent can build directly on the first, referencing files it already created or decisions it already made, without needing that information reintroduced from scratch.

Operational Considerations

  • Resource use: keeping an agent's environment alive indefinitely consumes storage and, if left running, compute, which is why many systems pause a long-lived agent's compute when it is idle while keeping its state intact.
  • State drift: because a long-lived agent's workspace accumulates changes over time, its environment can diverge from a clean baseline, which matters when reproducibility is important.
  • Lifecycle management: long-lived agents still need a defined way to be archived, reset, or deleted, since long-lived does not mean permanent.

Why Long-Lived Agents Matter

Some tasks genuinely benefit from continuity: a coding agent working on the same repository over weeks, or an agent that monitors and responds to recurring events, gains from keeping its accumulated context and files rather than rebuilding them every time. Long-lived agents are well suited to this kind of ongoing work, where the relationship between agent and project spans many separate tasks rather than a single request.

Example

Agenhood is built around this pattern: each agent it provisions runs in its own container with a persistent workspace volume, and rather than being destroyed after a task, an idle long-lived agent is automatically paused and then woken again the next time a task is submitted to it.

Get started

Deploy your fleet.

Put a fleet of sandboxed agents to work on your own infrastructure, provisioned in seconds and watched live from one console.

Get started

Admin-provisioned · Self-host in one command · Your data never leaves your VM