All entries
taskcycle / development log

How I keep long-running agentic tasks alive

Long-running agentic tasks are like intelligent batch processes - they should work without disturbing users until the task is done.

Unfortunately, AI agents are not 100% deterministic and can drop batch processing if they “feel like doing so”.

How can we ensure long-running agentic tasks won’t stop halfway?

Sometimes it is not immediately clear whether an AI agent finished the task or was interrupted in the process. Harness (the software that manages AI agents) detects obvious issues like temporary network outages, but some issues are more nuanced. Models can return an empty response without actually finalizing the task. To overcome that challenge, I created a mechanism that detects those cases and automatically prompts models to proceed.

My solution catches cases where the model edits a file or runs a command, then accidentally returns a blank response instead of continuing or reporting completion.

When that pattern is detected, the extension automatically injects a user message telling the agent to:

  • Continue the original task
  • Inspect the latest tool result and changes
  • Run any remaining validation
  • Keep working until the request is complete

In effect, it gives the model a “pick up where you left off” prompt without requiring any action from my side.

This setup ensures AI agents work long hours despite potential distractions and LLM choke issues.

Long-running agentic tasks are like intelligent batch processes; they perform the assigned work while I focus on the bigger picture.

👉 How do you leverage long-running agentic tasks?