OpenHands CLI Cheatsheet - Open-Source Autonomous Coding Agent Full Reference

All OpenHands autonomous coding agent commands in one place — from interactive launch to headless batch, approval modes, and MCP — organized by scenario. Copy and go.

AI CLI·30 commands·Last updated 2026-08-21

Launch & Task 5

openhands
Start the interactive TUI / Web (default port 3000)
openhands -t "Implement user auth"
Run directly with a task (--task)
openhands -f task.txt
Read the task from a file
openhands --always-approve
Auto-approve all actions (alias --yolo)
openhands --llm-approve
Auto-approve only LLM-initiated actions

Resume & Headless 5

openhands --resume
Resume the previous session
openhands --resume --last
Resume the most recent session
openhands --resume <id>
Resume a session by ID
openhands --headless -t "task"
Run a task in headless mode
openhands --headless --json
Headless JSON output (for scripts)

Run Modes (Web/ACP/Cloud) 5

openhands web
Start the Web UI
openhands serve
Run as a resident service
openhands acp
Expose via the ACP protocol
openhands login
Sign in to OpenHands Cloud
openhands cloud -t "task"
Submit a task to the cloud

MCP Management 5

openhands mcp list
List MCP servers
openhands mcp add tavily
Add 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.12
Install the V1 CLI (recommended)
pip install openhands-ai==0.45.0
Install a pinned version via pip
docker pull openhands/runtime:0.45-cpu
Pull the runtime image
openhands --override-with-envs
Override config with env vars
cat ~/.openhands/config.toml
Inspect user config (core/llm/sandbox/planner)

Hotkeys 5

Ctrl+P
Open the command palette
Esc
Pause the current task
Ctrl+Q
Quit
/exit
Exit the session
openhands --max-iterations 50
Cap 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

Commands are compiled from the official docs below. Click to verify the latest usage.

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