Compare commits

..

7 Commits

Author SHA1 Message Date
rohitvinodmalhotra@gmail.com 532a284d5c migrate to use OH version 2025-01-26 15:24:35 -05:00
rohitvinodmalhotra@gmail.com 43f6104967 Merge branch 'main' into eval/visualcodebench 2025-01-26 15:14:28 -05:00
openhands e249b920ff feat: adapt Design2Code block detection for in-memory evaluation 2024-11-30 19:28:22 +00:00
rohitvinodmalhotra@gmail.com d920a69f69 adding back server code 2024-11-30 14:00:25 -05:00
openhands a8ce888981 refactor: adapt Design2Code evaluation metrics 2024-11-30 17:17:05 +00:00
rohitvinodmalhotra@gmail.com e22ddc0dd6 uncomment agent run 2024-11-26 17:00:07 -05:00
rohitvinodmalhotra@gmail.com c370912f12 adding eval scripts 2024-11-26 16:57:19 -05:00
634 changed files with 19204 additions and 41545 deletions
-1
View File
@@ -30,7 +30,6 @@ body:
description: How are you running OpenHands? description: How are you running OpenHands?
options: options:
- Docker command in README - Docker command in README
- GitHub resolver
- Development workflow - Development workflow
- app.all-hands.dev - app.all-hands.dev
- Other - Other
+7 -8
View File
@@ -1,12 +1,11 @@
- [ ] This change is worth documenting at https://docs.all-hands.dev/ **End-user friendly description of the problem this fixes or functionality that this introduces**
- [ ] Include this change in the Release Notes. If checked, you **must** provide an **end-user friendly** description for your change below
- [ ] Include this change in the Release Notes. If checked, you must provide an **end-user friendly** description for your change below
---
**Give a summary of what the PR does, explaining any non-trivial design decisions**
**End-user friendly description of the problem this fixes or functionality that this introduces.**
--- ---
**Give a summary of what the PR does, explaining any non-trivial design decisions.** **Link of any specific issues this addresses**
---
**Link of any specific issues this addresses.**
+14 -4
View File
@@ -19,15 +19,25 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Install tmux - name: Install tmux
run: sudo apt-get update && sudo apt-get install -y tmux run: sudo apt-get update && sudo apt-get install -y tmux
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Install poetry via pipx - name: Install poetry via pipx
run: pipx install poetry run: pipx install poetry
- name: Set up Python - name: Set up Python
+73 -30
View File
@@ -41,10 +41,22 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with: with:
ref: ${{ github.event.pull_request.head.sha }} # this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3.6.0 uses: docker/setup-qemu-action@v3.3.0
with: with:
image: tonistiigi/binfmt:latest image: tonistiigi/binfmt:latest
- name: Login to GHCR - name: Login to GHCR
@@ -56,22 +68,22 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Lowercase Repository Owner
run: |
echo REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and push app image - name: Build and push app image
if: "!github.event.pull_request.head.repo.fork" if: "!github.event.pull_request.head.repo.fork"
run: | run: |
./containers/build.sh -i openhands -o ${{ env.REPO_OWNER }} --push ./containers/build.sh -i openhands -o ${{ github.repository_owner }} --push
- name: Build app image - name: Build app image
if: "github.event.pull_request.head.repo.fork" if: "github.event.pull_request.head.repo.fork"
run: | run: |
./containers/build.sh -i openhands -o ${{ env.REPO_OWNER }} --load ./containers/build.sh -i openhands -o ${{ github.repository_owner }} --load
- name: Get hash in App Image - name: Get hash in App Image
id: get_hash_in_app_image id: get_hash_in_app_image
run: | run: |
# Lowercase the repository owner
export REPO_OWNER=${{ github.repository_owner }}
REPO_OWNER=$(echo $REPO_OWNER | tr '[:upper:]' '[:lower:]')
# Run the build script in the app image # Run the build script in the app image
docker run -e SANDBOX_USER_ID=0 -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/${{ env.REPO_OWNER }}/openhands:${{ env.RELEVANT_SHA }} /bin/bash -c "mkdir -p containers/runtime; python3 openhands/runtime/utils/runtime_build.py --base_image ${{ env.BASE_IMAGE_FOR_HASH_EQUIVALENCE_TEST }} --build_folder containers/runtime --force_rebuild" 2>&1 | tee docker-outputs.txt docker run -e SANDBOX_USER_ID=0 -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/${REPO_OWNER}/openhands:${{ env.RELEVANT_SHA }} /bin/bash -c "mkdir -p containers/runtime; python3 openhands/runtime/utils/runtime_build.py --base_image ${{ env.BASE_IMAGE_FOR_HASH_EQUIVALENCE_TEST }} --build_folder containers/runtime --force_rebuild" 2>&1 | tee docker-outputs.txt
# Get the hash from the build script # Get the hash from the build script
hash_from_app_image=$(cat docker-outputs.txt | grep "Hash for docker build directory" | awk -F "): " '{print $2}' | uniq | head -n1) hash_from_app_image=$(cat docker-outputs.txt | grep "Hash for docker build directory" | awk -F "): " '{print $2}' | uniq | head -n1)
echo "hash_from_app_image=$hash_from_app_image" >> $GITHUB_OUTPUT echo "hash_from_app_image=$hash_from_app_image" >> $GITHUB_OUTPUT
@@ -92,10 +104,22 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with: with:
ref: ${{ github.event.pull_request.head.sha }} # this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v3.6.0 uses: docker/setup-qemu-action@v3.3.0
with: with:
image: tonistiigi/binfmt:latest image: tonistiigi/binfmt:latest
- name: Login to GHCR - name: Login to GHCR
@@ -126,19 +150,16 @@ jobs:
run: make install-python-dependencies run: make install-python-dependencies
- name: Create source distribution and Dockerfile - name: Create source distribution and Dockerfile
run: poetry run python3 openhands/runtime/utils/runtime_build.py --base_image ${{ matrix.base_image.image }} --build_folder containers/runtime --force_rebuild run: poetry run python3 openhands/runtime/utils/runtime_build.py --base_image ${{ matrix.base_image.image }} --build_folder containers/runtime --force_rebuild
- name: Lowercase Repository Owner
run: |
echo REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and push runtime image ${{ matrix.base_image.image }} - name: Build and push runtime image ${{ matrix.base_image.image }}
if: github.event.pull_request.head.repo.fork != true if: github.event.pull_request.head.repo.fork != true
run: | run: |
./containers/build.sh -i runtime -o ${{ env.REPO_OWNER }} --push -t ${{ matrix.base_image.tag }} ./containers/build.sh -i runtime -o ${{ github.repository_owner }} --push -t ${{ matrix.base_image.tag }}
# Forked repos can't push to GHCR, so we need to upload the image as an artifact # Forked repos can't push to GHCR, so we need to upload the image as an artifact
- name: Build runtime image ${{ matrix.base_image.image }} for fork - name: Build runtime image ${{ matrix.base_image.image }} for fork
if: github.event.pull_request.head.repo.fork if: github.event.pull_request.head.repo.fork
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
with: with:
tags: ghcr.io/${{ env.REPO_OWNER }}/runtime:${{ env.RELEVANT_SHA }}-${{ matrix.base_image.tag }} tags: ghcr.io/all-hands-ai/runtime:${{ env.RELEVANT_SHA }}-${{ matrix.base_image.tag }}
outputs: type=docker,dest=/tmp/runtime-${{ matrix.base_image.tag }}.tar outputs: type=docker,dest=/tmp/runtime-${{ matrix.base_image.tag }}.tar
context: containers/runtime context: containers/runtime
- name: Upload runtime image for fork - name: Upload runtime image for fork
@@ -158,8 +179,6 @@ jobs:
base_image: ['nikolaik'] base_image: ['nikolaik']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Cache Poetry dependencies - name: Cache Poetry dependencies
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@@ -200,7 +219,7 @@ jobs:
exit 1 exit 1
fi fi
# Run unit tests with the Docker runtime Docker images as root # Run unit tests with the EventStream runtime Docker images as root
test_runtime_root: test_runtime_root:
name: RT Unit Tests (Root) name: RT Unit Tests (Root)
needs: [ghcr_build_runtime] needs: [ghcr_build_runtime]
@@ -211,6 +230,20 @@ jobs:
base_image: ['nikolaik'] base_image: ['nikolaik']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -242,10 +275,7 @@ jobs:
run: pipx install poetry run: pipx install poetry
- name: Install Python dependencies using Poetry - name: Install Python dependencies using Poetry
run: make install-python-dependencies run: make install-python-dependencies
- name: Lowercase Repository Owner - name: Run runtime tests
run: |
echo REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Run docker runtime tests
run: | run: |
# We install pytest-xdist in order to run tests across CPUs # We install pytest-xdist in order to run tests across CPUs
poetry run pip install pytest-xdist poetry run pip install pytest-xdist
@@ -253,9 +283,10 @@ jobs:
# Install to be able to retry on failures for flaky tests # Install to be able to retry on failures for flaky tests
poetry run pip install pytest-rerunfailures poetry run pip install pytest-rerunfailures
image_name=ghcr.io/${{ env.REPO_OWNER }}/runtime:${{ env.RELEVANT_SHA }}-${{ matrix.base_image }} image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ env.RELEVANT_SHA }}-${{ matrix.base_image }}
image_name=$(echo $image_name | tr '[:upper:]' '[:lower:]')
TEST_RUNTIME=docker \ TEST_RUNTIME=eventstream \
SANDBOX_USER_ID=$(id -u) \ SANDBOX_USER_ID=$(id -u) \
SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \ SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \
TEST_IN_CI=true \ TEST_IN_CI=true \
@@ -266,7 +297,7 @@ jobs:
env: env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# Run unit tests with the Docker runtime Docker images as openhands user # Run unit tests with the EventStream runtime Docker images as openhands user
test_runtime_oh: test_runtime_oh:
name: RT Unit Tests (openhands) name: RT Unit Tests (openhands)
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -276,6 +307,20 @@ jobs:
base_image: ['nikolaik'] base_image: ['nikolaik']
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -307,9 +352,6 @@ jobs:
run: pipx install poetry run: pipx install poetry
- name: Install Python dependencies using Poetry - name: Install Python dependencies using Poetry
run: make install-python-dependencies run: make install-python-dependencies
- name: Lowercase Repository Owner
run: |
echo REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Run runtime tests - name: Run runtime tests
run: | run: |
# We install pytest-xdist in order to run tests across CPUs # We install pytest-xdist in order to run tests across CPUs
@@ -318,9 +360,10 @@ jobs:
# Install to be able to retry on failures for flaky tests # Install to be able to retry on failures for flaky tests
poetry run pip install pytest-rerunfailures poetry run pip install pytest-rerunfailures
image_name=ghcr.io/${{ env.REPO_OWNER }}/runtime:${{ env.RELEVANT_SHA }}-${{ matrix.base_image }} image_name=ghcr.io/${{ github.repository_owner }}/runtime:${{ env.RELEVANT_SHA }}-${{ matrix.base_image }}
image_name=$(echo $image_name | tr '[:upper:]' '[:lower:]')
TEST_RUNTIME=docker \ TEST_RUNTIME=eventstream \
SANDBOX_USER_ID=$(id -u) \ SANDBOX_USER_ID=$(id -u) \
SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \ SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \
TEST_IN_CI=true \ TEST_IN_CI=true \
-5
View File
@@ -40,11 +40,6 @@ jobs:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache: "poetry" cache: "poetry"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Comment on PR if 'integration-test' label is present - name: Comment on PR if 'integration-test' label is present
if: github.event_name == 'pull_request' && github.event.label.name == 'integration-test' if: github.event_name == 'pull_request' && github.event.label.name == 'integration-test'
uses: KeisukeYamashita/create-comment@v1 uses: KeisukeYamashita/create-comment@v1
+10 -18
View File
@@ -20,10 +20,6 @@ on:
required: false required: false
type: string type: string
default: "anthropic/claude-3-5-sonnet-20241022" default: "anthropic/claude-3-5-sonnet-20241022"
LLM_API_VERSION:
required: false
type: string
default: ""
base_container_image: base_container_image:
required: false required: false
type: string type: string
@@ -88,10 +84,12 @@ jobs:
run: | run: |
python -m pip index versions openhands-ai > openhands_versions.txt python -m pip index versions openhands-ai > openhands_versions.txt
OPENHANDS_VERSION=$(head -n 1 openhands_versions.txt | awk '{print $2}' | tr -d '()') OPENHANDS_VERSION=$(head -n 1 openhands_versions.txt | awk '{print $2}' | tr -d '()')
# Ensure requirements.txt ends with newline before appending
# Create a new requirements.txt locally within the workflow, ensuring no reference to the repo's file if [ -f requirements.txt ] && [ -s requirements.txt ]; then
echo "openhands-ai==${OPENHANDS_VERSION}" > /tmp/requirements.txt sed -i -e '$a\' requirements.txt
cat /tmp/requirements.txt fi
echo "openhands-ai==${OPENHANDS_VERSION}" >> requirements.txt
cat requirements.txt
- name: Cache pip dependencies - name: Cache pip dependencies
if: | if: |
@@ -109,16 +107,15 @@ jobs:
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ${{ env.pythonLocation }}/lib/python3.12/site-packages/* path: ${{ env.pythonLocation }}/lib/python3.12/site-packages/*
key: ${{ runner.os }}-pip-openhands-resolver-${{ hashFiles('/tmp/requirements.txt') }} key: ${{ runner.os }}-pip-openhands-resolver-${{ hashFiles('requirements.txt') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pip-openhands-resolver-${{ hashFiles('/tmp/requirements.txt') }} ${{ runner.os }}-pip-openhands-resolver-${{ hashFiles('requirements.txt') }}
- name: Check required environment variables - name: Check required environment variables
env: env:
LLM_MODEL: ${{ secrets.LLM_MODEL || inputs.LLM_MODEL }} LLM_MODEL: ${{ secrets.LLM_MODEL || inputs.LLM_MODEL }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }} LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
LLM_API_VERSION: ${{ inputs.LLM_API_VERSION }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }} PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
PAT_USERNAME: ${{ secrets.PAT_USERNAME }} PAT_USERNAME: ${{ secrets.PAT_USERNAME }}
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
@@ -175,7 +172,7 @@ jobs:
echo "SANDBOX_ENV_BASE_CONTAINER_IMAGE=${{ inputs.base_container_image }}" >> $GITHUB_ENV echo "SANDBOX_ENV_BASE_CONTAINER_IMAGE=${{ inputs.base_container_image }}" >> $GITHUB_ENV
# Set branch variables # Set branch variables
echo "TARGET_BRANCH=${{ inputs.target_branch || 'main' }}" >> $GITHUB_ENV echo "TARGET_BRANCH=${{ inputs.target_branch }}" >> $GITHUB_ENV
- name: Comment on issue with start message - name: Comment on issue with start message
uses: actions/github-script@v7 uses: actions/github-script@v7
@@ -223,18 +220,16 @@ jobs:
} else { } else {
console.log("Installing from requirements.txt..."); console.log("Installing from requirements.txt...");
await exec.exec("python -m pip install --upgrade pip"); await exec.exec("python -m pip install --upgrade pip");
await exec.exec("pip install -r /tmp/requirements.txt"); await exec.exec("pip install -r requirements.txt");
} }
- name: Attempt to resolve issue - name: Attempt to resolve issue
env: env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || github.token }} GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || github.token }}
GITHUB_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }} GITHUB_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }}
GIT_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }}
LLM_MODEL: ${{ secrets.LLM_MODEL || inputs.LLM_MODEL }} LLM_MODEL: ${{ secrets.LLM_MODEL || inputs.LLM_MODEL }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }} LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
LLM_API_VERSION: ${{ inputs.LLM_API_VERSION }}
PYTHONPATH: "" PYTHONPATH: ""
run: | run: |
cd /tmp && python -m openhands.resolver.resolve_issue \ cd /tmp && python -m openhands.resolver.resolve_issue \
@@ -267,17 +262,14 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || github.token }} GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || github.token }}
GITHUB_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }} GITHUB_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }}
GIT_USERNAME: ${{ secrets.PAT_USERNAME || 'openhands-agent' }}
LLM_MODEL: ${{ secrets.LLM_MODEL || inputs.LLM_MODEL }} LLM_MODEL: ${{ secrets.LLM_MODEL || inputs.LLM_MODEL }}
LLM_API_KEY: ${{ secrets.LLM_API_KEY }} LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }} LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
LLM_API_VERSION: ${{ inputs.LLM_API_VERSION }}
PYTHONPATH: "" PYTHONPATH: ""
run: | run: |
if [ "${{ steps.check_result.outputs.RESOLUTION_SUCCESS }}" == "true" ]; then if [ "${{ steps.check_result.outputs.RESOLUTION_SUCCESS }}" == "true" ]; then
cd /tmp && python -m openhands.resolver.send_pull_request \ cd /tmp && python -m openhands.resolver.send_pull_request \
--issue-number ${{ env.ISSUE_NUMBER }} \ --issue-number ${{ env.ISSUE_NUMBER }} \
--target-branch ${{ env.TARGET_BRANCH }} \
--pr-type draft \ --pr-type draft \
--reviewer ${{ github.actor }} | tee pr_result.txt && \ --reviewer ${{ github.actor }} | tee pr_result.txt && \
grep "draft created" pr_result.txt | sed 's/.*\///g' > pr_number.txt grep "draft created" pr_result.txt | sed 's/.*\///g' > pr_number.txt
+98
View File
@@ -0,0 +1,98 @@
# Workflow that runs python unit tests on mac
name: Run Python Unit Tests Mac
# This job is flaky so only run it nightly
on:
schedule:
- cron: '0 0 * * *'
jobs:
# Run python unit tests on macOS
test-on-macos:
name: Python Unit Tests on macOS
runs-on: macos-14
env:
INSTALL_DOCKER: '1' # Set to '0' to skip Docker installation
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache Poetry dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
~/.virtualenvs
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Install tmux
run: brew install tmux
- name: Install poetry via pipx
run: pipx install poetry
- name: Install Python dependencies using Poetry
run: poetry install --without evaluation,llama-index
- name: Install & Start Docker
if: env.INSTALL_DOCKER == '1'
run: |
INSTANCE_NAME="colima-${GITHUB_RUN_ID}"
# Uninstall colima to upgrade to the latest version
if brew list colima &>/dev/null; then
brew uninstall colima
# unlinking colima dependency: go
brew uninstall go@1.21
fi
rm -rf ~/.colima ~/.lima
brew install --HEAD colima
brew install docker
start_colima() {
# Find a free port in the range 10000-20000
RANDOM_PORT=$((RANDOM % 10001 + 10000))
# Original line:
if ! colima start --network-address --arch x86_64 --cpu=1 --memory=1 --verbose --ssh-port $RANDOM_PORT; then
echo "Failed to start Colima."
return 1
fi
return 0
}
# Attempt to start Colima for 5 total attempts:
ATTEMPT_LIMIT=5
for ((i=1; i<=ATTEMPT_LIMIT; i++)); do
if start_colima; then
echo "Colima started successfully."
break
else
colima stop -f
sleep 10
colima delete -f
if [ $i -eq $ATTEMPT_LIMIT ]; then
exit 1
fi
sleep 10
fi
done
# For testcontainers to find the Colima socket
# https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- name: Build Environment
run: make build
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Run Tests
run: poetry run pytest --forked --cov=openhands --cov-report=xml ./tests/unit --ignore=tests/unit/test_memory.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+1 -5
View File
@@ -32,10 +32,6 @@ jobs:
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Install tmux - name: Install tmux
run: sudo apt-get update && sudo apt-get install -y tmux run: sudo apt-get update && sudo apt-get install -y tmux
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Install poetry via pipx - name: Install poetry via pipx
run: pipx install poetry run: pipx install poetry
- name: Set up Python - name: Set up Python
@@ -48,7 +44,7 @@ jobs:
- name: Build Environment - name: Build Environment
run: make build run: make build
- name: Run Tests - name: Run Tests
run: poetry run pytest --forked -n auto --cov=openhands --cov-report=xml -svv ./tests/unit --ignore=tests/unit/test_long_term_memory.py run: poetry run pytest --forked -n auto --cov=openhands --cov-report=xml -svv ./tests/unit --ignore=tests/unit/test_memory.py
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v5 uses: codecov/codecov-action@v5
env: env:
-1
View File
@@ -19,4 +19,3 @@ jobs:
close-issue-message: 'This issue was closed because it has been stalled for over 30 days with no activity.' close-issue-message: 'This issue was closed because it has been stalled for over 30 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for over 30 days with no activity.' close-pr-message: 'This PR was closed because it has been stalled for over 30 days with no activity.'
days-before-close: 7 days-before-close: 7
operations-per-run: 150
+1
View File
@@ -176,6 +176,7 @@ evaluation/gorilla/data
evaluation/toolqa/data evaluation/toolqa/data
evaluation/scienceagentbench/benchmark evaluation/scienceagentbench/benchmark
evaluation/commit0_bench/repos evaluation/commit0_bench/repos
evaluation/visualcodebench/
# openhands resolver # openhands resolver
output/ output/
-172
View File
@@ -1,172 +0,0 @@
# OpenHands Glossary
### Agent
The core AI entity in OpenHands that can perform software development tasks by interacting with tools, browsing the web, and modifying code.
#### Agent Controller
A component that manages the agent's lifecycle, handles its state, and coordinates interactions between the agent and various tools.
#### Agent Delegation
The ability of an agent to hand off specific tasks to other specialized agents for better task completion.
#### Agent Hub
A central registry of different agent types and their capabilities, allowing for easy agent selection and instantiation.
#### Agent Skill
A specific capability or function that an agent can perform, such as file manipulation, web browsing, or code editing.
#### Agent State
The current context and status of an agent, including its memory, active tools, and ongoing tasks.
#### CodeAct Agent
[A generalist agent in OpenHands](https://arxiv.org/abs/2407.16741) designed to perform tasks by editing and executing code.
### Browser
A system for web-based interactions and tasks.
#### Browser Gym
A testing and evaluation environment for browser-based agent interactions and tasks.
#### Web Browser Tool
A tool that enables agents to interact with web pages and perform web-based tasks.
### Commands
Terminal and execution related functionality.
#### Bash Session
A persistent terminal session that maintains state and history for bash command execution.
This uses tmux under the hood.
### Configuration
System-wide settings and options.
#### Agent Configuration
Settings that define an agent's behavior, capabilities, and limitations, including available tools and runtime settings.
#### Configuration Options
Settings that control various aspects of OpenHands behavior, including runtime, security, and agent settings.
#### LLM Config
Configuration settings for language models used by agents, including model selection and parameters.
#### LLM Draft Config
Settings for draft mode operations with language models, typically used for faster, lower-quality responses.
#### Runtime Configuration
Settings that define how the runtime environment should be set up and operated.
#### Security Options
Configuration settings that control security features and restrictions.
### Conversation
A sequence of interactions between a user and an agent, including messages, actions, and their results.
#### Conversation Info
Metadata about a conversation, including its status, participants, and timeline.
#### Conversation Manager
A component that handles the creation, storage, and retrieval of conversations.
#### Conversation Metadata
Additional information about conversations, such as tags, timestamps, and related resources.
#### Conversation Status
The current state of a conversation, including whether it's active, completed, or failed.
#### Conversation Store
A storage system for maintaining conversation history and related data.
### Events
#### Event
Every Conversation comprises a series of Events. Each Event is either an Action or an Observation.
#### Event Stream
A continuous flow of events that represents the ongoing activities and interactions in the system.
#### Action
A specific operation or command that an agent executes through available tools, such as running a command or editing a file.
#### Observation
The response or result returned by a tool after an agent's action, providing feedback about the action's outcome.
### Interface
Different ways to interact with OpenHands.
#### CLI Mode
A command-line interface mode for interacting with OpenHands agents without a graphical interface.
#### GUI Mode
A graphical user interface mode for interacting with OpenHands agents through a web interface.
#### Headless Mode
A mode of operation where OpenHands runs without a user interface, suitable for automation and scripting.
### Agent Memory
The system that decides which parts of the Event Stream (i.e. the conversation history) should be passed into each LLM prompt.
#### Memory Store
A storage system for maintaining agent memory and context across sessions.
#### Condenser
A component that processes and summarizes conversation history to maintain context while staying within token limits.
#### Truncation
A very simple Condenser strategy. Reduces conversation history or content to stay within token limits.
### Microagent
A specialized prompt that enhances OpenHands with domain-specific knowledge, repository-specific context, and task-specific workflows.
#### Microagent Registry
A central repository of available microagents and their configurations.
#### Public Microagent
A general-purpose microagent available to all OpenHands users, triggered by specific keywords.
#### Repository Microagent
A type of microagent that provides repository-specific context and guidelines, stored in the `.openhands/microagents/` directory.
### Prompt
Components for managing and processing prompts.
#### Prompt Caching
A system for caching and reusing common prompts to improve performance.
#### Prompt Manager
A component that handles the loading, processing, and management of prompts used by agents, including microagents.
#### Response Parsing
The process of interpreting and structuring responses from language models and tools.
### Runtime
The execution environment where agents perform their tasks, which can be local, remote, or containerized.
#### Action Execution Server
A REST API that receives agent actions (e.g. bash commands, python code, browsing actions), executes them in the runtime environment, and returns the results.
#### Action Execution Client
A component that handles the execution of actions in the runtime environment, managing the communication between the agent and the runtime.
#### Docker Runtime
A containerized runtime environment that provides isolation and reproducibility for agent operations.
#### E2B Runtime
A specialized runtime environment built on E2B for secure and isolated code execution.
#### Local Runtime
A runtime environment that executes on the local machine, suitable for development and testing.
#### Modal Runtime
A runtime environment built on Modal for scalable and distributed agent operations.
#### Remote Runtime
A sandboxed environment that executes code and commands remotely, providing isolation and security for agent operations.
#### Runtime Builder
A component that builds a Docker image for the Action Execution Server based on a user-specified base image.
### Security
Security-related components and features.
#### Security Analyzer
A component that checks agent actions for potential security risks.
-55
View File
@@ -1,55 +0,0 @@
cff-version: 1.2.0
message: "If you use this software, please cite it using the following metadata."
title: "OpenHands: An Open Platform for AI Software Developers as Generalist Agents"
authors:
- family-names: Wang
given-names: Xingyao
- family-names: Li
given-names: Boxuan
- family-names: Song
given-names: Yufan
- family-names: Xu
given-names: Frank F.
- family-names: Tang
given-names: Xiangru
- family-names: Zhuge
given-names: Mingchen
- family-names: Pan
given-names: Jiayi
- family-names: Song
given-names: Yueqi
- family-names: Li
given-names: Bowen
- family-names: Singh
given-names: Jaskirat
- family-names: Tran
given-names: Hoang H.
- family-names: Li
given-names: Fuqiang
- family-names: Ma
given-names: Ren
- family-names: Zheng
given-names: Mingzhang
- family-names: Qian
given-names: Bill
- family-names: Shao
given-names: Yanjun
- family-names: Muennighoff
given-names: Niklas
- family-names: Zhang
given-names: Yizhe
- family-names: Hui
given-names: Binyuan
- family-names: Lin
given-names: Junyang
- family-names: Brennan
given-names: Robert
- family-names: Peng
given-names: Hao
- family-names: Ji
given-names: Heng
- family-names: Neubig
given-names: Graham
year: 2024
doi: "10.48550/arXiv.2407.16741"
url: "https://arxiv.org/abs/2407.16741"
+1 -1
View File
@@ -100,7 +100,7 @@ poetry run pytest ./tests/unit/test_*.py
To reduce build time (e.g., if no changes were made to the client-runtime component), you can use an existing Docker container image by To reduce build time (e.g., if no changes were made to the client-runtime component), you can use an existing Docker container image by
setting the SANDBOX_RUNTIME_CONTAINER_IMAGE environment variable to the desired Docker image. setting the SANDBOX_RUNTIME_CONTAINER_IMAGE environment variable to the desired Docker image.
Example: `export SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:0.28-nikolaik` Example: `export SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:0.21-nikolaik`
## Develop inside Docker container ## Develop inside Docker container
+3 -10
View File
@@ -2,13 +2,12 @@
These are the procedures and guidelines on how issues are triaged in this repo by the maintainers. These are the procedures and guidelines on how issues are triaged in this repo by the maintainers.
## General ## General
* All issues must be tagged with **enhancement**, **bug** or **troubleshooting/help**. * Most issues must be tagged with **enhancement** or **bug**.
* Issues may be tagged with what it relates to (**agent quality**, **frontend**, **resolver**, etc.). * Issues may be tagged with what it relates to (**backend**, **frontend**, **agent quality**, etc.).
## Severity ## Severity
* **Low**: Minor issues or affecting single user. * **Low**: Minor issues or affecting single user.
* **Medium**: Affecting multiple users. * **Medium**: Affecting multiple users.
* **High**: High visibility issues or affecting many users.
* **Critical**: Affecting all users or potential security issues. * **Critical**: Affecting all users or potential security issues.
## Effort ## Effort
@@ -19,14 +18,8 @@ These are the procedures and guidelines on how issues are triaged in this repo b
## Not Enough Information ## Not Enough Information
* User is asked to provide more information (logs, how to reproduce, etc.) when the issue is not clear. * User is asked to provide more information (logs, how to reproduce, etc.) when the issue is not clear.
* If an issue is unclear and the author does not provide more information or respond to a request, * If an issue is unclear and the author does not provide more information or respond to a request, the issue may be closed as **not planned** (Usually after a week).
the issue may be closed as **not planned** (Usually after a week).
## Multiple Requests/Fixes in One Issue ## Multiple Requests/Fixes in One Issue
* These issues will be narrowed down to one request/fix so the issue is more easily tracked and fixed. * These issues will be narrowed down to one request/fix so the issue is more easily tracked and fixed.
* Issues may be broken down into multiple issues if required. * Issues may be broken down into multiple issues if required.
## Stale and Auto Closures
* In order to keep a maintainable backlog, issues that have no activity within 30 days are automatically marked as **Stale**.
* If issues marked as **Stale** continue to have no activity for 7 more days, they will automatically be closed as not planned.
* Issues may be reopened by maintainers if deemed important.
+3 -3
View File
@@ -1,4 +1,4 @@
SHELL=/usr/bin/env bash SHELL=/bin/bash
# Makefile for OpenHands project # Makefile for OpenHands project
# Variables # Variables
@@ -81,10 +81,10 @@ check-nodejs:
@if command -v node > /dev/null; then \ @if command -v node > /dev/null; then \
NODE_VERSION=$(shell node --version | sed -E 's/v//g'); \ NODE_VERSION=$(shell node --version | sed -E 's/v//g'); \
IFS='.' read -r -a NODE_VERSION_ARRAY <<< "$$NODE_VERSION"; \ IFS='.' read -r -a NODE_VERSION_ARRAY <<< "$$NODE_VERSION"; \
if [ "$${NODE_VERSION_ARRAY[0]}" -ge 22 ]; then \ if [ "$${NODE_VERSION_ARRAY[0]}" -ge 20 ]; then \
echo "$(BLUE)Node.js $$NODE_VERSION is already installed.$(RESET)"; \ echo "$(BLUE)Node.js $$NODE_VERSION is already installed.$(RESET)"; \
else \ else \
echo "$(RED)Node.js 22.x or later is required. Please install Node.js 22.x or later to continue.$(RESET)"; \ echo "$(RED)Node.js 20.x or later is required. Please install Node.js 20.x or later to continue.$(RESET)"; \
exit 1; \ exit 1; \
fi; \ fi; \
else \ else \
+5 -5
View File
@@ -12,7 +12,7 @@
<a href="https://codecov.io/github/All-Hands-AI/OpenHands?branch=main"><img alt="CodeCov" src="https://img.shields.io/codecov/c/github/All-Hands-AI/OpenHands?style=for-the-badge&color=blue"></a> <a href="https://codecov.io/github/All-Hands-AI/OpenHands?branch=main"><img alt="CodeCov" src="https://img.shields.io/codecov/c/github/All-Hands-AI/OpenHands?style=for-the-badge&color=blue"></a>
<a href="https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE"><img src="https://img.shields.io/github/license/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" alt="MIT License"></a> <a href="https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE"><img src="https://img.shields.io/github/license/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" alt="MIT License"></a>
<br/> <br/>
<a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2ypg5jweb-d~6hObZDbXi_HEL8PDrbHg"><img src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge" alt="Join our Slack community"></a> <a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw"><img src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge" alt="Join our Slack community"></a>
<a href="https://discord.gg/ESHStjSjD4"><img src="https://img.shields.io/badge/Discord-Join%20Us-purple?logo=discord&logoColor=white&style=for-the-badge" alt="Join our Discord community"></a> <a href="https://discord.gg/ESHStjSjD4"><img src="https://img.shields.io/badge/Discord-Join%20Us-purple?logo=discord&logoColor=white&style=for-the-badge" alt="Join our Discord community"></a>
<a href="https://github.com/All-Hands-AI/OpenHands/blob/main/CREDITS.md"><img src="https://img.shields.io/badge/Project-Credits-blue?style=for-the-badge&color=FFE165&logo=github&logoColor=white" alt="Credits"></a> <a href="https://github.com/All-Hands-AI/OpenHands/blob/main/CREDITS.md"><img src="https://img.shields.io/badge/Project-Credits-blue?style=for-the-badge&color=FFE165&logo=github&logoColor=white" alt="Credits"></a>
<br/> <br/>
@@ -43,17 +43,17 @@ See the [Running OpenHands](https://docs.all-hands.dev/modules/usage/installatio
system requirements and more information. system requirements and more information.
```bash ```bash
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik docker pull docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik
docker run -it --rm --pull=always \ docker run -it --rm --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e LOG_ALL_EVENTS=true \ -e LOG_ALL_EVENTS=true \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
-v ~/.openhands-state:/.openhands-state \ -v ~/.openhands-state:/.openhands-state \
-p 3000:3000 \ -p 3000:3000 \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app \ --name openhands-app \
docker.all-hands.dev/all-hands-ai/openhands:0.28 docker.all-hands.dev/all-hands-ai/openhands:0.21
``` ```
You'll find OpenHands running at [http://localhost:3000](http://localhost:3000)! You'll find OpenHands running at [http://localhost:3000](http://localhost:3000)!
@@ -96,7 +96,7 @@ troubleshooting resources, and advanced configuration options.
OpenHands is a community-driven project, and we welcome contributions from everyone. We do most of our communication OpenHands is a community-driven project, and we welcome contributions from everyone. We do most of our communication
through Slack, so this is the best place to start, but we also are happy to have you contact us on Discord or Github: through Slack, so this is the best place to start, but we also are happy to have you contact us on Discord or Github:
- [Join our Slack workspace](https://join.slack.com/t/openhands-ai/shared_invite/zt-2ypg5jweb-d~6hObZDbXi_HEL8PDrbHg) - Here we talk about research, architecture, and future development. - [Join our Slack workspace](https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw) - Here we talk about research, architecture, and future development.
- [Join our Discord server](https://discord.gg/ESHStjSjD4) - This is a community-run server for general discussion, questions, and feedback. - [Join our Discord server](https://discord.gg/ESHStjSjD4) - This is a community-run server for general discussion, questions, and feedback.
- [Read or post Github Issues](https://github.com/All-Hands-AI/OpenHands/issues) - Check out the issues we're working on, or add your own ideas. - [Read or post Github Issues](https://github.com/All-Hands-AI/OpenHands/issues) - Check out the issues we're working on, or add your own ideas.
+2 -1
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/bin/bash
set -e set -e
cp pyproject.toml poetry.lock openhands
poetry build -v poetry build -v
+2 -80
View File
@@ -17,12 +17,6 @@
#modal_api_token_id = "" #modal_api_token_id = ""
#modal_api_token_secret = "" #modal_api_token_secret = ""
# API key for Daytona
#daytona_api_key = ""
# Daytona Target
#daytona_target = ""
# Base path for the workspace # Base path for the workspace
workspace_base = "./workspace" workspace_base = "./workspace"
@@ -95,11 +89,6 @@ workspace_base = "./workspace"
# List of allowed file extensions for uploads # List of allowed file extensions for uploads
#file_uploads_allowed_extensions = [".*"] #file_uploads_allowed_extensions = [".*"]
# Whether to enable the default LLM summarizing condenser when no condenser is specified in config
# When true, a LLMSummarizingCondenserConfig will be used as the default condenser
# When false, a NoOpCondenserConfig (no summarization) will be used
#enable_default_condenser = true
#################################### LLM ##################################### #################################### LLM #####################################
# Configuration for LLM models (group name starts with 'llm') # Configuration for LLM models (group name starts with 'llm')
# use 'llm' for the default LLM config # use 'llm' for the default LLM config
@@ -115,7 +104,7 @@ workspace_base = "./workspace"
#aws_secret_access_key = "" #aws_secret_access_key = ""
# API key to use (For Headless / CLI only - In Web this is overridden by Session Init) # API key to use (For Headless / CLI only - In Web this is overridden by Session Init)
api_key = "" api_key = "your-api-key"
# API base URL (For Headless / CLI only - In Web this is overridden by Session Init) # API base URL (For Headless / CLI only - In Web this is overridden by Session Init)
#base_url = "" #base_url = ""
@@ -206,7 +195,7 @@ model = "gpt-4o"
#native_tool_calling = None #native_tool_calling = None
[llm.gpt4o-mini] [llm.gpt4o-mini]
api_key = "" api_key = "your-api-key"
model = "gpt-4o" model = "gpt-4o"
@@ -245,10 +234,6 @@ codeact_enable_jupyter = true
# List of microagents to disable # List of microagents to disable
#disabled_microagents = [] #disabled_microagents = []
# Whether history should be truncated to continue the session when hitting LLM context
# length limit
enable_history_truncation = true
[agent.RepoExplorerAgent] [agent.RepoExplorerAgent]
# Example: use a cheaper model for RepoExplorerAgent to reduce cost, especially # Example: use a cheaper model for RepoExplorerAgent to reduce cost, especially
# useful when an agent doesn't demand high quality but uses a lot of tokens # useful when an agent doesn't demand high quality but uses a lot of tokens
@@ -299,69 +284,6 @@ llm_config = 'gpt3'
# The security analyzer to use (For Headless / CLI only - In Web this is overridden by Session Init) # The security analyzer to use (For Headless / CLI only - In Web this is overridden by Session Init)
#security_analyzer = "" #security_analyzer = ""
#################################### Condenser #################################
# Condensers control how conversation history is managed and compressed when
# the context grows too large. Each agent uses one condenser configuration.
##############################################################################
[condenser]
# The type of condenser to use. Available options:
# - "noop": No condensing, keeps full history (default)
# - "observation_masking": Keeps full event structure but masks older observations
# - "recent": Keeps only recent events and discards older ones
# - "llm": Uses an LLM to summarize conversation history
# - "amortized": Intelligently forgets older events while preserving important context
# - "llm_attention": Uses an LLM to prioritize most relevant context
type = "noop"
# Examples for each condenser type (uncomment and modify as needed):
# 1. NoOp Condenser - No additional settings needed
#type = "noop"
# 2. Observation Masking Condenser
#type = "observation_masking"
# Number of most-recent events where observations will not be masked
#attention_window = 100
# 3. Recent Events Condenser
#type = "recent"
# Number of initial events to always keep (typically includes task description)
#keep_first = 1
# Maximum number of events to keep in history
#max_events = 100
# 4. LLM Summarizing Condenser
#type = "llm"
# Reference to an LLM config to use for summarization
#llm_config = "condenser"
# Number of initial events to always keep (typically includes task description)
#keep_first = 1
# Maximum size of history before triggering summarization
#max_size = 100
# 5. Amortized Forgetting Condenser
#type = "amortized"
# Number of initial events to always keep (typically includes task description)
#keep_first = 1
# Maximum size of history before triggering forgetting
#max_size = 100
# 6. LLM Attention Condenser
#type = "llm_attention"
# Reference to an LLM config to use for attention scoring
#llm_config = "condenser"
# Number of initial events to always keep (typically includes task description)
#keep_first = 1
# Maximum size of history before triggering attention mechanism
#max_size = 100
# Example of a custom LLM configuration for condensers that require an LLM
# If not provided, it falls back to the default LLM
#[llm.condenser]
#model = "gpt-4o"
#temperature = 0.1
#max_tokens = 1024
#################################### Eval #################################### #################################### Eval ####################################
# Configuration for the evaluation, please refer to the specific evaluation # Configuration for the evaluation, please refer to the specific evaluation
# plugin for the available options # plugin for the available options
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
# Initialize variables with default values # Initialize variables with default values
+1 -1
View File
@@ -11,7 +11,7 @@ services:
- BACKEND_HOST=${BACKEND_HOST:-"0.0.0.0"} - BACKEND_HOST=${BACKEND_HOST:-"0.0.0.0"}
- SANDBOX_API_HOSTNAME=host.docker.internal - SANDBOX_API_HOSTNAME=host.docker.internal
# #
- SANDBOX_RUNTIME_CONTAINER_IMAGE=${SANDBOX_RUNTIME_CONTAINER_IMAGE:-ghcr.io/all-hands-ai/runtime:0.28-nikolaik} - SANDBOX_RUNTIME_CONTAINER_IMAGE=${SANDBOX_RUNTIME_CONTAINER_IMAGE:-ghcr.io/all-hands-ai/runtime:0.21-nikolaik}
- SANDBOX_USER_ID=${SANDBOX_USER_ID:-1234} - SANDBOX_USER_ID=${SANDBOX_USER_ID:-1234}
- WORKSPACE_MOUNT_PATH=${WORKSPACE_BASE:-$PWD/workspace} - WORKSPACE_MOUNT_PATH=${WORKSPACE_BASE:-$PWD/workspace}
ports: ports:
+1 -1
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -o pipefail set -o pipefail
function get_docker() { function get_docker() {
-3
View File
@@ -24,6 +24,3 @@ inline-quotes = "single"
[format] [format]
quote-style = "single" quote-style = "single"
[lint.flake8-bugbear]
extend-immutable-calls = ["Depends", "fastapi.Depends", "fastapi.params.Depends"]
+1 -1
View File
@@ -7,7 +7,7 @@ services:
image: openhands:latest image: openhands:latest
container_name: openhands-app-${DATE:-} container_name: openhands-app-${DATE:-}
environment: environment:
- SANDBOX_RUNTIME_CONTAINER_IMAGE=${SANDBOX_RUNTIME_CONTAINER_IMAGE:-docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik} - SANDBOX_RUNTIME_CONTAINER_IMAGE=${SANDBOX_RUNTIME_CONTAINER_IMAGE:-docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik}
#- SANDBOX_USER_ID=${SANDBOX_USER_ID:-1234} # enable this only if you want a specific non-root sandbox user but you will have to manually adjust permissions of openhands-state for this user #- SANDBOX_USER_ID=${SANDBOX_USER_ID:-1234} # enable this only if you want a specific non-root sandbox user but you will have to manually adjust permissions of openhands-state for this user
- WORKSPACE_MOUNT_PATH=${WORKSPACE_BASE:-$PWD/workspace} - WORKSPACE_MOUNT_PATH=${WORKSPACE_BASE:-$PWD/workspace}
ports: ports:
-8
View File
@@ -46,11 +46,3 @@ docker run -it \
-e THAT=that -e THAT=that
... ...
``` ```
### Referring to UI Elements
When referencing UI elements, use ``.
Example:
1. Toggle the `Advanced` option
2. Enter your model in the `Custom Model` textbox.
@@ -1,8 +1,8 @@
# 📦 Runtime Docker # 📦 Runtime EventStream
Le Runtime Docker d'OpenHands est le composant principal qui permet l'exécution sécurisée et flexible des actions des agents d'IA. Le Runtime EventStream d'OpenHands est le composant principal qui permet l'exécution sécurisée et flexible des actions des agents d'IA.
Il crée un environnement en bac à sable (sandbox) en utilisant Docker, où du code arbitraire peut être exécuté en toute sécurité sans risquer le système hôte. Il crée un environnement en bac à sable (sandbox) en utilisant Docker, où du code arbitraire peut être exécuté en toute sécurité sans risquer le système hôte.
## Pourquoi avons-nous besoin d'un runtime en bac à sable ? ## Pourquoi avons-nous besoin d'un runtime en bac à sable ?
@@ -163,7 +163,7 @@ Les options de configuration de base sont définies dans la section `[core]` du
- `runtime` - `runtime`
- Type : `str` - Type : `str`
- Valeur par défaut : `"docker"` - Valeur par défaut : `"eventstream"`
- Description : Environnement d'exécution - Description : Environnement d'exécution
- `default_agent` - `default_agent`
@@ -42,11 +42,10 @@ Créez un fichier ```config.toml``` dans le répertoire OpenHands et entrez ces
[core] [core]
workspace_base="./workspace" workspace_base="./workspace"
run_as_openhands=true run_as_openhands=true
[sandbox] sandbox_base_container_image="image_personnalisée"
base_container_image="image_personnalisée"
``` ```
> Assurez-vous que ```base_container_image``` est défini sur le nom de votre image personnalisée précédente. > Assurez-vous que ```sandbox_base_container_image``` est défini sur le nom de votre image personnalisée précédente.
## Exécution ## Exécution
@@ -83,17 +82,20 @@ dockerfile_content = (
## Dépannage / Erreurs ## Dépannage / Erreurs
### Erreur: ```useradd: UID 1000 est non unique``` ### Erreur: ```useradd: UID 1000 est non unique```
Si vous voyez cette erreur dans la sortie de la console, il s'agit du fait que OpenHands essaie de créer le utilisateur openhands dans le sandbox avec un ID d'utilisateur de 1000, cependant cet ID d'utilisateur est déjà utilisé dans l'image (pour une raison inconnue). Pour résoudre ce problème, changez la valeur du champ user_id dans le fichier config.toml en une valeur différente: Si vous voyez cette erreur dans la sortie de la console, il s'agit du fait que OpenHands essaie de créer le utilisateur openhands dans le sandbox avec un ID d'utilisateur de 1000, cependant cet ID d'utilisateur est déjà utilisé dans l'image (pour une raison inconnue). Pour résoudre ce problème, changez la valeur du champ sandbox_user_id dans le fichier config.toml en une valeur différente:
```toml ```toml
[core] [core]
workspace_base="./workspace" workspace_base="./workspace"
run_as_openhands=true run_as_openhands=true
[sandbox] sandbox_base_container_image="image_personnalisée"
base_container_image="image_personnalisée" sandbox_user_id="1001"
user_id="1001"
``` ```
### Erreurs de port d'utilisation ### Erreurs de port d'utilisation
Si vous voyez un message d'erreur indiquant que le port est utilisé ou indisponible, essayez de supprimer toutes les containers docker en cours d'exécution (exécutez `docker ps` et `docker rm` des containers concernés) puis ré-exécutez ```make run``` Si vous voyez un message d'erreur indiquant que le port est utilisé ou indisponible, essayez de supprimer toutes les containers docker en cours d'exécution (exécutez `docker ps` et `docker rm` des containers concernés) puis ré-exécutez ```make run```
## Discuter
Pour d'autres problèmes ou questions rejoignez le [Slack](https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw) ou le [Discord](https://discord.gg/ESHStjSjD4) et demandez!
@@ -52,7 +52,7 @@ LLM_API_KEY="sk_test_12345"
```bash ```bash
docker run -it \ docker run -it \
--pull=always \ --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e SANDBOX_USER_ID=$(id -u) \ -e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-e LLM_API_KEY=$LLM_API_KEY \ -e LLM_API_KEY=$LLM_API_KEY \
@@ -61,7 +61,7 @@ docker run -it \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app-$(date +%Y%m%d%H%M%S) \ --name openhands-app-$(date +%Y%m%d%H%M%S) \
docker.all-hands.dev/all-hands-ai/openhands:0.28 \ docker.all-hands.dev/all-hands-ai/openhands:0.21 \
python -m openhands.core.cli python -m openhands.core.cli
``` ```
@@ -44,13 +44,12 @@ Tout d'abord, assurez-vous de pouvoir exécuter OpenHands en suivant les instruc
### Spécifier l'Image de Base du Sandbox ### Spécifier l'Image de Base du Sandbox
Dans le fichier `config.toml` dans le répertoire OpenHands, définissez `base_container_image` sur l'image que vous souhaitez utiliser. Cela peut être une image que vous avez déjà extraite ou une que vous avez construite : Dans le fichier `config.toml` dans le répertoire OpenHands, définissez `sandbox_base_container_image` sur l'image que vous souhaitez utiliser. Cela peut être une image que vous avez déjà extraite ou une que vous avez construite :
```bash ```bash
[core] [core]
... ...
[sandbox] sandbox_base_container_image="custom-image"
base_container_image="custom-image"
``` ```
### Exécution ### Exécution
@@ -114,7 +114,7 @@ Pour créer un workflow d'évaluation pour votre benchmark, suivez ces étapes :
def get_config(instance: pd.Series, metadata: EvalMetadata) -> AppConfig: def get_config(instance: pd.Series, metadata: EvalMetadata) -> AppConfig:
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
runtime='docker', runtime='eventstream',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=SandboxConfig( sandbox=SandboxConfig(
base_container_image='your_container_image', base_container_image='your_container_image',
@@ -46,7 +46,7 @@ LLM_API_KEY="sk_test_12345"
```bash ```bash
docker run -it \ docker run -it \
--pull=always \ --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e SANDBOX_USER_ID=$(id -u) \ -e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-e LLM_API_KEY=$LLM_API_KEY \ -e LLM_API_KEY=$LLM_API_KEY \
@@ -56,6 +56,6 @@ docker run -it \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app-$(date +%Y%m%d%H%M%S) \ --name openhands-app-$(date +%Y%m%d%H%M%S) \
docker.all-hands.dev/all-hands-ai/openhands:0.28 \ docker.all-hands.dev/all-hands-ai/openhands:0.21 \
python -m openhands.core.main -t "write a bash script that prints hi" --no-auto-continue python -m openhands.core.main -t "write a bash script that prints hi" --no-auto-continue
``` ```
@@ -13,16 +13,16 @@
La façon la plus simple d'exécuter OpenHands est avec Docker. La façon la plus simple d'exécuter OpenHands est avec Docker.
```bash ```bash
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik docker pull docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik
docker run -it --rm --pull=always \ docker run -it --rm --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e LOG_ALL_EVENTS=true \ -e LOG_ALL_EVENTS=true \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
-p 3000:3000 \ -p 3000:3000 \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app \ --name openhands-app \
docker.all-hands.dev/all-hands-ai/openhands:0.28 docker.all-hands.dev/all-hands-ai/openhands:0.21
``` ```
Vous pouvez également exécuter OpenHands en mode [headless scriptable](https://docs.all-hands.dev/modules/usage/how-to/headless-mode), en tant que [CLI interactive](https://docs.all-hands.dev/modules/usage/how-to/cli-mode), ou en utilisant l'[Action GitHub OpenHands](https://docs.all-hands.dev/modules/usage/how-to/github-action). Vous pouvez également exécuter OpenHands en mode [headless scriptable](https://docs.all-hands.dev/modules/usage/how-to/headless-mode), en tant que [CLI interactive](https://docs.all-hands.dev/modules/usage/how-to/cli-mode), ou en utilisant l'[Action GitHub OpenHands](https://docs.all-hands.dev/modules/usage/how-to/github-action).
@@ -42,7 +42,7 @@ Explorez le code source d'OpenHands sur [GitHub](https://github.com/All-Hands-AI
/> />
</a> </a>
<br></br> <br></br>
<a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2ypg5jweb-d~6hObZDbXi_HEL8PDrbHg"> <a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw">
<img <img
src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge" src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge"
alt="Join our Slack community" alt="Join our Slack community"
@@ -13,7 +13,7 @@ C'est le Runtime par défaut qui est utilisé lorsque vous démarrez OpenHands.
``` ```
docker run # ... docker run # ...
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
# ... # ...
``` ```
@@ -1,8 +1,8 @@
以下是翻译后的内容: 以下是翻译后的内容:
# 📦 Docker 运行时 # 📦 EventStream 运行时
OpenHands Docker 运行时是实现 AI 代理操作安全灵活执行的核心组件。 OpenHands EventStream 运行时是实现 AI 代理操作安全灵活执行的核心组件。
它使用 Docker 创建一个沙盒环境,可以安全地运行任意代码而不会危及主机系统。 它使用 Docker 创建一个沙盒环境,可以安全地运行任意代码而不会危及主机系统。
## 为什么我们需要沙盒运行时? ## 为什么我们需要沙盒运行时?
@@ -162,7 +162,7 @@
- `runtime` - `runtime`
- 类型: `str` - 类型: `str`
- 默认值: `"docker"` - 默认值: `"eventstream"`
- 描述: 运行时环境 - 描述: 运行时环境
- `default_agent` - `default_agent`
@@ -58,11 +58,10 @@ docker build -t custom_image .
[core] [core]
workspace_base="./workspace" workspace_base="./workspace"
run_as_openhands=true run_as_openhands=true
[sandbox] sandbox_base_container_image="custom_image"
base_container_image="custom_image"
``` ```
对于 `base_container_image` 的值, 您可以选择以下任意一项: 对于 `sandbox_base_container_image` 的值, 您可以选择以下任意一项:
1. 在上一步中您构建的自定义镜像的名称(例如,`“custom_image”` 1. 在上一步中您构建的自定义镜像的名称(例如,`“custom_image”`
2. 从 Docker Hub 拉取的镜像(例如,`“node:20”`,如果你需要一个预装 `Node.js` 的沙箱环境) 2. 从 Docker Hub 拉取的镜像(例如,`“node:20”`,如果你需要一个预装 `Node.js` 的沙箱环境)
@@ -84,17 +83,20 @@ base_container_image="custom_image"
### 错误:```useradd: UID 1000 is not unique``` ### 错误:```useradd: UID 1000 is not unique```
如果在控制台输出中看到此错误,说明 OpenHands 尝试在沙箱中以 UID 1000 创建 openhands 用户,但该 UID 已经被映像中的其他部分使用(不知何故)。要解决这个问题,请更改 config.toml 文件中的 user_id 字段为不同的值: 如果在控制台输出中看到此错误,说明 OpenHands 尝试在沙箱中以 UID 1000 创建 openhands 用户,但该 UID 已经被映像中的其他部分使用(不知何故)。要解决这个问题,请更改 config.toml 文件中的 sandbox_user_id 字段为不同的值:
``` ```
[core] [core]
workspace_base="./workspace" workspace_base="./workspace"
run_as_openhands=true run_as_openhands=true
[sandbox] sandbox_base_container_image="custom_image"
base_container_image="custom_image" sandbox_user_id="1001"
user_id="1001"
``` ```
### 端口使用错误 ### 端口使用错误
如果您遇到端口被占用或不可用的错误提示,可以尝试先用`docker ps`命令列出所有运行中的 Docker 容器,然后使用`docker rm`命令删除相关容器,最后再重新执行```make run```命令。 如果您遇到端口被占用或不可用的错误提示,可以尝试先用`docker ps`命令列出所有运行中的 Docker 容器,然后使用`docker rm`命令删除相关容器,最后再重新执行```make run```命令。
## 讨论
对于其他问题或疑问,请加入 [Slack](https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw) 或 [Discord](https://discord.gg/ESHStjSjD4) 提问!
@@ -50,7 +50,7 @@ LLM_API_KEY="sk_test_12345"
```bash ```bash
docker run -it \ docker run -it \
--pull=always \ --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e SANDBOX_USER_ID=$(id -u) \ -e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-e LLM_API_KEY=$LLM_API_KEY \ -e LLM_API_KEY=$LLM_API_KEY \
@@ -59,7 +59,7 @@ docker run -it \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app-$(date +%Y%m%d%H%M%S) \ --name openhands-app-$(date +%Y%m%d%H%M%S) \
docker.all-hands.dev/all-hands-ai/openhands:0.28 \ docker.all-hands.dev/all-hands-ai/openhands:0.21 \
python -m openhands.core.cli python -m openhands.core.cli
``` ```
@@ -42,13 +42,12 @@ docker build -t custom-image .
### 指定基础沙箱镜像 ### 指定基础沙箱镜像
在 OpenHands 目录中的 `config.toml` 文件中,将 `base_container_image` 设置为你要使用的镜像。这可以是你已经拉取的镜像或你构建的镜像: 在 OpenHands 目录中的 `config.toml` 文件中,将 `sandbox_base_container_image` 设置为你要使用的镜像。这可以是你已经拉取的镜像或你构建的镜像:
```bash ```bash
[core] [core]
... ...
[sandbox] sandbox_base_container_image="custom-image"
base_container_image="custom-image"
``` ```
### 运行 ### 运行
@@ -112,7 +112,7 @@ OpenHands 的主要入口点在 `openhands/core/main.py` 中。以下是它的
def get_config(instance: pd.Series, metadata: EvalMetadata) -> AppConfig: def get_config(instance: pd.Series, metadata: EvalMetadata) -> AppConfig:
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
runtime='docker', runtime='eventstream',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=SandboxConfig( sandbox=SandboxConfig(
base_container_image='your_container_image', base_container_image='your_container_image',
@@ -47,7 +47,7 @@ LLM_API_KEY="sk_test_12345"
```bash ```bash
docker run -it \ docker run -it \
--pull=always \ --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e SANDBOX_USER_ID=$(id -u) \ -e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-e LLM_API_KEY=$LLM_API_KEY \ -e LLM_API_KEY=$LLM_API_KEY \
@@ -57,6 +57,6 @@ docker run -it \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app-$(date +%Y%m%d%H%M%S) \ --name openhands-app-$(date +%Y%m%d%H%M%S) \
docker.all-hands.dev/all-hands-ai/openhands:0.28 \ docker.all-hands.dev/all-hands-ai/openhands:0.21 \
python -m openhands.core.main -t "write a bash script that prints hi" --no-auto-continue python -m openhands.core.main -t "write a bash script that prints hi" --no-auto-continue
``` ```
@@ -11,16 +11,16 @@
在 Docker 中运行 OpenHands 是最简单的方式。 在 Docker 中运行 OpenHands 是最简单的方式。
```bash ```bash
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik docker pull docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik
docker run -it --rm --pull=always \ docker run -it --rm --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e LOG_ALL_EVENTS=true \ -e LOG_ALL_EVENTS=true \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
-p 3000:3000 \ -p 3000:3000 \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app \ --name openhands-app \
docker.all-hands.dev/all-hands-ai/openhands:0.28 docker.all-hands.dev/all-hands-ai/openhands:0.21
``` ```
你也可以在可脚本化的[无头模式](https://docs.all-hands.dev/modules/usage/how-to/headless-mode)下运行 OpenHands,作为[交互式 CLI](https://docs.all-hands.dev/modules/usage/how-to/cli-mode),或使用 [OpenHands GitHub Action](https://docs.all-hands.dev/modules/usage/how-to/github-action)。 你也可以在可脚本化的[无头模式](https://docs.all-hands.dev/modules/usage/how-to/headless-mode)下运行 OpenHands,作为[交互式 CLI](https://docs.all-hands.dev/modules/usage/how-to/cli-mode),或使用 [OpenHands GitHub Action](https://docs.all-hands.dev/modules/usage/how-to/github-action)。
@@ -42,7 +42,7 @@ OpenHands 是一个**自主 AI 软件工程师**,能够执行复杂的工程
/> />
</a> </a>
<br></br> <br></br>
<a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2ypg5jweb-d~6hObZDbXi_HEL8PDrbHg"> <a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw">
<img <img
src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge" src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge"
alt="Join our Slack community" alt="Join our Slack community"
@@ -11,7 +11,7 @@
``` ```
docker run # ... docker run # ...
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
# ... # ...
``` ```
+6 -4
View File
@@ -1,6 +1,6 @@
# 📦 Docker Runtime # 📦 EventStream Runtime
The OpenHands Docker Runtime is the core component that enables secure and flexible execution of AI agent's action. The OpenHands EventStream Runtime is the core component that enables secure and flexible execution of AI agent's action.
It creates a sandboxed environment using Docker, where arbitrary code can be run safely without risking the host system. It creates a sandboxed environment using Docker, where arbitrary code can be run safely without risking the host system.
## Why do we need a sandboxed runtime? ## Why do we need a sandboxed runtime?
@@ -54,13 +54,14 @@ graph TD
6. Action Execution: The runtime client receives actions from the backend, executes them in the sandboxed environment, and sends back observations 6. Action Execution: The runtime client receives actions from the backend, executes them in the sandboxed environment, and sends back observations
7. Observation Return: The action execution server sends execution results back to the OpenHands backend as observations 7. Observation Return: The action execution server sends execution results back to the OpenHands backend as observations
The role of the client:
The role of the client:
- It acts as an intermediary between the OpenHands backend and the sandboxed environment - It acts as an intermediary between the OpenHands backend and the sandboxed environment
- It executes various types of actions (shell commands, file operations, Python code, etc.) safely within the container - It executes various types of actions (shell commands, file operations, Python code, etc.) safely within the container
- It manages the state of the sandboxed environment, including the current working directory and loaded plugins - It manages the state of the sandboxed environment, including the current working directory and loaded plugins
- It formats and returns observations to the backend, ensuring a consistent interface for processing results - It formats and returns observations to the backend, ensuring a consistent interface for processing results
## How OpenHands builds and maintains OH Runtime images ## How OpenHands builds and maintains OH Runtime images
OpenHands' approach to building and managing runtime images ensures efficiency, consistency, and flexibility in creating and maintaining Docker images for both production and development environments. OpenHands' approach to building and managing runtime images ensures efficiency, consistency, and flexibility in creating and maintaining Docker images for both production and development environments.
@@ -77,15 +78,16 @@ Tags may be in one of 2 formats:
- **Source Tag**: `oh_v{openhands_version}_{16_digit_lock_hash}_{16_digit_source_hash}` - **Source Tag**: `oh_v{openhands_version}_{16_digit_lock_hash}_{16_digit_source_hash}`
(e.g.: `oh_v0.9.9_1234567890abcdef_1234567890abcdef`) (e.g.: `oh_v0.9.9_1234567890abcdef_1234567890abcdef`)
#### Source Tag - Most Specific #### Source Tag - Most Specific
This is the first 16 digits of the MD5 of the directory hash for the source directory. This gives a hash This is the first 16 digits of the MD5 of the directory hash for the source directory. This gives a hash
for only the openhands source for only the openhands source
#### Lock Tag #### Lock Tag
This hash is built from the first 16 digits of the MD5 of: This hash is built from the first 16 digits of the MD5 of:
- The name of the base image upon which the image was built (e.g.: `nikolaik/python-nodejs:python3.12-nodejs22`) - The name of the base image upon which the image was built (e.g.: `nikolaik/python-nodejs:python3.12-nodejs22`)
- The content of the `pyproject.toml` included in the image. - The content of the `pyproject.toml` included in the image.
- The content of the `poetry.lock` included in the image. - The content of the `poetry.lock` included in the image.
@@ -1,21 +0,0 @@
# Cloud GitHub Resolver
The GitHub Resolver automates code fixes and provides intelligent assistance for your repositories.
## Setup
The Cloud Github Resolver is available automatically when you
[grant OpenHands Cloud repository access](./openhands-cloud.md#adding-repositories).
## Usage
### Issues
On your repository, label an issue with `openhands`. OpenHands will attempt to fix the issue.
### Pull Requests
In order to get OpenHands to work on pull requests, use `@openhands` in top level or single inline comments to:
- Ask questions
- Request updates
- Get code explanations
@@ -1,39 +0,0 @@
# Openhands Cloud
OpenHands Cloud is the cloud hosted version of OpenHands by All Hands AI.
## Accessing OpenHands Cloud
Currently, users are being admitted to access OpenHands Cloud in waves. To sign up,
[join the waitlist](https://www.all-hands.dev/join-waitlist). Once you are approved, you will get an email with
instructions on how to access it.
## Getting Started
After visiting OpenHands Cloud, you will be asked to connect with your GitHub account:
1. After reading and accepting the terms of service, click `Connect to GitHub`.
2. Review the permissions requested by OpenHands and then click `Authorize OpenHands by All Hands AI`.
- OpenHands will require some permissions from your GitHub account. To read more about these permissions,
you can click the `Learn more` link on the GitHub authorize page.
## Adding Repositories
You can grant OpenHands specific repository access:
1. Under the `Select a GitHub project` dropdown, select `Add more repositories...`.
2. Select the organization, then choose the specific repositories to grant OpenHands access to.
- Openhands requests short-lived tokens (8-hour expiry) with these permissions:
- Actions: Read and write
- Administration: Read-only
- Commit statuses: Read and write
- Contents: Read and write
- Issues: Read and write
- Metadata: Read-only
- Pull requests: Read and write
- Webhooks: Read and write
- Workflows: Read and write
- Repository access for a user is granted based on:
- Granted permission for the repository.
- User's GitHub permissions (owner/collaborator).
You can manage repository access any time by following the above workflow or visiting the Settings page and selecting
`Configure GitHub Repositories` under the `GitHub Settings` section.
+1 -11
View File
@@ -126,7 +126,7 @@ The core configuration options are defined in the `[core]` section of the `confi
- `runtime` - `runtime`
- Type: `str` - Type: `str`
- Default: `"docker"` - Default: `"eventstream"`
- Description: Runtime environment - Description: Runtime environment
- `default_agent` - `default_agent`
@@ -340,11 +340,6 @@ The agent configuration options are defined in the `[agent]` and `[agent.<agent_
- Default: `false` - Default: `false`
- Description: Whether Jupyter is enabled in the action space - Description: Whether Jupyter is enabled in the action space
- `enable_history_truncation`
- Type: `bool`
- Default: `true`
- Description: Whether history should be truncated to continue the session when hitting LLM context length limit
### Microagent Usage ### Microagent Usage
- `enable_prompt_extensions` - `enable_prompt_extensions`
- Type: `bool` - Type: `bool`
@@ -385,11 +380,6 @@ To use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-
- Default: `false` - Default: `false`
- Description: Use host network - Description: Use host network
- `runtime_binding_address`
- Type: `str`
- Default: `0.0.0.0`
- Description: The binding address for the runtime ports. It specifies which network interface on the host machine Docker should bind the runtime ports to.
### Linting and Plugins ### Linting and Plugins
- `enable_auto_lint` - `enable_auto_lint`
- Type: `bool` - Type: `bool`
+2 -2
View File
@@ -35,7 +35,7 @@ To run OpenHands in CLI mode with Docker:
```bash ```bash
docker run -it \ docker run -it \
--pull=always \ --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e SANDBOX_USER_ID=$(id -u) \ -e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-e LLM_API_KEY=$LLM_API_KEY \ -e LLM_API_KEY=$LLM_API_KEY \
@@ -45,7 +45,7 @@ docker run -it \
-v ~/.openhands-state:/.openhands-state \ -v ~/.openhands-state:/.openhands-state \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app-$(date +%Y%m%d%H%M%S) \ --name openhands-app-$(date +%Y%m%d%H%M%S) \
docker.all-hands.dev/all-hands-ai/openhands:0.28 \ docker.all-hands.dev/all-hands-ai/openhands:0.21 \
python -m openhands.core.cli python -m openhands.core.cli
``` ```
@@ -41,16 +41,8 @@ docker build -t custom-image .
This will produce a new image called `custom-image`, which will be available in Docker. This will produce a new image called `custom-image`, which will be available in Docker.
## Using the Docker Command > Note that in the configuration described in this document, OpenHands will run as user "openhands" inside the
> sandbox and thus all packages installed via the docker file should be available to all users on the system, not just root.
When running OpenHands using [the docker command](/modules/usage/installation#start-the-app), replace
`-e SANDBOX_RUNTIME_CONTAINER_IMAGE=...` with `-e SANDBOX_BASE_CONTAINER_IMAGE=<custom image name>`:
```commandline
docker run -it --rm --pull=always \
-e SANDBOX_BASE_CONTAINER_IMAGE=custom-image \
...
```
## Using the Development Workflow ## Using the Development Workflow
@@ -60,14 +52,13 @@ First, ensure you can run OpenHands by following the instructions in [Developmen
### Specify the Base Sandbox Image ### Specify the Base Sandbox Image
In the `config.toml` file within the OpenHands directory, set the `base_container_image` to the image you want to use. In the `config.toml` file within the OpenHands directory, set the `sandbox_base_container_image` to the image you want to use.
This can be an image youve already pulled or one youve built: This can be an image youve already pulled or one youve built:
```bash ```bash
[core] [core]
... ...
[sandbox] sandbox_base_container_image="custom-image"
base_container_image="custom-image"
``` ```
### Additional Configuration Options ### Additional Configuration Options
@@ -112,7 +112,7 @@ To create an evaluation workflow for your benchmark, follow these steps:
def get_config(instance: pd.Series, metadata: EvalMetadata) -> AppConfig: def get_config(instance: pd.Series, metadata: EvalMetadata) -> AppConfig:
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
runtime='docker', runtime='eventstream',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=SandboxConfig( sandbox=SandboxConfig(
base_container_image='your_container_image', base_container_image='your_container_image',
+6 -7
View File
@@ -42,10 +42,9 @@ You can provide custom directions for OpenHands by following the [README for the
Github resolver will automatically check for valid [repository secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions?tool=webui#creating-secrets-for-a-repository) or [repository variables](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#creating-configuration-variables-for-a-repository) to customize its behavior. Github resolver will automatically check for valid [repository secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions?tool=webui#creating-secrets-for-a-repository) or [repository variables](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#creating-configuration-variables-for-a-repository) to customize its behavior.
The customization options you can set are: The customization options you can set are:
| **Attribute name** | **Type** | **Purpose** | **Example** | | **Attribute name** | **Type** | **Purpose** | **Example** |
| -------------------------------- | -------- | --------------------------------------------------------------------------------------------------- | -------------------------------------------------- | |----------------------------------| -------- |-------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| `LLM_MODEL` | Variable | Set the LLM to use with OpenHands | `LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"` | | `LLM_MODEL` | Variable | Set the LLM to use with OpenHands | `LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"` |
| `OPENHANDS_MAX_ITER` | Variable | Set max limit for agent iterations | `OPENHANDS_MAX_ITER=10` | | `OPENHANDS_MAX_ITER` | Variable | Set max limit for agent iterations | `OPENHANDS_MAX_ITER=10` |
| `OPENHANDS_MACRO` | Variable | Customize default macro for invoking the resolver | `OPENHANDS_MACRO=@resolveit` | | `OPENHANDS_MACRO` | Variable | Customize default macro for invoking the resolver | `OPENHANDS_MACRO=@resolveit` |
| `OPENHANDS_BASE_CONTAINER_IMAGE` | Variable | Custom Sandbox ([learn more](https://docs.all-hands.dev/modules/usage/how-to/custom-sandbox-guide)) | `OPENHANDS_BASE_CONTAINER_IMAGE="custom_image"` | | `OPENHANDS_BASE_CONTAINER_IMAGE` | Variable | Custom Sandbox ([learn more](https://docs.all-hands.dev/modules/usage/how-to/custom-sandbox-guide)) | `OPENHANDS_BASE_CONTAINER_IMAGE="custom_image"` |
| `TARGET_BRANCH` | Variable | Merge to branch other than `main` | `TARGET_BRANCH="dev"` |
+68 -56
View File
@@ -1,6 +1,9 @@
# GUI Mode # GUI Mode
OpenHands provides a Graphical User Interface (GUI) mode for interacting with the AI assistant. ## Introduction
OpenHands provides a user-friendly Graphical User Interface (GUI) mode for interacting with the AI assistant.
This mode offers an intuitive way to set up the environment, manage settings, and communicate with the AI.
## Installation and Setup ## Installation and Setup
@@ -11,95 +14,104 @@ OpenHands provides a Graphical User Interface (GUI) mode for interacting with th
### Initial Setup ### Initial Setup
1. Upon first launch, you'll see a settings page. 1. Upon first launch, you'll see a settings modal.
2. Select an `LLM Provider` and `LLM Model` from the dropdown menus. If the required model does not exist in the list, 2. Select an `LLM Provider` and `LLM Model` from the dropdown menus.
toggle `Advanced` options and enter it with the correct prefix in the `Custom Model` text box.
3. Enter the corresponding `API Key` for your chosen provider. 3. Enter the corresponding `API Key` for your chosen provider.
4. Click `Save Changes` to apply the settings. 4. Click "Save" to apply the settings.
### GitHub Token Setup ### GitHub Token Setup
OpenHands automatically exports a `GITHUB_TOKEN` to the shell environment if it is available. This can happen in two ways: OpenHands automatically exports a `GITHUB_TOKEN` to the shell environment if it is available. This can happen in two ways:
- **Local Installation**: The user directly inputs their GitHub token. - **Locally (OSS)**: The user directly inputs their GitHub token.
<details> - **Online (SaaS)**: The token is obtained through GitHub OAuth authentication.
<summary>Setting Up a GitHub Token</summary>
1. **Generate a Personal Access Token (PAT)**: #### Setting Up a Local GitHub Token
- On GitHub, go to Settings > Developer Settings > Personal Access Tokens > Tokens (classic).
- Click `Generate new token (classic)`. 1. **Generate a Personal Access Token (PAT)**:
- Go to GitHub Settings > Developer Settings > Personal Access Tokens > Tokens (classic).
- Click "Generate new token (classic)".
- Required scopes: - Required scopes:
- `repo` (Full control of private repositories) - `repo` (Full control of private repositories)
2. **Enter Token in OpenHands**: - `workflow` (Update GitHub Action workflows)
- Click the Settings button (gear icon). - `read:org` (Read organization data)
- Navigate to the `GitHub Settings` section.
- Paste your token in the `GitHub Token` field.
- Click `Save Changes` to apply the changes.
</details>
<details> 2. **Enter Token in OpenHands**:
<summary>Organizational Token Policies</summary> - Click the Settings button (gear icon) in the top right.
- Navigate to the "GitHub" section.
- Paste your token in the "GitHub Token" field.
- Click "Save" to apply the changes.
If you're working with organizational repositories, additional setup may be required: #### Organizational Token Policies
1. **Check Organization Requirements**: If you're working with organizational repositories, additional setup may be required:
1. **Check Organization Requirements**:
- Organization admins may enforce specific token policies. - Organization admins may enforce specific token policies.
- Some organizations require tokens to be created with SSO enabled. - Some organizations require tokens to be created with SSO enabled.
- Review your organization's [token policy settings](https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization). - Review your organization's [token policy settings](https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization).
2. **Verify Organization Access**:
2. **Verify Organization Access**:
- Go to your token settings on GitHub. - Go to your token settings on GitHub.
- Look for the organization under `Organization access`. - Look for the organization under "Organization access".
- If required, click `Enable SSO` next to your organization. - If required, click "Enable SSO" next to your organization.
- Complete the SSO authorization process. - Complete the SSO authorization process.
</details>
<details> #### OAuth Authentication (Online Mode)
<summary>Troubleshooting</summary>
Common issues and solutions: When using OpenHands in online mode, the GitHub OAuth flow:
- **Token Not Recognized**: 1. Requests the following permissions:
- Ensure the token is properly saved in settings.
- Check that the token hasn't expired.
- Verify the token has the required scopes.
- Try regenerating the token.
- **Organization Access Denied**:
- Check if SSO is required but not enabled.
- Verify organization membership.
- Contact organization admin if token policies are blocking access.
- **Verifying Token Works**:
- The app will show a green checkmark if the token is valid.
- Try accessing a repository to confirm permissions.
- Check the browser console for any error messages.
</details>
- **OpenHands Cloud**: The token is obtained through GitHub OAuth authentication.
<details>
<summary>OAuth Authentication</summary>
When using OpenHands Cloud, the GitHub OAuth flow requests the following permissions:
- Repository access (read/write) - Repository access (read/write)
- Workflow management - Workflow management
- Organization read access - Organization read access
To authenticate OpenHands: 2. Authentication steps:
- Click `Sign in with GitHub` when prompted. - Click "Sign in with GitHub" when prompted.
- Review the requested permissions. - Review the requested permissions.
- Authorize OpenHands to access your GitHub account. - Authorize OpenHands to access your GitHub account.
- If using an organization, authorize organization access if prompted. - If using an organization, authorize organization access if prompted.
</details>
#### Troubleshooting
Common issues and solutions:
- **Token Not Recognized**:
- Ensure the token is properly saved in settings.
- Check that the token hasn't expired.
- Verify the token has the required scopes.
- Try regenerating the token.
- **Organization Access Denied**:
- Check if SSO is required but not enabled.
- Verify organization membership.
- Contact organization admin if token policies are blocking access.
- **Verifying Token Works**:
- The app will show a green checkmark if the token is valid.
- Try accessing a repository to confirm permissions.
- Check the browser console for any error messages.
- Use the "Test Connection" button in settings if available.
### Advanced Settings ### Advanced Settings
1. Inside the Settings page, toggle `Advanced` options to access additional settings. 1. Toggle `Advanced Options` to access additional settings.
2. Use the `Custom Model` text box to manually enter a model if it's not in the list. 2. Use the `Custom Model` text box to manually enter a model if it's not in the list.
3. Specify a `Base URL` if required by your LLM provider. 3. Specify a `Base URL` if required by your LLM provider.
### Main Interface
The main interface consists of several key components:
- **Chat Window**: The central area where you can view the conversation history with the AI assistant.
- **Input Box**: Located at the bottom of the screen, use this to type your messages or commands to the AI.
- **Send Button**: Click this to send your message to the AI.
- **Settings Button**: A gear icon that opens the settings modal, allowing you to adjust your configuration at any time.
- **Workspace Panel**: Displays the files and folders in your workspace, allowing you to navigate and view files, or the agent's past commands or web browsing history.
### Interacting with the AI ### Interacting with the AI
1. Type your prompt in the input box. 1. Type your question, request, or task description in the input box.
2. Click the send button or press Enter to submit your message. 2. Click the send button or press Enter to submit your message.
3. The AI will process your input and provide a response in the chat window. 3. The AI will process your input and provide a response in the chat window.
4. You can continue the conversation by asking follow-up questions or providing additional information. 4. You can continue the conversation by asking follow-up questions or providing additional information.
+2 -2
View File
@@ -32,7 +32,7 @@ To run OpenHands in Headless mode with Docker:
```bash ```bash
docker run -it \ docker run -it \
--pull=always \ --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e SANDBOX_USER_ID=$(id -u) \ -e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-e LLM_API_KEY=$LLM_API_KEY \ -e LLM_API_KEY=$LLM_API_KEY \
@@ -43,7 +43,7 @@ docker run -it \
-v ~/.openhands-state:/.openhands-state \ -v ~/.openhands-state:/.openhands-state \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app-$(date +%Y%m%d%H%M%S) \ --name openhands-app-$(date +%Y%m%d%H%M%S) \
docker.all-hands.dev/all-hands-ai/openhands:0.28 \ docker.all-hands.dev/all-hands-ai/openhands:0.21 \
python -m openhands.core.main -t "write a bash script that prints hi" python -m openhands.core.main -t "write a bash script that prints hi"
``` ```
+18 -24
View File
@@ -6,14 +6,11 @@
- Linux - Linux
- Windows with [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) and [Docker Desktop support](https://docs.docker.com/desktop/setup/install/windows-install/#system-requirements) - Windows with [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) and [Docker Desktop support](https://docs.docker.com/desktop/setup/install/windows-install/#system-requirements)
A system with a modern processor and a minimum of **4GB RAM** is recommended to run OpenHands.
## Prerequisites ## Prerequisites
<details> <details>
<summary>MacOS</summary> <summary>MacOS</summary>
### Docker Desktop
**Docker Desktop**
1. [Install Docker Desktop on Mac](https://docs.docker.com/desktop/setup/install/mac-install). 1. [Install Docker Desktop on Mac](https://docs.docker.com/desktop/setup/install/mac-install).
2. Open Docker Desktop, go to `Settings > Advanced` and ensure `Allow the default Docker socket to be used` is enabled. 2. Open Docker Desktop, go to `Settings > Advanced` and ensure `Allow the default Docker socket to be used` is enabled.
@@ -26,7 +23,7 @@ A system with a modern processor and a minimum of **4GB RAM** is recommended to
Tested with Ubuntu 22.04. Tested with Ubuntu 22.04.
::: :::
**Docker Desktop** ### Docker Desktop
1. [Install Docker Desktop on Linux](https://docs.docker.com/desktop/setup/install/linux/). 1. [Install Docker Desktop on Linux](https://docs.docker.com/desktop/setup/install/linux/).
@@ -34,23 +31,18 @@ A system with a modern processor and a minimum of **4GB RAM** is recommended to
<details> <details>
<summary>Windows</summary> <summary>Windows</summary>
### WSL
**WSL**
1. [Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install). 1. [Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
2. Run `wsl --version` in powershell and confirm `Default Version: 2`. 2. Run `wsl --version` in powershell and confirm `Default Version: 2`.
**Docker Desktop** ### Docker Desktop
1. [Install Docker Desktop on Windows](https://docs.docker.com/desktop/setup/install/windows-install). 1. [Install Docker Desktop on Windows](https://docs.docker.com/desktop/setup/install/windows-install).
2. Open Docker Desktop, go to `Settings` and confirm the following: 2. Open Docker Desktop, go to `Settings` and confirm the following:
- General: `Use the WSL 2 based engine` is enabled. - General: `Use the WSL 2 based engine` is enabled.
- Resources > WSL Integration: `Enable integration with my default WSL distro` is enabled. - Resources > WSL Integration: `Enable integration with my default WSL distro` is enabled.
:::note
The docker command below to start the app must be run inside the WSL terminal.
:::
</details> </details>
## Start the App ## Start the App
@@ -58,17 +50,17 @@ A system with a modern processor and a minimum of **4GB RAM** is recommended to
The easiest way to run OpenHands is in Docker. The easiest way to run OpenHands is in Docker.
```bash ```bash
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik docker pull docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik
docker run -it --rm --pull=always \ docker run -it --rm --pull=always \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-e LOG_ALL_EVENTS=true \ -e LOG_ALL_EVENTS=true \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
-v ~/.openhands-state:/.openhands-state \ -v ~/.openhands-state:/.openhands-state \
-p 3000:3000 \ -p 3000:3000 \
--add-host host.docker.internal:host-gateway \ --add-host host.docker.internal:host-gateway \
--name openhands-app \ --name openhands-app \
docker.all-hands.dev/all-hands-ai/openhands:0.28 docker.all-hands.dev/all-hands-ai/openhands:0.21
``` ```
You'll find OpenHands running at http://localhost:3000! You'll find OpenHands running at http://localhost:3000!
@@ -80,22 +72,24 @@ or run it on tagged issues with [a github action](https://docs.all-hands.dev/mod
## Setup ## Setup
Upon launching OpenHands, you'll see a Settings page. You **must** select an `LLM Provider` and `LLM Model` and enter a corresponding `API Key`. Upon launching OpenHands, you'll see a settings modal. You **must** select an `LLM Provider` and `LLM Model` and enter a corresponding `API Key`.
These can be changed at any time by selecting the `Settings` button (gear icon) in the UI. These can be changed at any time by selecting the `Settings` button (gear icon) in the UI.
If the required model does not exist in the list, you can toggle `Advanced` options and manually enter it with the correct prefix If the required `LLM Model` does not exist in the list, you can toggle `Advanced Options` and manually enter it with the correct prefix
in the `Custom Model` text box. in the `Custom Model` text box.
The `Advanced` options also allow you to specify a `Base URL` if required. The `Advanced Options` also allow you to specify a `Base URL` if required.
Now you're ready to [get started with OpenHands](./getting-started). <div style={{ display: 'flex', justifyContent: 'center', gap: '20px' }}>
<img src="/img/settings-screenshot.png" alt="settings-modal" width="340" />
<img src="/img/settings-advanced.png" alt="settings-modal" width="335" />
</div>
## Versions ## Versions
The [docker command above](./installation#start-the-app) pulls the most recent stable release of OpenHands. You have other options as well: The command above pulls the most recent stable release of OpenHands. You have other options as well:
- For a specific release, replace $VERSION in `openhands:$VERSION` and `runtime:$VERSION`, with the version number. - For a specific release, use `docker.all-hands.dev/all-hands-ai/openhands:$VERSION`, replacing $VERSION with the version number.
We use SemVer so `0.9` will automatically point to the latest `0.9.x` release, and `0` will point to the latest `0.x.x` release. - We use semver, and release major, minor, and patch tags. So `0.9` will automatically point to the latest `0.9.x` release, and `0` will point to the latest `0.x.x` release.
- For the most up-to-date development version, replace $VERSION in `openhands:$VERSION` and `runtime:$VERSION`, with `main`. - For the most up-to-date development version, you can use `docker.all-hands.dev/all-hands-ai/openhands:main`. This version is unstable and is recommended for testing or development purposes only.
This version is unstable and is recommended for testing or development purposes only.
You can choose the tag that best suits your needs based on stability requirements and desired features. You can choose the tag that best suits your needs based on stability requirements and desired features.
+1 -1
View File
@@ -25,7 +25,7 @@ You will need your ChatGPT deployment name which can be found on the deployments
&lt;deployment-name&gt; below. &lt;deployment-name&gt; below.
::: :::
1. Enable `Advanced` options 1. Enable `Advanced Options`
2. Set the following: 2. Set the following:
- `Custom Model` to azure/&lt;deployment-name&gt; - `Custom Model` to azure/&lt;deployment-name&gt;
- `Base URL` to your Azure API Base URL (e.g. `https://example-endpoint.openai.azure.com`) - `Base URL` to your Azure API Base URL (e.g. `https://example-endpoint.openai.azure.com`)
+2 -2
View File
@@ -10,7 +10,7 @@ OpenHands uses LiteLLM to make calls to Google's chat models. You can find their
When running OpenHands, you'll need to set the following in the OpenHands UI through the Settings: When running OpenHands, you'll need to set the following in the OpenHands UI through the Settings:
- `LLM Provider` to `Gemini` - `LLM Provider` to `Gemini`
- `LLM Model` to the model you will be using. - `LLM Model` to the model you will be using.
If the model is not in the list, toggle `Advanced` options, and enter it in `Custom Model` (e.g. gemini/&lt;model-name&gt; like `gemini/gemini-1.5-pro`). If the model is not in the list, toggle `Advanced Options`, and enter it in `Custom Model` (e.g. gemini/&lt;model-name&gt; like `gemini/gemini-1.5-pro`).
- `API Key` to your Gemini API key - `API Key` to your Gemini API key
## VertexAI - Google Cloud Platform Configs ## VertexAI - Google Cloud Platform Configs
@@ -27,4 +27,4 @@ VERTEXAI_LOCATION="<your-gcp-location>"
Then set the following in the OpenHands UI through the Settings: Then set the following in the OpenHands UI through the Settings:
- `LLM Provider` to `VertexAI` - `LLM Provider` to `VertexAI`
- `LLM Model` to the model you will be using. - `LLM Model` to the model you will be using.
If the model is not in the list, toggle `Advanced` options, and enter it in `Custom Model` (e.g. vertex_ai/&lt;model-name&gt;). If the model is not in the list, toggle `Advanced Options`, and enter it in `Custom Model` (e.g. vertex_ai/&lt;model-name&gt;).
+2 -2
View File
@@ -8,7 +8,7 @@ When running OpenHands, you'll need to set the following in the OpenHands UI thr
- `LLM Provider` to `Groq` - `LLM Provider` to `Groq`
- `LLM Model` to the model you will be using. [Visit here to see the list of - `LLM Model` to the model you will be using. [Visit here to see the list of
models that Groq hosts](https://console.groq.com/docs/models). If the model is not in the list, toggle models that Groq hosts](https://console.groq.com/docs/models). If the model is not in the list, toggle
`Advanced` options, and enter it in `Custom Model` (e.g. groq/&lt;model-name&gt; like `groq/llama3-70b-8192`). `Advanced Options`, and enter it in `Custom Model` (e.g. groq/&lt;model-name&gt; like `groq/llama3-70b-8192`).
- `API key` to your Groq API key. To find or create your Groq API Key, [see here](https://console.groq.com/keys). - `API key` to your Groq API key. To find or create your Groq API Key, [see here](https://console.groq.com/keys).
@@ -17,7 +17,7 @@ models that Groq hosts](https://console.groq.com/docs/models). If the model is n
The Groq endpoint for chat completion is [mostly OpenAI-compatible](https://console.groq.com/docs/openai). Therefore, you can access Groq models as you The Groq endpoint for chat completion is [mostly OpenAI-compatible](https://console.groq.com/docs/openai). Therefore, you can access Groq models as you
would access any OpenAI-compatible endpoint. In the OpenHands UI through the Settings: would access any OpenAI-compatible endpoint. In the OpenHands UI through the Settings:
1. Enable `Advanced` options 1. Enable `Advanced Options`
2. Set the following: 2. Set the following:
- `Custom Model` to the prefix `openai/` + the model you will be using (e.g. `openai/llama3-70b-8192`) - `Custom Model` to the prefix `openai/` + the model you will be using (e.g. `openai/llama3-70b-8192`)
- `Base URL` to `https://api.groq.com/openai/v1` - `Base URL` to `https://api.groq.com/openai/v1`
+1 -1
View File
@@ -8,7 +8,7 @@ To use LiteLLM proxy with OpenHands, you need to:
1. Set up a LiteLLM proxy server (see [LiteLLM documentation](https://docs.litellm.ai/docs/proxy/quick_start)) 1. Set up a LiteLLM proxy server (see [LiteLLM documentation](https://docs.litellm.ai/docs/proxy/quick_start))
2. When running OpenHands, you'll need to set the following in the OpenHands UI through the Settings: 2. When running OpenHands, you'll need to set the following in the OpenHands UI through the Settings:
* Enable `Advanced` options * Enable `Advanced Options`
* `Custom Model` to the prefix `litellm_proxy/` + the model you will be using (e.g. `litellm_proxy/anthropic.claude-3-5-sonnet-20241022-v2:0`) * `Custom Model` to the prefix `litellm_proxy/` + the model you will be using (e.g. `litellm_proxy/anthropic.claude-3-5-sonnet-20241022-v2:0`)
* `Base URL` to your LiteLLM proxy URL (e.g. `https://your-litellm-proxy.com`) * `Base URL` to your LiteLLM proxy URL (e.g. `https://your-litellm-proxy.com`)
* `API Key` to your LiteLLM proxy API key * `API Key` to your LiteLLM proxy API key
+8 -8
View File
@@ -38,7 +38,7 @@ The following can be set in the OpenHands UI through the Settings:
- `LLM Provider` - `LLM Provider`
- `LLM Model` - `LLM Model`
- `API Key` - `API Key`
- `Base URL` (through `Advanced` settings) - `Base URL` (through `Advanced Settings`)
There are some settings that may be necessary for some LLMs/providers that cannot be set through the UI. Instead, these There are some settings that may be necessary for some LLMs/providers that cannot be set through the UI. Instead, these
can be set through environment variables passed to the [docker run command](/modules/usage/installation#start-the-app) can be set through environment variables passed to the [docker run command](/modules/usage/installation#start-the-app)
@@ -63,22 +63,22 @@ We have a few guides for running OpenHands with specific model providers:
### API retries and rate limits ### API retries and rate limits
LLM providers typically have rate limits, sometimes very low, and may require retries. OpenHands will automatically LLM providers typically have rate limits, sometimes very low, and may require retries. OpenHands will automatically
retry requests if it receives a Rate Limit Error (429 error code). retry requests if it receives a Rate Limit Error (429 error code), API connection error, or other transient errors.
You can customize these options as you need for the provider you're using. Check their documentation, and set the You can customize these options as you need for the provider you're using. Check their documentation, and set the
following environment variables to control the number of retries and the time between retries: following environment variables to control the number of retries and the time between retries:
- `LLM_NUM_RETRIES` (Default of 4 times) - `LLM_NUM_RETRIES` (Default of 8)
- `LLM_RETRY_MIN_WAIT` (Default of 5 seconds) - `LLM_RETRY_MIN_WAIT` (Default of 15 seconds)
- `LLM_RETRY_MAX_WAIT` (Default of 30 seconds) - `LLM_RETRY_MAX_WAIT` (Default of 120 seconds)
- `LLM_RETRY_MULTIPLIER` (Default of 2) - `LLM_RETRY_MULTIPLIER` (Default of 2)
If you are running OpenHands in development mode, you can also set these options in the `config.toml` file: If you are running OpenHands in development mode, you can also set these options in the `config.toml` file:
```toml ```toml
[llm] [llm]
num_retries = 4 num_retries = 8
retry_min_wait = 5 retry_min_wait = 15
retry_max_wait = 30 retry_max_wait = 120
retry_multiplier = 2 retry_multiplier = 2
``` ```
+2 -2
View File
@@ -8,7 +8,7 @@ When running OpenHands, you'll need to set the following in the OpenHands UI thr
* `LLM Provider` to `OpenAI` * `LLM Provider` to `OpenAI`
* `LLM Model` to the model you will be using. * `LLM Model` to the model you will be using.
[Visit here to see a full list of OpenAI models that LiteLLM supports.](https://docs.litellm.ai/docs/providers/openai#openai-chat-completion-models) [Visit here to see a full list of OpenAI models that LiteLLM supports.](https://docs.litellm.ai/docs/providers/openai#openai-chat-completion-models)
If the model is not in the list, toggle `Advanced` options, and enter it in `Custom Model` (e.g. openai/&lt;model-name&gt; like `openai/gpt-4o`). If the model is not in the list, toggle `Advanced Options`, and enter it in `Custom Model` (e.g. openai/&lt;model-name&gt; like `openai/gpt-4o`).
* `API Key` to your OpenAI API key. To find or create your OpenAI Project API Key, [see here](https://platform.openai.com/api-keys). * `API Key` to your OpenAI API key. To find or create your OpenAI Project API Key, [see here](https://platform.openai.com/api-keys).
## Using OpenAI-Compatible Endpoints ## Using OpenAI-Compatible Endpoints
@@ -18,7 +18,7 @@ Just as for OpenAI Chat completions, we use LiteLLM for OpenAI-compatible endpoi
## Using an OpenAI Proxy ## Using an OpenAI Proxy
If you're using an OpenAI proxy, in the OpenHands UI through the Settings: If you're using an OpenAI proxy, in the OpenHands UI through the Settings:
1. Enable `Advanced` options 1. Enable `Advanced Options`
2. Set the following: 2. Set the following:
- `Custom Model` to openai/&lt;model-name&gt; (e.g. `openai/gpt-4o` or openai/&lt;proxy-prefix&gt;/&lt;model-name&gt;) - `Custom Model` to openai/&lt;model-name&gt; (e.g. `openai/gpt-4o` or openai/&lt;proxy-prefix&gt;/&lt;model-name&gt;)
- `Base URL` to the URL of your OpenAI proxy - `Base URL` to the URL of your OpenAI proxy
+1 -1
View File
@@ -8,5 +8,5 @@ When running OpenHands, you'll need to set the following in the OpenHands UI thr
* `LLM Provider` to `OpenRouter` * `LLM Provider` to `OpenRouter`
* `LLM Model` to the model you will be using. * `LLM Model` to the model you will be using.
[Visit here to see a full list of OpenRouter models](https://openrouter.ai/models). [Visit here to see a full list of OpenRouter models](https://openrouter.ai/models).
If the model is not in the list, toggle `Advanced` options, and enter it in `Custom Model` (e.g. openrouter/&lt;model-name&gt; like `openrouter/anthropic/claude-3.5-sonnet`). If the model is not in the list, toggle `Advanced Options`, and enter it in `Custom Model` (e.g. openrouter/&lt;model-name&gt; like `openrouter/anthropic/claude-3.5-sonnet`).
* `API Key` to your OpenRouter API key. * `API Key` to your OpenRouter API key.
+1 -34
View File
@@ -16,7 +16,7 @@ some flags being passed to `docker run` that make this possible:
``` ```
docker run # ... docker run # ...
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.28-nikolaik \ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
-v /var/run/docker.sock:/var/run/docker.sock \ -v /var/run/docker.sock:/var/run/docker.sock \
# ... # ...
``` ```
@@ -84,36 +84,3 @@ docker run # ...
-e MODAL_API_TOKEN_ID="your-id" \ -e MODAL_API_TOKEN_ID="your-id" \
-e MODAL_API_TOKEN_SECRET="your-secret" \ -e MODAL_API_TOKEN_SECRET="your-secret" \
``` ```
## Daytona Runtime
Another option is using [Daytona](https://www.daytona.io/) as a runtime provider:
### Step 1: Retrieve Your Daytona API Key
1. Visit the [Daytona Dashboard](https://app.daytona.io/dashboard/keys).
2. Click **"Create Key"**.
3. Enter a name for your key and confirm the creation.
4. Once the key is generated, copy it.
### Step 2: Set Your API Key as an Environment Variable
Run the following command in your terminal, replacing `<your-api-key>` with the actual key you copied:
```bash
export DAYTONA_API_KEY="<your-api-key>"
```
This step ensures that OpenHands can authenticate with the Daytona platform when it runs.
### Step 3: Run OpenHands Locally Using Docker
To start the latest version of OpenHands on your machine, execute the following command in your terminal:
```bash
bash -i <(curl -sL https://get.daytona.io/openhands)
```
#### What This Command Does:
- Downloads the latest OpenHands release script.
- Runs the script in an interactive Bash session.
- Automatically pulls and runs the OpenHands container using Docker.
Once executed, OpenHands should be running locally and ready for use.
For more details and manual initialization, view the entire [README.md](https://github.com/All-Hands-AI/OpenHands/blob/main/openhands/runtime/impl/daytona/README.md)
+616 -1469
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -22,16 +22,16 @@
"@mdx-js/react": "^3.1.0", "@mdx-js/react": "^3.1.0",
"clsx": "^2.0.0", "clsx": "^2.0.0",
"prism-react-renderer": "^2.4.1", "prism-react-renderer": "^2.4.1",
"react": "^19.0.0", "react": "^18.3.1",
"react-dom": "^19.0.0", "react-dom": "^18.3.1",
"react-icons": "^5.5.0", "react-icons": "^5.4.0",
"react-use": "^17.6.0" "react-use": "^17.6.0"
}, },
"devDependencies": { "devDependencies": {
"@docusaurus/module-type-aliases": "^3.5.1", "@docusaurus/module-type-aliases": "^3.5.1",
"@docusaurus/tsconfig": "^3.7.0", "@docusaurus/tsconfig": "^3.7.0",
"@docusaurus/types": "^3.5.1", "@docusaurus/types": "^3.5.1",
"typescript": "~5.8.2" "typescript": "~5.7.2"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [
+3 -20
View File
@@ -42,7 +42,7 @@ const sidebars: SidebarsConfig = {
id: 'usage/prompting/microagents-public', id: 'usage/prompting/microagents-public',
}, },
], ],
}, }
], ],
}, },
{ {
@@ -66,26 +66,9 @@ const sidebars: SidebarsConfig = {
}, },
{ {
type: 'doc', type: 'doc',
label: 'Github Action', label: 'Github Actions',
id: 'usage/how-to/github-action', id: 'usage/how-to/github-action',
}, },
{
type: 'category',
label: 'Cloud',
items: [
{
type: 'doc',
label: 'Openhands Cloud',
id: 'usage/cloud/openhands-cloud',
},
{
type: 'doc',
label: 'Cloud GitHub Resolver',
id: 'usage/cloud/cloud-github-resolver',
},
],
},
], ],
}, },
{ {
@@ -202,7 +185,7 @@ const sidebars: SidebarsConfig = {
type: 'doc', type: 'doc',
label: 'About', label: 'About',
id: 'usage/about', id: 'usage/about',
}, }
], ],
}; };
+1 -1
View File
@@ -8,7 +8,7 @@ function CustomFooter() {
<footer className="custom-footer"> <footer className="custom-footer">
<div className="footer-content"> <div className="footer-content">
<div className="footer-icons"> <div className="footer-icons">
<a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2ypg5jweb-d~6hObZDbXi_HEL8PDrbHg" target="_blank" rel="noopener noreferrer"> <a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw" target="_blank" rel="noopener noreferrer">
<FaSlack /> <FaSlack />
</a> </a>
<a href="https://discord.gg/ESHStjSjD4" target="_blank" rel="noopener noreferrer"> <a href="https://discord.gg/ESHStjSjD4" target="_blank" rel="noopener noreferrer">
+4
View File
@@ -5,6 +5,9 @@ export function Demo() {
const videoRef = React.useRef<HTMLVideoElement>(null); const videoRef = React.useRef<HTMLVideoElement>(null);
return ( return (
<div
style={{ paddingBottom: "10px", paddingTop: "10px", textAlign: "center" }}
>
<video <video
playsInline playsInline
autoPlay={true} autoPlay={true}
@@ -17,5 +20,6 @@ export function Demo() {
> >
<source src="img/teaser.mp4" type="video/mp4"></source> <source src="img/teaser.mp4" type="video/mp4"></source>
</video> </video>
</div>
); );
} }
@@ -1,5 +1,6 @@
.demo { .demo {
width: 100%; width: 100%;
padding: 30px;
max-width: 800px; max-width: 800px;
text-align: center; text-align: center;
border-radius: 40px; border-radius: 40px;
@@ -17,42 +17,22 @@ export function HomepageHeader() {
<p className="header-subtitle">{siteConfig.tagline}</p> <p className="header-subtitle">{siteConfig.tagline}</p>
<div style={{
textAlign: 'center',
fontSize: '1.2rem',
maxWidth: '800px',
margin: '0 auto',
padding: '0rem 0rem 1rem'
}}>
<p style={{ margin: '0' }}>
Use AI to tackle the toil in your backlog. Our agents have all the same tools as a human developer: they can modify code, run commands, browse the web,
call APIs, and yes-even copy code snippets from StackOverflow.
<br/>
<Link to="https://docs.all-hands.dev/modules/usage/installation"
style={{
textDecoration: 'underline',
display: 'inline-block',
marginTop: '0.5rem'
}}
>
Get started with OpenHands.
</Link>
</p>
</div>
<div align="center" className="header-links"> <div align="center" className="header-links">
<a href="https://github.com/All-Hands-AI/OpenHands/graphs/contributors"><img src="https://img.shields.io/github/contributors/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" alt="Contributors" /></a> <a href="https://github.com/All-Hands-AI/OpenHands/graphs/contributors"><img src="https://img.shields.io/github/contributors/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" alt="Contributors" /></a>
<a href="https://github.com/All-Hands-AI/OpenHands/stargazers"><img src="https://img.shields.io/github/stars/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" alt="Stargazers" /></a> <a href="https://github.com/All-Hands-AI/OpenHands/stargazers"><img src="https://img.shields.io/github/stars/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" alt="Stargazers" /></a>
<a href="https://codecov.io/github/All-Hands-AI/OpenHands?branch=main"><img alt="CodeCov" src="https://img.shields.io/codecov/c/github/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" /></a> <a href="https://codecov.io/github/All-Hands-AI/OpenHands?branch=main"><img alt="CodeCov" src="https://img.shields.io/codecov/c/github/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" /></a>
<a href="https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE"><img src="https://img.shields.io/github/license/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" alt="MIT License" /></a> <a href="https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE"><img src="https://img.shields.io/github/license/All-Hands-AI/OpenHands?style=for-the-badge&color=blue" alt="MIT License" /></a>
<br/> <br/>
<a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2ypg5jweb-d~6hObZDbXi_HEL8PDrbHg"><img src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge" alt="Join our Slack community" /></a> <a href="https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw"><img src="https://img.shields.io/badge/Slack-Join%20Us-red?logo=slack&logoColor=white&style=for-the-badge" alt="Join our Slack community" /></a>
<a href="https://discord.gg/ESHStjSjD4"><img src="https://img.shields.io/badge/Discord-Join%20Us-purple?logo=discord&logoColor=white&style=for-the-badge" alt="Join our Discord community" /></a> <a href="https://discord.gg/ESHStjSjD4"><img src="https://img.shields.io/badge/Discord-Join%20Us-purple?logo=discord&logoColor=white&style=for-the-badge" alt="Join our Discord community" /></a>
<a href="https://github.com/All-Hands-AI/OpenHands/blob/main/CREDITS.md"><img src="https://img.shields.io/badge/Project-Credits-blue?style=for-the-badge&color=FFE165&logo=github&logoColor=white" alt="Credits" /></a> <a href="https://github.com/All-Hands-AI/OpenHands/blob/main/CREDITS.md"><img src="https://img.shields.io/badge/Project-Credits-blue?style=for-the-badge&color=FFE165&logo=github&logoColor=white" alt="Credits" /></a>
<br/> <br/>
<a href="https://docs.all-hands.dev/modules/usage/getting-started"><img src="https://img.shields.io/badge/Documentation-000?logo=googledocs&logoColor=FFE165&style=for-the-badge" alt="Check out the documentation" /></a>
<a href="https://arxiv.org/abs/2407.16741"><img src="https://img.shields.io/badge/Paper%20on%20Arxiv-000?logoColor=FFE165&logo=arxiv&style=for-the-badge" alt="Paper on Arxiv" /></a> <a href="https://arxiv.org/abs/2407.16741"><img src="https://img.shields.io/badge/Paper%20on%20Arxiv-000?logoColor=FFE165&logo=arxiv&style=for-the-badge" alt="Paper on Arxiv" /></a>
<a href="https://huggingface.co/spaces/OpenHands/evaluation"><img src="https://img.shields.io/badge/Benchmark%20score-000?logoColor=FFE165&logo=huggingface&style=for-the-badge" alt="Evaluation Benchmark Score" /></a> <a href="https://huggingface.co/spaces/OpenHands/evaluation"><img src="https://img.shields.io/badge/Benchmark%20score-000?logoColor=FFE165&logo=huggingface&style=for-the-badge" alt="Evaluation Benchmark Score" /></a>
</div> </div>
<Demo />
</div> </div>
</div> </div>
); );
+2 -3
View File
@@ -1,14 +1,14 @@
/* homepageHeader.css */ /* homepageHeader.css */
.homepage-header { .homepage-header {
padding: 1rem 0; height: 800px;
} }
.header-content { .header-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding: 1rem; padding: 2rem;
font-weight: 300; font-weight: 300;
width: 100%; width: 100%;
} }
@@ -25,7 +25,6 @@
.header-subtitle { .header-subtitle {
font-size: 1.5rem; font-size: 1.5rem;
margin: 0.5rem 0;
} }
.header-links { .header-links {
+9 -15
View File
@@ -2,7 +2,15 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout'; import Layout from '@theme/Layout';
import { HomepageHeader } from '../components/HomepageHeader/HomepageHeader'; import { HomepageHeader } from '../components/HomepageHeader/HomepageHeader';
import { translate } from '@docusaurus/Translate'; import { translate } from '@docusaurus/Translate';
import { Demo } from "../components/Demo/Demo";
export function Header({ title, summary }): JSX.Element {
return (
<div>
<h1>{title}</h1>
<h2 style={{ fontSize: '3rem' }}>{summary}</h2>
</div>
);
}
export default function Home(): JSX.Element { export default function Home(): JSX.Element {
const { siteConfig } = useDocusaurusContext(); const { siteConfig } = useDocusaurusContext();
@@ -15,20 +23,6 @@ export default function Home(): JSX.Element {
})} })}
> >
<HomepageHeader /> <HomepageHeader />
<div style={{ textAlign: 'center', padding: '1rem 0' }}>
<Demo />
</div>
<div style={{ textAlign: 'center', padding: '0.5rem 2rem 1.5rem' }}>
<h2>Most Popular Links</h2>
<ul style={{ listStyleType: 'none'}}>
<li><a href="/modules/usage/prompting/microagents-repo">Customizing OpenHands to a repository</a></li>
<li><a href="/modules/usage/how-to/github-action">Integrating OpenHands with Github</a></li>
<li><a href="/modules/usage/llms#model-recommendations">Recommended models to use</a></li>
<li><a href="/modules/usage/runtimes#connecting-to-your-filesystem">Connecting OpenHands to your filesystem</a></li>
</ul>
</div>
</Layout> </Layout>
); );
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

-4
View File
@@ -20,8 +20,6 @@ To evaluate an agent, you can provide the agent's name to the `run_infer.py` pro
### Evaluating Different LLMs ### Evaluating Different LLMs
OpenHands in development mode uses `config.toml` to keep track of most configuration. OpenHands in development mode uses `config.toml` to keep track of most configuration.
**IMPORTANT: For evaluation, only the LLM section in `config.toml` will be used. Other configurations, such as `save_trajectory_path`, are not applied during evaluation.**
Here's an example configuration file you can use to define and use multiple LLMs: Here's an example configuration file you can use to define and use multiple LLMs:
```toml ```toml
@@ -42,8 +40,6 @@ api_key = "XXX"
temperature = 0.0 temperature = 0.0
``` ```
For other configurations specific to evaluation, such as `save_trajectory_path`, these are typically set in the `get_config` function of the respective `run_infer.py` file for each benchmark.
## Supported Benchmarks ## Supported Benchmarks
The OpenHands evaluation harness supports a wide variety of benchmarks across [software engineering](#software-engineering), [web browsing](#web-browsing), [miscellaneous assistance](#misc-assistance), and [real-world](#real-world) tasks. The OpenHands evaluation harness supports a wide variety of benchmarks across [software engineering](#software-engineering), [web browsing](#web-browsing), [miscellaneous assistance](#misc-assistance), and [real-world](#real-world) tasks.
+6 -4
View File
@@ -9,7 +9,6 @@ from evaluation.utils.shared import (
EvalMetadata, EvalMetadata,
EvalOutput, EvalOutput,
compatibility_for_eval_history_pairs, compatibility_for_eval_history_pairs,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -18,6 +17,7 @@ from evaluation.utils.shared import (
from openhands.controller.state.state import State from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
get_parser, get_parser,
) )
@@ -60,14 +60,16 @@ AGENT_CLS_TO_INST_SUFFIX = {
def get_config( def get_config(
metadata: EvalMetadata, metadata: EvalMetadata,
) -> AppConfig: ) -> AppConfig:
sandbox_config = get_default_sandbox_config_for_eval()
sandbox_config.base_container_image = 'python:3.12-bookworm'
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
runtime='docker', runtime='docker',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image='python:3.12-bookworm',
enable_auto_lint=False,
use_host_network=False,
),
# do not mount workspace # do not mount workspace
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"
+10 -5
View File
@@ -17,7 +17,6 @@ from evaluation.utils.shared import (
EvalMetadata, EvalMetadata,
EvalOutput, EvalOutput,
compatibility_for_eval_history_pairs, compatibility_for_eval_history_pairs,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -26,6 +25,7 @@ from evaluation.utils.shared import (
from openhands.controller.state.state import State from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
parse_arguments, parse_arguments,
) )
@@ -40,15 +40,20 @@ from openhands.utils.async_utils import call_async_from_sync
def get_config( def get_config(
metadata: EvalMetadata, metadata: EvalMetadata,
) -> AppConfig: ) -> AppConfig:
sandbox_config = get_default_sandbox_config_for_eval()
sandbox_config.base_container_image = 'python:3.12-slim'
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
runtime=os.environ.get('RUNTIME', 'docker'), runtime=os.environ.get('RUNTIME', 'docker'),
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image='python:3.12-slim',
enable_auto_lint=True,
use_host_network=False,
api_key=os.environ.get('ALLHANDS_API_KEY', None),
remote_runtime_api_url=os.environ.get('SANDBOX_REMOTE_RUNTIME_API_URL'),
keep_runtime_alive=False,
remote_runtime_init_timeout=3600,
),
# do not mount workspace # do not mount workspace
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"
+2 -3
View File
@@ -56,10 +56,9 @@ You can update the arguments in the script
./evaluation/benchmarks/aider_bench/scripts/run_infer.sh eval_gpt35_turbo HEAD CodeActAgent 100 1 "1,3,10" ./evaluation/benchmarks/aider_bench/scripts/run_infer.sh eval_gpt35_turbo HEAD CodeActAgent 100 1 "1,3,10"
``` ```
### Run Inference on `RemoteRuntime` ### Run Inference on `RemoteRuntime` (experimental)
This is in beta. Fill out [this form](https://docs.google.com/forms/d/e/1FAIpQLSckVz_JFwg2_mOxNZjCtr7aoBFI2Mwdan3f75J_TrdMS1JV2g/viewform) to apply if you want to try this out!
This is in limited beta. Contact Xingyao over slack if you want to try this out!
```bash ```bash
./evaluation/benchmarks/aider_bench/scripts/run_infer.sh [model_config] [git-version] [agent] [eval_limit] [eval-num-workers] [eval_ids] ./evaluation/benchmarks/aider_bench/scripts/run_infer.sh [model_config] [git-version] [agent] [eval_limit] [eval-num-workers] [eval_ids]
+12 -4
View File
@@ -16,7 +16,6 @@ from evaluation.utils.shared import (
EvalMetadata, EvalMetadata,
EvalOutput, EvalOutput,
compatibility_for_eval_history_pairs, compatibility_for_eval_history_pairs,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -25,6 +24,7 @@ from evaluation.utils.shared import (
from openhands.controller.state.state import State from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
load_from_toml, load_from_toml,
parse_arguments, parse_arguments,
@@ -47,14 +47,21 @@ SKIP_NUM = (
def get_config( def get_config(
metadata: EvalMetadata, metadata: EvalMetadata,
) -> AppConfig: ) -> AppConfig:
sandbox_config = get_default_sandbox_config_for_eval()
sandbox_config.base_container_image = 'python:3.11-bookworm'
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
runtime=os.environ.get('RUNTIME', 'docker'), runtime=os.environ.get('RUNTIME', 'docker'),
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image='python:3.11-bookworm',
enable_auto_lint=True,
use_host_network=False,
timeout=100,
api_key=os.environ.get('ALLHANDS_API_KEY', None),
remote_runtime_api_url=os.environ.get('SANDBOX_REMOTE_RUNTIME_API_URL'),
keep_runtime_alive=False,
remote_runtime_init_timeout=1800,
),
# do not mount workspace # do not mount workspace
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
@@ -205,6 +212,7 @@ def process_instance(
runtime: Runtime = create_runtime(config) runtime: Runtime = create_runtime(config)
call_async_from_sync(runtime.connect) call_async_from_sync(runtime.connect)
initialize_runtime(runtime, instance=instance) initialize_runtime(runtime, instance=instance)
# Here's how you can run the agent (similar to the `main` function) and get the final task state # Here's how you can run the agent (similar to the `main` function) and get the final task state
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"
+6 -4
View File
@@ -14,7 +14,6 @@ from evaluation.utils.shared import (
EvalOutput, EvalOutput,
codeact_user_response, codeact_user_response,
compatibility_for_eval_history_pairs, compatibility_for_eval_history_pairs,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -23,6 +22,7 @@ from evaluation.utils.shared import (
from openhands.controller.state.state import State from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
parse_arguments, parse_arguments,
) )
@@ -57,15 +57,17 @@ def get_config(
metadata: EvalMetadata, metadata: EvalMetadata,
) -> AppConfig: ) -> AppConfig:
BIOCODER_BENCH_CONTAINER_IMAGE = 'public.ecr.aws/i5g0m1f6/eval_biocoder:v1.0' BIOCODER_BENCH_CONTAINER_IMAGE = 'public.ecr.aws/i5g0m1f6/eval_biocoder:v1.0'
sandbox_config = get_default_sandbox_config_for_eval()
sandbox_config.base_container_image = BIOCODER_BENCH_CONTAINER_IMAGE
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
runtime='docker', runtime='docker',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image=BIOCODER_BENCH_CONTAINER_IMAGE,
enable_auto_lint=True,
use_host_network=False,
),
# do not mount workspace # do not mount workspace
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"
+6 -5
View File
@@ -17,7 +17,6 @@ from evaluation.utils.shared import (
EvalMetadata, EvalMetadata,
EvalOutput, EvalOutput,
compatibility_for_eval_history_pairs, compatibility_for_eval_history_pairs,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -26,6 +25,7 @@ from evaluation.utils.shared import (
from openhands.controller.state.state import State from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
parse_arguments, parse_arguments,
) )
@@ -71,15 +71,16 @@ AGENT_CLS_TO_INST_SUFFIX = {
def get_config( def get_config(
metadata: EvalMetadata, metadata: EvalMetadata,
) -> AppConfig: ) -> AppConfig:
sandbox_config = get_default_sandbox_config_for_eval()
sandbox_config.base_container_image = 'python:3.12-bookworm'
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
runtime='docker', runtime='docker',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image='python:3.12-bookworm',
enable_auto_lint=True,
use_host_network=False,
),
# do not mount workspace # do not mount workspace
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"
@@ -10,7 +10,6 @@ from evaluation.utils.shared import (
EvalMetadata, EvalMetadata,
EvalOutput, EvalOutput,
compatibility_for_eval_history_pairs, compatibility_for_eval_history_pairs,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -19,13 +18,13 @@ from evaluation.utils.shared import (
from openhands.controller.state.state import State from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
parse_arguments, parse_arguments,
) )
from openhands.core.logger import openhands_logger as logger from openhands.core.logger import openhands_logger as logger
from openhands.core.main import create_runtime, run_controller from openhands.core.main import create_runtime, run_controller
from openhands.events.action import MessageAction from openhands.events.action import MessageAction
from openhands.utils.async_utils import call_async_from_sync
# Only CodeActAgent can delegate to BrowsingAgent # Only CodeActAgent can delegate to BrowsingAgent
SUPPORTED_AGENT_CLS = {'CodeActAgent'} SUPPORTED_AGENT_CLS = {'CodeActAgent'}
@@ -37,14 +36,16 @@ def get_config(
assert ( assert (
metadata.max_iterations == 1 metadata.max_iterations == 1
), 'max_iterations must be 1 for browsing delegation evaluation.' ), 'max_iterations must be 1 for browsing delegation evaluation.'
sandbox_config = get_default_sandbox_config_for_eval()
sandbox_config.base_container_image = 'python:3.12-bookworm'
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
runtime='docker', runtime='docker',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image='python:3.12-bookworm',
enable_auto_lint=False,
use_host_network=False,
),
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
) )
@@ -75,7 +76,6 @@ def process_instance(
) )
runtime = create_runtime(config) runtime = create_runtime(config)
call_async_from_sync(runtime.connect)
state: State | None = asyncio.run( state: State | None = asyncio.run(
run_controller( run_controller(
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"
@@ -23,10 +23,10 @@ Make sure your Docker daemon is running, and you have ample disk space (at least
When the `run_infer.sh` script is started, it will automatically pull the `lite` split in Commit0. For example, for instance ID `commit-0/minitorch`, it will try to pull our pre-build docker image `wentingzhao/minitorch` from DockerHub. This image will be used create an OpenHands runtime image where the agent will operate on. When the `run_infer.sh` script is started, it will automatically pull the `lite` split in Commit0. For example, for instance ID `commit-0/minitorch`, it will try to pull our pre-build docker image `wentingzhao/minitorch` from DockerHub. This image will be used create an OpenHands runtime image where the agent will operate on.
```bash ```bash
./evaluation/benchmarks/commit0/scripts/run_infer.sh [repo_split] [model_config] [git-version] [agent] [eval_limit] [max_iter] [num_workers] [dataset] [dataset_split] ./evaluation/benchmarks/commit0_bench/scripts/run_infer.sh [repo_split] [model_config] [git-version] [agent] [eval_limit] [max_iter] [num_workers] [dataset] [dataset_split]
# Example # Example
./evaluation/benchmarks/commit0/scripts/run_infer.sh lite llm.eval_sonnet HEAD CodeActAgent 16 100 8 wentingzhao/commit0_combined test ./evaluation/benchmarks/commit0_bench/scripts/run_infer.sh lite llm.eval_sonnet HEAD CodeActAgent 16 100 8 wentingzhao/commit0_combined test
``` ```
where `model_config` is mandatory, and the rest are optional. where `model_config` is mandatory, and the rest are optional.
@@ -48,25 +48,26 @@ default, it is set to 1.
- `dataset`, a huggingface dataset name. e.g. `wentingzhao/commit0_combined`, specifies which dataset to evaluate on. - `dataset`, a huggingface dataset name. e.g. `wentingzhao/commit0_combined`, specifies which dataset to evaluate on.
- `dataset_split`, split for the huggingface dataset. Notice only `test` is supported for Commit0. - `dataset_split`, split for the huggingface dataset. Notice only `test` is supported for Commit0.
Note that the `USE_INSTANCE_IMAGE` environment variable is always set to `true` for Commit0.
Let's say you'd like to run 10 instances using `llm.eval_sonnet` and CodeActAgent, Let's say you'd like to run 10 instances using `llm.eval_sonnet` and CodeActAgent,
then your command would be: then your command would be:
```bash ```bash
./evaluation/benchmarks/commit0/scripts/run_infer.sh lite llm.eval_sonnet HEAD CodeActAgent 10 30 1 wentingzhao/commit0_combined test ./evaluation/benchmarks/commit0_bench/scripts/run_infer.sh lite llm.eval_sonnet HEAD CodeActAgent 10 30 1 wentingzhao/commit0_combined test
``` ```
### Run Inference on `RemoteRuntime` ### Run Inference on `RemoteRuntime` (experimental)
This is in beta. Fill out [this form](https://docs.google.com/forms/d/e/1FAIpQLSckVz_JFwg2_mOxNZjCtr7aoBFI2Mwdan3f75J_TrdMS1JV2g/viewform) to apply if you want to try this out!
This is in limited beta. Contact Xingyao over slack if you want to try this out!
```bash ```bash
./evaluation/benchmarks/commit0/scripts/run_infer.sh [repo_split] [model_config] [git-version] [agent] [eval_limit] [max_iter] [num_workers] [dataset] [dataset_split] ./evaluation/benchmarks/commit0_bench/scripts/run_infer.sh [repo_split] [model_config] [git-version] [agent] [eval_limit] [max_iter] [num_workers] [dataset] [dataset_split]
# Example - This runs evaluation on CodeActAgent for 10 instances on "wentingzhao/commit0_combined"'s test set, with max 30 iteration per instances, with 1 number of workers running in parallel # Example - This runs evaluation on CodeActAgent for 10 instances on "wentingzhao/commit0_combined"'s test set, with max 30 iteration per instances, with 1 number of workers running in parallel
ALLHANDS_API_KEY="YOUR-API-KEY" RUNTIME=remote SANDBOX_REMOTE_RUNTIME_API_URL="https://runtime.eval.all-hands.dev" EVAL_DOCKER_IMAGE_PREFIX="docker.io/wentingzhao" \ ALLHANDS_API_KEY="YOUR-API-KEY" RUNTIME=remote SANDBOX_REMOTE_RUNTIME_API_URL="https://runtime.eval.all-hands.dev" EVAL_DOCKER_IMAGE_PREFIX="docker.io/wentingzhao" \
./evaluation/benchmarks/commit0/scripts/run_infer.sh lite llm.eval_sonnet HEAD CodeActAgent 10 30 1 wentingzhao/commit0_combined test ./evaluation/benchmarks/commit0_bench/scripts/run_infer.sh lite llm.eval_sonnet HEAD CodeActAgent 10 30 1 wentingzhao/commit0_combined test
``` ```
To clean-up all existing runtime you've already started, run: To clean-up all existing runtime you've already started, run:
@@ -15,7 +15,6 @@ from evaluation.utils.shared import (
EvalOutput, EvalOutput,
assert_and_raise, assert_and_raise,
codeact_user_response, codeact_user_response,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -26,6 +25,7 @@ from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AgentConfig, AgentConfig,
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
get_parser, get_parser,
) )
@@ -39,6 +39,7 @@ from openhands.utils.async_utils import call_async_from_sync
from openhands.utils.shutdown_listener import sleep_if_should_continue from openhands.utils.shutdown_listener import sleep_if_should_continue
USE_HINT_TEXT = os.environ.get('USE_HINT_TEXT', 'false').lower() == 'true' USE_HINT_TEXT = os.environ.get('USE_HINT_TEXT', 'false').lower() == 'true'
USE_INSTANCE_IMAGE = os.environ.get('USE_INSTANCE_IMAGE', 'false').lower() == 'true'
RUN_WITH_BROWSING = os.environ.get('RUN_WITH_BROWSING', 'false').lower() == 'true' RUN_WITH_BROWSING = os.environ.get('RUN_WITH_BROWSING', 'false').lower() == 'true'
AGENT_CLS_TO_FAKE_USER_RESPONSE_FN = { AGENT_CLS_TO_FAKE_USER_RESPONSE_FN = {
@@ -104,6 +105,9 @@ def get_config(
instance: pd.Series, instance: pd.Series,
metadata: EvalMetadata, metadata: EvalMetadata,
) -> AppConfig: ) -> AppConfig:
# COMMIT0_CONTAINER_IMAGE = 'wentingzhao/'
assert USE_INSTANCE_IMAGE
# We use a different instance image for the each instance of commit0 eval
repo_name = instance['repo'].split('/')[1] repo_name = instance['repo'].split('/')[1]
base_container_image = get_instance_docker_image(repo_name) base_container_image = get_instance_docker_image(repo_name)
logger.info( logger.info(
@@ -111,16 +115,27 @@ def get_config(
f'Please make sure this image exists. ' f'Please make sure this image exists. '
f'Submit an issue on https://github.com/All-Hands-AI/OpenHands if you run into any issues.' f'Submit an issue on https://github.com/All-Hands-AI/OpenHands if you run into any issues.'
) )
# else:
sandbox_config = get_default_sandbox_config_for_eval() # raise
sandbox_config.base_container_image = base_container_image # base_container_image = SWE_BENCH_CONTAINER_IMAGE
# logger.info(f'Using swe-bench container image: {base_container_image}')
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
runtime=os.environ.get('RUNTIME', 'docker'), runtime=os.environ.get('RUNTIME', 'docker'),
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image=base_container_image,
enable_auto_lint=True,
use_host_network=False,
# large enough timeout, since some testcases take very long to run
timeout=300,
api_key=os.environ.get('ALLHANDS_API_KEY', None),
remote_runtime_api_url=os.environ.get('SANDBOX_REMOTE_RUNTIME_API_URL'),
keep_runtime_alive=False,
remote_runtime_init_timeout=3600,
),
# do not mount workspace # do not mount workspace
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
@@ -301,16 +316,6 @@ def complete_runtime(
pytest_exit_code = obs.content.strip() pytest_exit_code = obs.content.strip()
# logger.info(f'Pytest exit code: {pytest_exit_code}') # logger.info(f'Pytest exit code: {pytest_exit_code}')
# Get test IDs from instance
repo_name = instance['repo'].split('/')[1]
repo_name = repo_name.replace('.', '-')
action = CmdRunAction(command=f'commit0 get-tests {repo_name}')
action.set_hard_timeout(600)
logger.info(action, extra={'msg_type': 'ACTION'})
obs = runtime.run_action(action)
# logger.info(obs, extra={'msg_type': 'OBSERVATION'})
test_ids = obs.content.strip().split('\n')
# Read the test report # Read the test report
action = CmdRunAction(command='cat report.json') action = CmdRunAction(command='cat report.json')
action.set_hard_timeout(600) action.set_hard_timeout(600)
@@ -321,10 +326,18 @@ def complete_runtime(
isinstance(obs, CmdOutputObservation), isinstance(obs, CmdOutputObservation),
f'Failed to read test report: {str(obs)}', f'Failed to read test report: {str(obs)}',
) )
json_report = obs.content.strip() # Get test IDs from instance
repo_name = instance['repo'].split('/')[1]
repo_name = repo_name.replace('.', '-')
action = CmdRunAction(command=f'commit0 get-tests {repo_name}')
action.set_hard_timeout(600)
logger.info(action, extra={'msg_type': 'ACTION'})
obs = runtime.run_action(action)
# logger.info(obs, extra={'msg_type': 'OBSERVATION'})
test_ids = obs.content.strip().split('\n')
try: try:
report = json.loads(json_report) report = json.loads(obs.content)
tests = {x['nodeid']: x['call'] for x in report['tests'] if 'call' in x} tests = {x['nodeid']: x['call'] for x in report['tests'] if 'call' in x}
# Calculate test statistics # Calculate test statistics
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"
@@ -30,6 +30,11 @@ if [ -z "$MAX_ITER" ]; then
MAX_ITER=100 MAX_ITER=100
fi fi
if [ -z "$USE_INSTANCE_IMAGE" ]; then
echo "USE_INSTANCE_IMAGE not specified, use default true"
USE_INSTANCE_IMAGE=true
fi
if [ -z "$RUN_WITH_BROWSING" ]; then if [ -z "$RUN_WITH_BROWSING" ]; then
echo "RUN_WITH_BROWSING not specified, use default false" echo "RUN_WITH_BROWSING not specified, use default false"
RUN_WITH_BROWSING=false RUN_WITH_BROWSING=false
@@ -51,6 +56,8 @@ if [ -z "$SPLIT" ]; then
SPLIT="test" SPLIT="test"
fi fi
export USE_INSTANCE_IMAGE=$USE_INSTANCE_IMAGE
echo "USE_INSTANCE_IMAGE: $USE_INSTANCE_IMAGE"
export RUN_WITH_BROWSING=$RUN_WITH_BROWSING export RUN_WITH_BROWSING=$RUN_WITH_BROWSING
echo "RUN_WITH_BROWSING: $RUN_WITH_BROWSING" echo "RUN_WITH_BROWSING: $RUN_WITH_BROWSING"
@@ -84,7 +91,7 @@ fi
function run_eval() { function run_eval() {
local eval_note=$1 local eval_note=$1
COMMAND="poetry run python evaluation/benchmarks/commit0/run_infer.py \ COMMAND="poetry run python evaluation/benchmarks/commit0_bench/run_infer.py \
--agent-cls $AGENT \ --agent-cls $AGENT \
--llm-config $MODEL_CONFIG \ --llm-config $MODEL_CONFIG \
--max-iterations $MAX_ITER \ --max-iterations $MAX_ITER \
@@ -16,7 +16,6 @@ from evaluation.utils.shared import (
EvalOutput, EvalOutput,
codeact_user_response, codeact_user_response,
compatibility_for_eval_history_pairs, compatibility_for_eval_history_pairs,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -26,6 +25,7 @@ from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AgentConfig, AgentConfig,
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
parse_arguments, parse_arguments,
) )
@@ -62,14 +62,16 @@ AGENT_CLS_TO_INST_SUFFIX = {
def get_config( def get_config(
metadata: EvalMetadata, metadata: EvalMetadata,
) -> AppConfig: ) -> AppConfig:
sandbox_config = get_default_sandbox_config_for_eval()
sandbox_config.base_container_image = 'python:3.12-bookworm'
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
runtime='docker', runtime='docker',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image='python:3.12-bookworm',
enable_auto_lint=True,
use_host_network=False,
),
# do not mount workspace # do not mount workspace
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"
+8 -16
View File
@@ -13,7 +13,6 @@ from evaluation.utils.shared import (
EvalOutput, EvalOutput,
codeact_user_response, codeact_user_response,
compatibility_for_eval_history_pairs, compatibility_for_eval_history_pairs,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -22,10 +21,10 @@ from evaluation.utils.shared import (
from openhands.controller.state.state import State from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
get_parser, get_parser,
) )
from openhands.core.config.utils import get_agent_config_arg
from openhands.core.logger import openhands_logger as logger from openhands.core.logger import openhands_logger as logger
from openhands.core.main import create_runtime, run_controller from openhands.core.main import create_runtime, run_controller
from openhands.events.action import AgentFinishAction, CmdRunAction, MessageAction from openhands.events.action import AgentFinishAction, CmdRunAction, MessageAction
@@ -48,25 +47,23 @@ AGENT_CLS_TO_INST_SUFFIX = {
def get_config( def get_config(
metadata: EvalMetadata, metadata: EvalMetadata,
) -> AppConfig: ) -> AppConfig:
sandbox_config = get_default_sandbox_config_for_eval()
sandbox_config.base_container_image = 'python:3.12-bookworm'
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
runtime='docker', runtime='docker',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image='python:3.12-bookworm',
enable_auto_lint=True,
use_host_network=False,
),
# do not mount workspace # do not mount workspace
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
) )
config.set_llm_config(metadata.llm_config) config.set_llm_config(metadata.llm_config)
if metadata.agent_config: agent_config = config.get_agent_config(metadata.agent_class)
config.set_agent_config(metadata.agent_config, metadata.agent_class) agent_config.enable_prompt_extensions = False
else:
logger.info('Agent config not provided, using default settings')
agent_config = config.get_agent_config(metadata.agent_class)
agent_config.enable_prompt_extensions = False
return config return config
@@ -240,10 +237,6 @@ if __name__ == '__main__':
) )
args, _ = parser.parse_known_args() args, _ = parser.parse_known_args()
agent_config = None
if args.agent_config:
agent_config = get_agent_config_arg(args.agent_config)
llm_config = None llm_config = None
if args.llm_config: if args.llm_config:
llm_config = get_llm_config_arg(args.llm_config) llm_config = get_llm_config_arg(args.llm_config)
@@ -262,7 +255,6 @@ if __name__ == '__main__':
eval_output_dir=args.eval_output_dir, eval_output_dir=args.eval_output_dir,
data_split=args.data_split, data_split=args.data_split,
details={'gaia-level': args.level}, details={'gaia-level': args.level},
agent_config=agent_config,
) )
dataset = load_dataset('gaia-benchmark/GAIA', args.level) dataset = load_dataset('gaia-benchmark/GAIA', args.level)
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"
@@ -9,7 +9,6 @@ AGENT=$3
EVAL_LIMIT=$4 EVAL_LIMIT=$4
LEVELS=$5 LEVELS=$5
NUM_WORKERS=$6 NUM_WORKERS=$6
AGENT_CONFIG=$7
if [ -z "$NUM_WORKERS" ]; then if [ -z "$NUM_WORKERS" ]; then
NUM_WORKERS=1 NUM_WORKERS=1
@@ -50,9 +49,5 @@ if [ -n "$EVAL_LIMIT" ]; then
COMMAND="$COMMAND --eval-n-limit $EVAL_LIMIT" COMMAND="$COMMAND --eval-n-limit $EVAL_LIMIT"
fi fi
if [ -n "$AGENT_CONFIG" ]; then
echo "AGENT_CONFIG: $AGENT_CONFIG"
COMMAND="$COMMAND --agent-config $AGENT_CONFIG"
# Run the command # Run the command
eval $COMMAND eval $COMMAND
+4 -4
View File
@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
# This file is modified from https://github.com/ShishirPatil/gorilla/blob/main/eval/eval-scripts/ast_eval_hf.py # This file is modified from https://github.com/ShishirPatil/gorilla/blob/main/eval/eval-scripts/ast_eval_hf.py
import tree_sitter_python as tspython
from tree_sitter import Language, Parser from tree_sitter import Language, Parser
@@ -40,9 +39,10 @@ def get_all_sub_trees(root_node):
# Parse the program into AST trees # Parse the program into AST trees
def ast_parse(candidate): def ast_parse(candidate, lang='python'):
LANGUAGE = Language(tspython.language()) LANGUAGE = Language('evaluation/gorilla/my-languages.so', lang)
parser = Parser(LANGUAGE) parser = Parser()
parser.set_language(LANGUAGE)
candidate_tree = parser.parse(bytes(candidate, 'utf8')).root_node candidate_tree = parser.parse(bytes(candidate, 'utf8')).root_node
return candidate_tree return candidate_tree
+4 -4
View File
@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
# This file is modified from https://github.com/ShishirPatil/gorilla/blob/main/eval/eval-scripts/ast_eval_tf.py # This file is modified from https://github.com/ShishirPatil/gorilla/blob/main/eval/eval-scripts/ast_eval_tf.py
import tree_sitter_python as tspython
from tree_sitter import Language, Parser from tree_sitter import Language, Parser
@@ -40,9 +39,10 @@ def get_all_sub_trees(root_node):
# Parse the program into AST trees # Parse the program into AST trees
def ast_parse(candidate): def ast_parse(candidate, lang='python'):
LANGUAGE = Language(tspython.language()) LANGUAGE = Language('evaluation/gorilla/my-languages.so', lang)
parser = Parser(LANGUAGE) parser = Parser()
parser.set_language(LANGUAGE)
candidate_tree = parser.parse(bytes(candidate, 'utf8')).root_node candidate_tree = parser.parse(bytes(candidate, 'utf8')).root_node
return candidate_tree return candidate_tree
+4 -4
View File
@@ -13,7 +13,6 @@
# limitations under the License. # limitations under the License.
# This file is modified from https://github.com/ShishirPatil/gorilla/blob/main/eval/eval-scripts/ast_eval_th.py # This file is modified from https://github.com/ShishirPatil/gorilla/blob/main/eval/eval-scripts/ast_eval_th.py
import tree_sitter_python as tspython
from tree_sitter import Language, Parser from tree_sitter import Language, Parser
@@ -40,9 +39,10 @@ def get_all_sub_trees(root_node):
# Parse the program into AST trees # Parse the program into AST trees
def ast_parse(candidate): def ast_parse(candidate, lang='python'):
LANGUAGE = Language(tspython.language()) LANGUAGE = Language('evaluation/gorilla/my-languages.so', lang)
parser = Parser(LANGUAGE) parser = Parser()
parser.set_language(LANGUAGE)
candidate_tree = parser.parse(bytes(candidate, 'utf8')).root_node candidate_tree = parser.parse(bytes(candidate, 'utf8')).root_node
return candidate_tree return candidate_tree
+6 -4
View File
@@ -11,7 +11,6 @@ from evaluation.utils.shared import (
EvalOutput, EvalOutput,
codeact_user_response, codeact_user_response,
compatibility_for_eval_history_pairs, compatibility_for_eval_history_pairs,
get_default_sandbox_config_for_eval,
make_metadata, make_metadata,
prepare_dataset, prepare_dataset,
reset_logger_for_multiprocessing, reset_logger_for_multiprocessing,
@@ -20,6 +19,7 @@ from evaluation.utils.shared import (
from openhands.controller.state.state import State from openhands.controller.state.state import State
from openhands.core.config import ( from openhands.core.config import (
AppConfig, AppConfig,
SandboxConfig,
get_llm_config_arg, get_llm_config_arg,
get_parser, get_parser,
) )
@@ -40,14 +40,16 @@ AGENT_CLS_TO_INST_SUFFIX = {
def get_config( def get_config(
metadata: EvalMetadata, metadata: EvalMetadata,
) -> AppConfig: ) -> AppConfig:
sandbox_config = get_default_sandbox_config_for_eval()
sandbox_config.base_container_image = 'python:3.12-bookworm'
config = AppConfig( config = AppConfig(
default_agent=metadata.agent_class, default_agent=metadata.agent_class,
run_as_openhands=False, run_as_openhands=False,
runtime='docker', runtime='docker',
max_iterations=metadata.max_iterations, max_iterations=metadata.max_iterations,
sandbox=sandbox_config, sandbox=SandboxConfig(
base_container_image='python:3.12-bookworm',
enable_auto_lint=True,
use_host_network=False,
),
# do not mount workspace # do not mount workspace
workspace_base=None, workspace_base=None,
workspace_mount_path=None, workspace_mount_path=None,
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/bash
set -eo pipefail set -eo pipefail
source "evaluation/utils/version_control.sh" source "evaluation/utils/version_control.sh"

Some files were not shown because too many files have changed in this diff Show More