The Command-Line Interface (CLI) provides a powerful interface that lets you engage with OpenHands directly from your terminal.
uvx
:
Create shell aliases for easy access across environments
.bashrc
, .zshrc
, etc.):source ~/.bashrc
or source ~/.zshrc
(depending on your shell).Install OpenHands in home directory without global installation
uv
:~/.openhands/sessions
.
SANDBOX_VOLUMES
to specify the directory you want OpenHands to access (See using SANDBOX_VOLUMES for more info)LLM_MODEL
- the LLM model to use (e.g. export LLM_MODEL="anthropic/claude-sonnet-4-20250514"
)LLM_API_KEY
- your API key (e.g. export LLM_API_KEY="sk_test_12345"
)mv ~/.openhands-state ~/.openhands
to migrate your
conversation history to the new location.-e SANDBOX_USER_ID=$(id -u)
is passed to the Docker command to ensure the sandbox user matches the host user’s
permissions. This prevents the agent from creating root-owned files in the mounted workspace.
The conversation history will be saved in ~/.openhands/sessions
.
>
). Enter your first task or type a command to
begin your conversation.
>
) is displayed:
Command | Description |
---|---|
/help | Show all available interactive commands and their descriptions |
/exit | Exit the application |
/init | Initialize a new repository for agent exploration |
/status | Show conversation details and usage metrics |
/new | Start a new conversation |
/settings | View and modify current LLM/agent settings |
/resume | Resume the agent if paused |
/settings
command. Just
follow the prompts:
config.toml
file.
/init
command helps the agent understand your project by creating a .openhands/microagents/repo.md
file with
project details and structure. Use this when onboarding the agent to a new codebase.
Ctrl-P
. To continue the conversation after pausing, simply
type /resume
at the prompt.
/help
at any time to see the list of available commands./settings
.a
or always
at the first confirmation prompt to automatically confirm subsequent actions for the current conversation./new
to begin a fresh conversation without restarting the CLI.