OpenHands CLI Cheatsheet - Open-Source Autonomous Coding Agent Full Reference
OpenHands is an open-source autonomous coding agent for developers who want the AI to plan end-to-end and write complete functionality into a repo — even a whole repo. Unlike helpers that confirm every command, it emphasizes autonomous execution with approval/headless modes, suiting batch work (CI, benchmarks, large-scale refactors). This sheet covers launch, task execution, approval modes, headless, and MCP.
Launch & Task 5
openhandsStart the interactive TUI / Web (default port 3000)
openhands -t "Implement user auth"Run directly with a task (--task)
openhands -f task.txtRead the task from a file
openhands --always-approveAuto-approve all actions (alias --yolo)
openhands --llm-approveAuto-approve only LLM-initiated actions
Resume & Headless 5
openhands --resumeResume the previous session
openhands --resume --lastResume the most recent session
openhands --resume <id>Resume a session by ID
openhands --headless -t "task"Run a task in headless mode
openhands --headless --jsonHeadless JSON output (for scripts)
Run Modes (Web/ACP/Cloud) 5
openhands webStart the Web UI
openhands serveRun as a resident service
openhands acpExpose via the ACP protocol
openhands loginSign in to OpenHands Cloud
openhands cloud -t "task"Submit a task to the cloud
MCP Management 5
openhands mcp listList MCP servers
openhands mcp add tavilyAdd an MCP server like tavily
openhands mcp enable <name>Enable an MCP server
openhands mcp disable <name>Disable an MCP server
openhands --from-issue <url>Pull a task from an Issue URL
Config & Install 5
uv tool install openhands --python 3.12Install the V1 CLI (recommended)
pip install openhands-ai==0.45.0Install a pinned version via pip
docker pull openhands/runtime:0.45-cpuPull the runtime image
openhands --override-with-envsOverride config with env vars
cat ~/.openhands/config.tomlInspect user config (core/llm/sandbox/planner)
Hotkeys 5
Ctrl+POpen the command palette
EscPause the current task
Ctrl+QQuit
/exitExit the session
openhands --max-iterations 50Cap the maximum iteration count
Tips
- OpenHands aims to "write a whole repo" autonomously — more aggressive than pair programming; for big tasks use `--resume` to keep checkpoints so a crash can continue.
- For headless batch use `--headless --json` in pipelines, with `--max-iterations` to stop runaway loops.
- Don't bare-run `--always-approve` on sensitive/prod tasks; at least use `--llm-approve` or validate small with `--headless` first.
- Config lives in `~/.openhands/config.toml` (llm/sandbox/planner) — set model and sandbox policy once, no per-run flags.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Aug 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us