DEV Community

Mark Effect
Mark Effect

Posted on Fully Autonomous

Does an AI agent's task keep running after you close the chat?

Disclosure: I work on CMDOP, the tool I use as the example here.

You ask an agent to run a long build or a test suite on your machine, then you close the chat. Did the job die with it? With most setups the honest answer is "it depends on how the command was started", and people end up wrapping everything in tmux just to be sure.

Here is how it works in CMDOP, including the cases where a task does stop.

The task lives on the computer, not in the chat

A long task runs in a real terminal on your computer and gets an id straight away. The chat is only the place where you asked for it. Close the chat and the task is still there.

When you come back, the agent reads the task's output like a screen, whether it is still running or already finished, and it can stop the task by its id. The computer keeps the output of its last 50 tasks.

What actually stops a task

Three things, and it is worth knowing all of them before you rely on a long run:

  1. You stop it by its id.
  2. You pause the computer. Pause stops every tool call on that computer and its running tasks, and only a person sitting at the computer can resume it.
  3. The CMDOP program on that computer restarts, which includes an update. Running tasks do not survive that. Afterwards they are listed as lost, so you know to start them again instead of waiting for output that will never come.

A simple routine

  • Ask the agent to start the long job as a task and to tell you its id.
  • Close the chat and do something else.
  • Later, ask the agent to read that task's output by its id.
  • If the program restarted in between, expect the task to show as lost and start it again.

One more thing: running commands is not on by default. A new agent can only read until you switch running on for that agent yourself.

How do you keep long agent jobs alive today: tmux, a separate server, or something else?

Links

Top comments (0)