Skip to content

Commit 5ba67fc

Browse files
committed
feat: add generalized cli_args input to action, move CLI docs to CLI.md, and update review workflow
1 parent 754205f commit 5ba67fc

3 files changed

Lines changed: 83 additions & 1 deletion

File tree

.github/workflows/review.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,17 @@ jobs:
2424
name: pr-diff
2525
path: pr_diff.txt
2626

27+
- name: Automatically Review Pull Request
28+
id: openhands_valid
29+
uses: ./
30+
with:
31+
prompt: Review the pull request using the diff found in `pr_diff.txt` and provide a summary of the changes. Ensure the changes align with the repository's goals.
32+
llm_api_key: ${{ secrets.LLM_API_KEY }}
33+
log_all_events: "true"
34+
github_token: ${{ secrets.MY_GITHUB_TOKEN }}
35+
additional_env: |
36+
{
37+
"SELECTED_REPO": "${{ github.repository }}"
38+
}
39+
2740

CLI.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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)

action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ inputs:
3939
These will be available in the container as environment variables.
4040
required: false
4141
default: '{}'
42+
cli_args:
43+
description: 'Additional CLI arguments to pass to the OpenHands agent'
44+
required: false
45+
default: ''
4246

4347
runs:
4448
using: 'composite'
@@ -64,6 +68,7 @@ runs:
6468
LOG_ALL_EVENTS: ${{ inputs.log_all_events }}
6569
ADDITIONAL_ENV: ${{ inputs.additional_env }}
6670
PROMPT: ${{ inputs.prompt }}
71+
CLI_ARGS: ${{ inputs.cli_args }}
6772
run: |
6873
# Parse additional environment variables from JSON
6974
if [ "$ADDITIONAL_ENV" != "{}" ]; then
@@ -81,6 +86,7 @@ runs:
8186
echo "- LOG_ALL_EVENTS: $LOG_ALL_EVENTS"
8287
echo "- Additional variables: $EXTRA_ENV_ARGS"
8388
echo "- Prompt: $PROMPT"
89+
echo "- CLI Arguments: $CLI_ARGS"
8490
8591
# Execute the task
8692
docker run -i \
@@ -95,4 +101,4 @@ runs:
95101
-v /var/run/docker.sock:/var/run/docker.sock \
96102
--add-host host.docker.internal:host-gateway \
97103
${{ inputs.openhands_image }} \
98-
python -m openhands.core.main -t "${PROMPT}"
104+
python -m openhands.core.main -t "${PROMPT}" $CLI_ARGS

0 commit comments

Comments
 (0)