You can run OpenHands with a single command, without starting the web application. This makes it easy to write scripts and automate tasks with OpenHands.
config.toml
file.
--selected-repo
or the SANDBOX_SELECTED_REPO
environment variable:
Note: Currently, authentication tokens (GITHUB_TOKEN, GITLAB_TOKEN, or BITBUCKET_TOKEN) are required for all repository operations, including public repositories. This is a known limitation that may be addressed in future versions to allow tokenless access to public repositories.
Note: If you used OpenHands before version 0.44, run mv ~/.openhands-state ~/.openhands
to migrate your conversation history.
The -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.
-d "/path/to/workspace"
- Set working directory-f task.txt
- Load task from file-i 50
- Set max iterations-b 10.0
- Set budget limit (USD)--no-auto-continue
- Interactive modepoetry run python -m openhands.core.main --help
for all options.
Set export LOG_ALL_EVENTS=true
to log all agent actions.