|
| 1 | +# OpenHands Docker CLI Usage |
| 2 | + |
| 3 | +You can run the OpenHands agent via Docker with the following command and options: |
| 4 | + |
| 5 | +```sh |
| 6 | +# Example Docker run command |
| 7 | + |
| 8 | +docker run -it \ |
| 9 | + --pull=always \ |
| 10 | + -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.33-nikolaik \ |
| 11 | + -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ |
| 12 | + -e LLM_API_KEY=$LLM_API_KEY \ |
| 13 | + -e LLM_MODEL=$LLM_MODEL \ |
| 14 | + -e LOG_ALL_EVENTS=true \ |
| 15 | + -v $WORKSPACE_BASE:/opt/workspace_base \ |
| 16 | + -v /var/run/docker.sock:/var/run/docker.sock \ |
| 17 | + -v ~/.openhands-state:/.openhands-state \ |
| 18 | + --add-host host.docker.internal:host-gateway \ |
| 19 | + --name openhands-app-$(date +%Y%m%d%H%M%S) \ |
| 20 | + docker.all-hands.dev/all-hands-ai/openhands:0.33 \ |
| 21 | + python -m openhands.core.main --help |
| 22 | +``` |
| 23 | + |
| 24 | +## OpenHands CLI Flags |
| 25 | + |
| 26 | +``` |
| 27 | +usage: main.py [-h] [-v] [--config-file CONFIG_FILE] [-d DIRECTORY] [-t TASK] [-f FILE] [-c AGENT_CLS] [-i MAX_ITERATIONS] [-b MAX_BUDGET_PER_TASK] [--eval-output-dir EVAL_OUTPUT_DIR] [--eval-n-limit EVAL_N_LIMIT] [--eval-num-workers EVAL_NUM_WORKERS] |
| 28 | + [--eval-note EVAL_NOTE] [-l LLM_CONFIG] [--agent-config AGENT_CONFIG] [-n NAME] [--eval-ids EVAL_IDS] [--no-auto-continue] [--selected-repo SELECTED_REPO] |
| 29 | +
|
| 30 | +Run the agent via CLI |
| 31 | +
|
| 32 | +options: |
| 33 | + -h, --help show this help message and exit |
| 34 | + -v, --version Show version information |
| 35 | + --config-file CONFIG_FILE |
| 36 | + Path to the config file (default: config.toml in the current directory) |
| 37 | + -d DIRECTORY, --directory DIRECTORY |
| 38 | + The working directory for the agent |
| 39 | + -t TASK, --task TASK The task for the agent to perform |
| 40 | + -f FILE, --file FILE Path to a file containing the task. Overrides -t if both are provided. |
| 41 | + -c AGENT_CLS, --agent-cls AGENT_CLS |
| 42 | + Name of the default agent to use |
| 43 | + -i MAX_ITERATIONS, --max-iterations MAX_ITERATIONS |
| 44 | + The maximum number of iterations to run the agent |
| 45 | + -b MAX_BUDGET_PER_TASK, --max-budget-per-task MAX_BUDGET_PER_TASK |
| 46 | + The maximum budget allowed per task, beyond which the agent will stop. |
| 47 | + --eval-output-dir EVAL_OUTPUT_DIR |
| 48 | + The directory to save evaluation output |
| 49 | + --eval-n-limit EVAL_N_LIMIT |
| 50 | + The number of instances to evaluate |
| 51 | + --eval-num-workers EVAL_NUM_WORKERS |
| 52 | + The number of workers to use for evaluation |
| 53 | + --eval-note EVAL_NOTE |
| 54 | + The note to add to the evaluation directory |
| 55 | + -l LLM_CONFIG, --llm-config LLM_CONFIG |
| 56 | + Replace default LLM ([llm] section in config.toml) config with the specified LLM config, e.g. "llama3" for [llm.llama3] section in config.toml |
| 57 | + --agent-config AGENT_CONFIG |
| 58 | + Replace default Agent ([agent] section in config.toml) config with the specified Agent config, e.g. "CodeAct" for [agent.CodeAct] section in config.toml |
| 59 | + -n NAME, --name NAME Session name |
| 60 | + --eval-ids EVAL_IDS The comma-separated list (in quotes) of IDs of the instances to evaluate |
| 61 | + --no-auto-continue Disable auto-continue responses in headless mode (i.e. headless will read from stdin instead of auto-continuing) |
| 62 | + --selected-repo SELECTED_REPO |
| 63 | + GitHub repository to clone (format: owner/repo) |
0 commit comments