AI & LLMs · Guide · AI & Prompt Tools
How to Use OpenHands
Run the OpenHands web UI in a sandbox container, connect LLM providers, and assign tasks to an autonomous AI developer. Set up instantly online.
OpenHands (the project formerly known as OpenDevin) is an open-source autonomous coding agent you run yourself. You point it at a repo, give it a task, and it plans, edits files, runs a shell, and iterates until the task passes. It’s the closest open-source equivalent to Devin, with the tradeoff that you provide the infrastructure and the API key.
Advertisement
What OpenHands actually is
OpenHands is a Python + TypeScript project maintained by the All Hands AI team and a large contributor base. It ships a web UI, a headless mode, and a set of agent personas (CodeActAgent is the default). The agent runs inside a sandboxed Docker container, which gives it a real shell, a browser, and a file editor without touching your host. You bring the LLM — it talks to Anthropic, OpenAI, Groq, local models via LiteLLM, or anything OpenAI-compatible.
Setting it up
The fastest path is the prebuilt Docker image. You need Docker Desktop (or engine + compose) and an API key for whichever model you plan to use.
docker run -it --rm --pull=always \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:latest \ -e LOG_ALL_EVENTS=true \ -v /var/run/docker.sock:/var/run/docker.sock \ -v ~/.openhands:/.openhands \ -p 3000:3000 \ --name openhands-app \ docker.all-hands.dev/all-hands-ai/openhands:latest
Open http://localhost:3000, paste your API key on the settings page, pick a model (Claude Opus 4.7 and GPT-5 are the strongest choices), and you’re live.
Your first session
Use the GitHub connector to pull in a repo, or mount a local folder with -v /path/to/repo:/workspace. Start with something contained: “add a /health endpoint that returns{ "ok": true } and a passing test.” Watch the event stream — you’ll see it think, run ls, open files, make edits, run tests, and retry on failure. If it goes off the rails, click stop. That’s the whole loop.
A realistic workflow
Treat OpenHands like a junior on a branch. Create a feature branch, write the task as a short brief (what, where, constraints, done criteria), and let it work. Review the diff like a PR — run the tests locally, skim for unrelated edits, look at the commit messages. For anything bigger than a couple of files, break it into sub-tasks and run them as separate sessions so the context stays tight and cheap.
Gotchas and limits
The big one is cost — an agent that loops burns tokens fast. Set a max-iterations cap in settings (20–40 is a reasonable starting ceiling) and watch your API dashboard. The Docker-in-Docker requirement is real; on Windows/WSL you’ll occasionally hit socket permission issues — fix them by adding your user to thedocker group. It also struggles on repos with no tests because it has no signal for “done.” Give it a way to verify its own work.
When NOT to use it
Skip OpenHands for single-file autocomplete — GitHub Copilot or Cursor is faster. Skip it for production incidents where you need deterministic edits — a human with Claude Code in the terminal will beat a planning agent on latency. And don’t point it at a private repo full of secrets until you’ve read the sandbox docs and decided whether your model provider’s data policy matches your risk tolerance. For hosted alternatives without the ops work, see our guides on Devin and Replit Agent.
Use these while you read
Tools that pair with this guide
- AI Cost EstimatorEstimate daily, monthly, and yearly API cost for GPT-4o, Claude, Gemini, and more based on your traffic and token usage.AI & Prompt Tools
- AI Prompt GeneratorTurn a vague idea into a structured prompt. Pick role, task, context, constraints, and output format. Works with ChatGPT, Claude, and Gemini.AI & Prompt Tools
- AI Token CounterEstimate tokens, characters, words, and approximate API cost for GPT-4o, GPT-4, Claude, and Gemini — before you hit send.AI & Prompt Tools
- AI Prompt LibraryBrowse a curated catalog of prompt templates for writing, coding, marketing, and research. One click to copy.AI & Prompt Tools
Advertisement
Continue reading
- AI & LLMsGitHub Copilot Pricing and ComparisonCompare free vs paid GitHub Copilot tiers and analyze it against ChatGPT, Cursor, and Tabnine. Find the best value plan instantly with this free online guide.
- AI & LLMsGitHub Copilot Features and CapabilitiesTest what Copilot really does — code accuracy, scope limits, debugging, web dev, legacy code, tests, docs, team customization. Free guide, no sign-up.
- AI & LLMsGitHub Copilot Security and Data HandlingAudit where your code goes, who sees it, training-data policy, network needs, and what happens when Copilot suggests broken code. Free, no sign-up.
- AI & LLMsAI Fluency SkillsThe 8 sub-skills of AI fluency: prompt structure, model selection, tool use, quality calibration, iteration, context management, cost awareness, privacy.
- AI & LLMsAnthropic Skills ExplainedSkills as Anthropic's answer to Custom GPTs — markdown-defined, version-controlled in git, work in terminal. Anatomy + Skills vs Custom GPTs.
- AI & LLMsKimi K2 vs DeepSeek V3Two open-weight Chinese flagships. Kimi K2 = 1M context, DeepSeek V3.2 = top-tier reasoning + coding. Pick by use case.