Back to terminal directory

AI coding agents · AI coding

OpenHands CLI

CLI entry to the OpenHands autonomous software engineering stack.

Open sourcePython
Official site
Short answer

OpenHands CLI is the terminal version of OpenHands, an open-source AI software engineering agent formerly known as OpenDevin. You run openhands in a project, describe a task, and the agent reads code, edits files and runs commands, asking for confirmation before actions unless you change the setting. It works with most model providers through LiteLLM, including Anthropic, OpenAI, Google and local models. Install it with uv tool install openhands --python 3.12 or the install script at install.openhands.dev. The tool is free under the MIT license. You pay your model provider, or use OpenHands Cloud.

License
MIT (core project)
GitHub, OpenHands/OpenHands
Python version needed
3.12 or later
OpenHands docs
Formerly called
OpenDevin
All Hands AI
Settings file
~/.openhands/settings.json
OpenHands docs

Updated October 21, 2026How we evaluate tools

OpenHands CLI guide: install, models, headless mode and safety settings

OpenHands began in 2024 as OpenDevin, an open-source response to Cognition's Devin, the first widely publicized "AI software engineer". The project grew into one of the larger open agent platforms, renamed itself OpenHands, and is backed by a company, All Hands AI, that also runs a hosted cloud version. The team publishes research on agent design and reports results on SWE-bench, the benchmark built from real GitHub issues.

The CLI brings that agent into your terminal. It suits developers who want an open, model-agnostic agent with explicit safety settings, and teams that want the same agent available in the terminal, a web interface and CI.

How it works

You run openhands in a project and describe a task. The agent plans, reads and searches files, edits code, and runs shell commands. Each action is shown in the terminal. By default, it waits for your confirmation before acting.

OpenHands is built on its own agent SDK. Agents use a set of tools, such as file editing, a shell and a task tracker, and can be extended with MCP servers. The same SDK powers the CLI, the GUI and OpenHands Cloud.

Installing OpenHands CLI

MethodCommand
uv (recommended)uv tool install openhands --python 3.12
Install scriptcurl -fsSL https://install.openhands.dev/install.sh | sh
DockerUse the image documented in the OpenHands install guide

OpenHands needs Python 3.12 or later. On Windows, install it inside WSL. On first run, it asks for a model provider, a model name and an API key, and saves them.

A first task, step by step

  1. Create a branch: git switch -c try-openhands. Every agent is easier to review when its work sits on its own branch.
  2. Run openhands in the project root and pick your provider and model.
  3. Start with a task that has a clear finish line, such as "add a unit test for the parse_date function covering leap years, then run the test suite". Agents do best when they can check their own work by running something.
  4. Watch the first few actions and confirm them one by one. You learn quickly how the agent explores your code and which commands it reaches for.
  5. When it finishes, review the diff with git diff and run the tests yourself before merging.

Once you trust it on small tasks, try --llm-approve for longer ones so the agent stops only for riskier actions.

Writing tasks the agent can finish

The OpenHands documentation and most agent teams give the same advice:

  • Name the files or area when you know them. "In api/auth.py, add rate limiting to login" beats "add rate limiting".
  • Say how to verify. Give the test command or the expected output.
  • Keep each task to one change. Split "refactor the module and add three features" into separate sessions.
  • Put standing rules in the repository. OpenHands loads repository instruction files, including AGENTS.md, so you do not need to repeat build commands and style rules in every prompt.

Connecting a model

OpenHands talks to models through LiteLLM, so it supports most providers: Anthropic, OpenAI, Google Gemini, Mistral, DeepSeek, OpenRouter, Amazon Bedrock, Azure, and local servers such as Ollama or vLLM. The OpenHands team has found that strong frontier models perform far better as agents than small models, and recommends them for real work. Local models are useful for privacy and experiments but tend to fail on long, multi-step tasks.

Settings live in ~/.openhands/settings.json. Change them from inside the CLI with the settings command or by editing the file. The config format changed at version 1.0, so older guides that describe a config.toml setup may not match.

Confirmation modes

OpenHands is explicit about how much autonomy you grant:

ModeHow to set itWhat happens
Confirm every actionDefaultThe agent asks before running commands or editing files
LLM security analyzer--llm-approveA model rates each action's risk. Low-risk actions run, risky ones ask you
Always approve--always-approveNo confirmations. Use only in isolated environments

The security analyzer is a middle ground for long tasks. It cuts down on interruptions while still stopping for actions such as deleting files, pushing to remotes or installing packages. It is a model making a judgment call, so it is not a guarantee.

Headless mode and scripting

For scripts and CI:

openhands --headless -t "Update the README with the new install steps" --json

--headless runs without the interactive interface. -t passes the task. --json prints structured output for other programs. Combine with a confirmation mode that does not need a human.

Sessions

Conversations are saved under ~/.openhands/conversations. Use --resume to continue a previous session with its full history, which helps for long tasks that you split across a day.

The GUI and OpenHands Cloud

openhands serve starts the OpenHands web interface locally in Docker. The GUI runs the agent inside a sandbox container, with panes for the chat, a file browser, a terminal and a browser the agent can control. This is safer for autonomous work because commands run inside the container rather than directly on your machine.

OpenHands Cloud is the hosted version from All Hands AI. It connects to GitHub, GitLab, Bitbucket and Slack, so you can assign issues to the agent or mention it in a pull request. All Hands AI also sells an enterprise edition for self-hosting on Kubernetes.

Where OpenHands CLI works well

  • Teams that want one open agent across terminal, browser interface and CI.
  • Developers who want a middle setting between "approve everything" and "approve nothing".
  • Work that you want to run inside containers, by switching to the GUI for autonomous tasks.
  • Research and evaluation, since the project publishes its agent design and benchmark methods.

Limits and risks

The CLI runs on your machine. Unlike the GUI, the CLI's commands run directly in your environment. Use the GUI's sandbox, a container or a virtual machine for unattended work.

Model costs. Long agent loops with frontier models consume many tokens. Set spending limits with your provider.

Changing setup. The 1.0 release changed configuration and commands. Follow the current docs rather than older tutorials.

Python requirement. Python 3.12 or later is required, which some older Linux distributions do not ship by default. uv can install it for you.

OpenHands CLI compared with other terminal agents

ToolModelsLicenseNotable feature
OpenHands CLIMost providers via LiteLLMMITLLM security analyzer, GUI with sandbox
Claude CodeClaudeProprietaryHooks, skills, plugins
Codex CLIOpenAIApache 2.0OS-level sandbox
OpenCode75+ providersMITLSP diagnostics, plan agent
AiderMost providersApache 2.0Git commits as undo

Choose OpenHands if you want an open agent with clear autonomy settings and the option to move the same work into a sandboxed GUI or cloud. For a lighter terminal-first agent, look at OpenCode or Pi. See the terminal tools guide for the full list.

Frequently asked questions

Is OpenHands CLI free?

Yes. The CLI and the core OpenHands agent are open source under the MIT license. You bring your own model and pay that provider, or run a local model. All Hands AI, the company behind the project, also runs OpenHands Cloud, a hosted version with its own pricing, and sells an enterprise edition for self-hosted team deployments.

How do I install OpenHands CLI?

The documented method is uv tool install openhands --python 3.12, which needs the uv package manager and Python 3.12 or later. You can also run curl -fsSL https://install.openhands.dev/install.sh | sh, or run it in Docker. On Windows, use WSL. After installing, run openhands in a project folder and follow the prompts to choose a model provider and enter an API key.

Can OpenHands run without asking me before each action?

Yes, but choose carefully. By default it asks for confirmation before actions. The --always-approve flag skips confirmations entirely. The --llm-approve flag uses a second model as a security analyzer that rates each action's risk and only asks you about risky ones. For unattended runs, prefer a container or a disposable environment, since the agent runs commands with your permissions.

How do I use OpenHands CLI in scripts or CI?

Run it with --headless and a task, for example openhands --headless -t 'fix the failing tests'. Headless mode runs without the interactive interface. Add --json to get machine-readable output that a script can parse. Combine it with --always-approve or --llm-approve, since there is no one to answer confirmations in CI.

What is the difference between the CLI and the OpenHands GUI?

The CLI runs the agent in your terminal on your machine. The GUI is a web interface that runs the agent inside a Docker sandbox, with a file browser, terminal view and browser view. You can start the GUI locally with openhands serve. OpenHands Cloud offers the same interface hosted by All Hands AI, with integrations for GitHub, GitLab and Slack.

Sources

  1. OpenHands documentation, CLI
  2. OpenHands on GitHub
  3. OpenHands CLI on GitHub
  4. OpenHands website
  5. SWE-bench
  6. LiteLLM providers