Top 200 ReposEXPLORER
Browse agents, categories and pages
Back to results
Planned, not doneThe source describes an intention, not a finished result.

Sustain Long-Running Coding Agent Sessions

Overview

Run a long coding task in a self-hosted OpenHands Docker sandbox set to restart itself and keep its state, with memory condensation on and a progress file and commits you review before anything is pushed.

Problem or Objective

More in Coding and Code Review

AI Agents and Models

Tools and Integrations

Tools
OpenHands · Docker · Git
Prerequisites
A self-hosted OpenHands install with Docker, an API key for your model provider (check whether it lets you set a spending limit), and a Git repository for the task.

How It Works

Install OpenHands with its Docker sandbox option and start the container with a restart policy (restart unless-stopped) so a crashed or hung agent server comes back on its own. Give the task its own workspace directory or Git worktree so it shares files with nothing else. In the LLM settings, pick your model and turn on memory condensation, setting the history size after which older events are summarised. Start a conversation with a task broken into numbered steps, and ask the agent to keep a progress file in the repository, commit after each finished step with a clear message, and run the tests before each commit. Check in from time to time: read the progress file and the latest commits, and correct the plan in the same conversation if it drifts. When it is done, review the full diff and push or open a pull request yourself.

Implementation Workflow

Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.

  1. Choose the agentSet up OpenHands.
  2. Connect the toolsConnect the tools this workflow relies on: OpenHands, Docker, Git.
  3. Check the prerequisitesA self-hosted OpenHands install with Docker, an API key for your model provider (check whether it lets you set a spending limit), and a Git repository for the task.
  4. Gather your detailsCollect what the prompt asks for: Repository or project, What the long task should achieve, Command that runs the tests, Files or folders the agent must not touch.
  5. Run the starter promptPaste the starter prompt below into OpenHands and adapt it to your case.
  6. Check against the documentationCompare what you get with the documentation at github.com before you rely on it.

Practical Starter Prompt: Work through a long task in steps

Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].

Preview
Work on [Repository or project] in this workspace to [What the long task should achieve]. First write PROGRESS.md with numbered steps, each small enough to finish and test on its own. Then work through them in order. After each step, run [Command that runs the tests], and only if it passes, commit with a message naming the step and update PROGRESS.md with what changed and what is next. If a step fails three times, stop and write down what you tried. Do not push, merge or change [Files or folders the agent must not touch]; I will review the commits and push myself.

Run this in its own workspace or worktree in a Docker sandbox with a restart policy, and turn on memory condensation. The agent only commits locally; read PROGRESS.md and the commits along the way, and review the full diff before you push or open a pull request.

Expected Results and Benefits

This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.

This is a suggested workflow, not a reported outcome. The OpenHands README says the Docker entrypoint stops a hung agent server so a restart policy can recover it, and that each sandbox keeps its conversation's workspace and persisted state across container replacement. The LLM settings page describes a memory condenser that keeps context focused in long-running conversations. Neither page measures how long a session stays productive, which depends on the task, model and plan.

Limitations and Considerations

The agent commits inside its own workspace; pushing, merging and deploying stay with you after you review the diff. Check whether your model provider lets you set a spending limit, and check usage while the task runs. Separate workspaces or worktrees keep two conversations from editing the same files. Results depend on your setup and were not independently reproduced by Top 200 Repos.

GitHub Repositories

AI Agent Repository

Source code of the agent that does the work.

Related Videos

About OpenHands/OpenHands

About OpenHands/OpenHands

Independent creators. Listing a video implies no endorsement, sponsorship or partnership.

Sources

  1. OpenHands/OpenHands README (opens in a new tab)

    Project documentation · github.com · Undated · Source checked 25 Nov 2026, 11:59 UTC

    What this source supports
    • The entrypoint stops the container with exit code 1 when the Agent Server stops answering its /alive check for about 30 seconds, so a crash or hang fails visibly instead of leaving a container that returns 502 for every request.
    • Automatic recovery needs a restart policy: use --restart unless-stopped instead of --rm, or restart: unless-stopped in Docker Compose.
    • Each container mounts its conversation's workspace and persisted state, so workspace files and conversation history survive container replacement.
    • Conversations using the same host workspace still share those files; choose separate directories or worktrees to avoid conflicting edits.
  2. Language Model (LLM) Settings - OpenHands Docs (opens in a new tab)

    Project documentation · docs.openhands.dev · Undated · Source checked 25 Nov 2026, 11:59 UTC

    What this source supports
    • The memory condenser manages the language model's context by ensuring only the most important and relevant information is presented. Keeping the context focused improves latency and reduces token consumption, especially in long-running conversations.
Report a problem

More with OpenHands

Planned, not done

Build a Villa Search Assistant Using Cyprus Location Data

Use OpenHands to build a small web app that lists villa rentals in Cyprus and puts nearby environmental data, for example air pollution, noise and landslide risk, next to each listing.

openhands.devOpenHands/OpenHands
Planned, not done

Dictate Mobile Web Fixes From Outside the Office

Test your web app on a phone away from your desk, dictate each problem as an issue in your tracker, and let an OpenHands issue-to-pull-request automation draft the fixes for you to review later.

github.comOpenHands/OpenHands
Planned, not done

Assign New Bug Reports to an Agent Under Team Rules

Set up an OpenHands Agent Canvas automation that picks up new bug reports from your issue tracker, works on them in a sandbox and opens pull requests, only for issues that meet rules your team writes down.

docs.openhands.devOpenHands/OpenHands

View all: OpenHands