mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-04-29 03:00:45 -04:00
Compare commits
318 Commits
0.17.0
...
eval/visua
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
532a284d5c | ||
|
|
43f6104967 | ||
|
|
e619929909 | ||
|
|
93753ac2e0 | ||
|
|
38e19d214d | ||
|
|
19a4f1c3ec | ||
|
|
45a048f9e3 | ||
|
|
358d9cb3f4 | ||
|
|
e6a2fd3fd4 | ||
|
|
c2f308f397 | ||
|
|
a1f1c802d9 | ||
|
|
ad2237d7dd | ||
|
|
aa0cd51967 | ||
|
|
081a1305f0 | ||
|
|
9912e28576 | ||
|
|
b19a33ccad | ||
|
|
21e912d6fb | ||
|
|
0dd9b95dbe | ||
|
|
aebb583779 | ||
|
|
2ff9ba1229 | ||
|
|
a7e6068ba8 | ||
|
|
24adcee9e3 | ||
|
|
21d4ba0bbd | ||
|
|
5ba9a6d321 | ||
|
|
aa223734d4 | ||
|
|
053723a4d4 | ||
|
|
5a6dbac5a3 | ||
|
|
93d74e9b41 | ||
|
|
1337d03816 | ||
|
|
04e36df4d7 | ||
|
|
f9ba16b648 | ||
|
|
f0dbb02ee1 | ||
|
|
318c811817 | ||
|
|
b468150f2a | ||
|
|
b9a3f1c753 | ||
|
|
09e8a1eeba | ||
|
|
ff3880c76d | ||
|
|
8bd7613724 | ||
|
|
5b7fcfbe1a | ||
|
|
8ae36481df | ||
|
|
25fdb0c3bf | ||
|
|
7f57dbebda | ||
|
|
54589d7e83 | ||
|
|
b7f34c3f8d | ||
|
|
210eeee94a | ||
|
|
509892cf0e | ||
|
|
89963e93d8 | ||
|
|
b6804f9e1e | ||
|
|
d30211da18 | ||
|
|
06121bf20f | ||
|
|
541a445dfc | ||
|
|
03e496fb60 | ||
|
|
1b6e444ecb | ||
|
|
2b04ee2e62 | ||
|
|
4383be1ab4 | ||
|
|
b4d20e3e18 | ||
|
|
532c7cdf02 | ||
|
|
987861b5e7 | ||
|
|
f07ec7a09c | ||
|
|
b1fa6301f0 | ||
|
|
62fbe4c622 | ||
|
|
a1a87af69d | ||
|
|
a12087243a | ||
|
|
899c1f8360 | ||
|
|
c5d7caf01f | ||
|
|
85a760e561 | ||
|
|
8e9c315729 | ||
|
|
000055ba73 | ||
|
|
2edb2337c2 | ||
|
|
7c8a0162ae | ||
|
|
c10f18b3bd | ||
|
|
313c8eca20 | ||
|
|
eff9e07272 | ||
|
|
f8a3aeccd6 | ||
|
|
9375e0d756 | ||
|
|
72af7bbba2 | ||
|
|
0661c69bd3 | ||
|
|
0c961bfd8b | ||
|
|
0bed17758f | ||
|
|
da1a6035ac | ||
|
|
df050e4786 | ||
|
|
e211647eba | ||
|
|
8579710c82 | ||
|
|
8c35150c3e | ||
|
|
578291e961 | ||
|
|
efe04baf34 | ||
|
|
6e089619e0 | ||
|
|
179a89a211 | ||
|
|
8795ee6c6e | ||
|
|
97e938d545 | ||
|
|
b9a70c8d5c | ||
|
|
082d0b25c5 | ||
|
|
c5797d1d5a | ||
|
|
7ce1fb85ff | ||
|
|
fa6792e5a6 | ||
|
|
3d9b4c4af6 | ||
|
|
e21cbf67ee | ||
|
|
6b2e3f938f | ||
|
|
580d7b938c | ||
|
|
28178a2940 | ||
|
|
04382b2b19 | ||
|
|
4da812c781 | ||
|
|
37b7173481 | ||
|
|
f0ebf3eba8 | ||
|
|
92b8d55c2d | ||
|
|
a125b6cd43 | ||
|
|
01ac207b92 | ||
|
|
6d015a5dca | ||
|
|
275512305d | ||
|
|
3a4bc10b29 | ||
|
|
bbd31b32f3 | ||
|
|
295c6fd629 | ||
|
|
5a809c9b53 | ||
|
|
0b74fd71d9 | ||
|
|
4fa5c329d6 | ||
|
|
5b1dcf83a6 | ||
|
|
b9884f7609 | ||
|
|
99eda0e571 | ||
|
|
5832463088 | ||
|
|
045ec2b95d | ||
|
|
23473070b9 | ||
|
|
63133c0ba9 | ||
|
|
2023fb767f | ||
|
|
23f40a1c01 | ||
|
|
873dddb4e8 | ||
|
|
fe50cd1f9f | ||
|
|
516e2da520 | ||
|
|
1dd6f544bc | ||
|
|
40c52feb5b | ||
|
|
f31ccad48b | ||
|
|
828d169b82 | ||
|
|
a622d27016 | ||
|
|
5507b131fe | ||
|
|
0f102e4c71 | ||
|
|
157a1a24f6 | ||
|
|
fcfbcb64d4 | ||
|
|
931792e87a | ||
|
|
ee701eacc2 | ||
|
|
8907fed78e | ||
|
|
3cc20a2576 | ||
|
|
01cf0d433c | ||
|
|
f6bed82ae2 | ||
|
|
3eae2e2aca | ||
|
|
b45fc522c7 | ||
|
|
0d409c8c24 | ||
|
|
5458ebbd7d | ||
|
|
c411a29db4 | ||
|
|
386e04a2ba | ||
|
|
62c4bab6ba | ||
|
|
e308b6fb6f | ||
|
|
27a660fb6b | ||
|
|
27d761a1fe | ||
|
|
8028e2c2dd | ||
|
|
ff9058e28a | ||
|
|
c45caaef1f | ||
|
|
a3c107daa4 | ||
|
|
040839bdd1 | ||
|
|
aabbbb6c6a | ||
|
|
9747c9e9f8 | ||
|
|
bb85542aca | ||
|
|
6e4ff56934 | ||
|
|
561f308401 | ||
|
|
3733c646af | ||
|
|
cf0f6e5e38 | ||
|
|
77aa843d53 | ||
|
|
affbc49b08 | ||
|
|
9016b9c434 | ||
|
|
e3a96097ba | ||
|
|
6a41a3cb4f | ||
|
|
d1555e093c | ||
|
|
5469d5311d | ||
|
|
eaf4c610b2 | ||
|
|
aad7a612c1 | ||
|
|
23425c85aa | ||
|
|
fb53ae43c0 | ||
|
|
1f8a0180d3 | ||
|
|
8cfcdd7ba3 | ||
|
|
9515ac5e62 | ||
|
|
cebd391b7a | ||
|
|
343b86429e | ||
|
|
09734467c0 | ||
|
|
17d722f3b3 | ||
|
|
e310f6b776 | ||
|
|
5626a22e42 | ||
|
|
cde8aad47f | ||
|
|
efd0267919 | ||
|
|
f8735efadf | ||
|
|
00d7395e09 | ||
|
|
150463e629 | ||
|
|
b7bbf0f5eb | ||
|
|
d2790c8b21 | ||
|
|
3d2138d9ce | ||
|
|
e4cf2eee2d | ||
|
|
79551e67f6 | ||
|
|
f5f988e552 | ||
|
|
0c58f469b4 | ||
|
|
56d7dccec9 | ||
|
|
411b63159f | ||
|
|
5ca0beadfb | ||
|
|
aaff3dd075 | ||
|
|
ef2053011d | ||
|
|
e6499a68f6 | ||
|
|
33cb1d5f3c | ||
|
|
5bdebac741 | ||
|
|
510c1644dd | ||
|
|
ec70af9412 | ||
|
|
761a574b09 | ||
|
|
825a9ba893 | ||
|
|
a6d392322a | ||
|
|
1ddf398a81 | ||
|
|
4de6c782cc | ||
|
|
9fef6f909a | ||
|
|
ff466d0f17 | ||
|
|
4c59cff2a3 | ||
|
|
fa44bdb390 | ||
|
|
dd10f37f66 | ||
|
|
3b26678a77 | ||
|
|
f14f75b064 | ||
|
|
ef8e04aee3 | ||
|
|
23df4a09d2 | ||
|
|
eb93113b7a | ||
|
|
c40b0b9ae1 | ||
|
|
61ebec9ff7 | ||
|
|
c567c11267 | ||
|
|
e628615094 | ||
|
|
50f821f9b9 | ||
|
|
15e0a50ff4 | ||
|
|
e52cdfd70a | ||
|
|
c1b514e9d3 | ||
|
|
8983d719bd | ||
|
|
9dd5463e06 | ||
|
|
d5b2ce18cb | ||
|
|
8d627e52cb | ||
|
|
a1b59b6185 | ||
|
|
b73bac62f2 | ||
|
|
ee88af8563 | ||
|
|
f846b31eb8 | ||
|
|
50a0b1d91d | ||
|
|
3d4d66a8c2 | ||
|
|
f3885cadc1 | ||
|
|
2ec2f2538f | ||
|
|
40d8245089 | ||
|
|
d29cc61aa2 | ||
|
|
a2e9e206e8 | ||
|
|
7ae1f768fc | ||
|
|
e692e06acf | ||
|
|
6f80dc5eee | ||
|
|
aa6070624b | ||
|
|
b6c8aa27fa | ||
|
|
3e9ba40a92 | ||
|
|
ab0eabd88c | ||
|
|
4de0a27ed2 | ||
|
|
c37e865c56 | ||
|
|
6523fcae6b | ||
|
|
d7a3ec69d9 | ||
|
|
bb578a2e9d | ||
|
|
d8b33c4e78 | ||
|
|
0e8e3c87f3 | ||
|
|
5e8c20f406 | ||
|
|
4dd40049ab | ||
|
|
c7a8dcf079 | ||
|
|
2869d646b6 | ||
|
|
0e4e1b3316 | ||
|
|
37363a0a8d | ||
|
|
14dc04474c | ||
|
|
5502a9c448 | ||
|
|
e718089802 | ||
|
|
95f7a6a4dc | ||
|
|
7318c22928 | ||
|
|
78aef2b150 | ||
|
|
194181a420 | ||
|
|
2933f07440 | ||
|
|
037457dec9 | ||
|
|
7f665c2fb6 | ||
|
|
ebb2d86ce3 | ||
|
|
6a4442e590 | ||
|
|
157ff4a4b9 | ||
|
|
cc928e6d3f | ||
|
|
6a75800e1b | ||
|
|
c9cecbc461 | ||
|
|
97b1867ea1 | ||
|
|
9bdc1df2df | ||
|
|
9d984aaa30 | ||
|
|
5ed80b5c32 | ||
|
|
df82202178 | ||
|
|
500598666e | ||
|
|
69a9080480 | ||
|
|
b72f50cc4a | ||
|
|
f1a8be3817 | ||
|
|
b34209c9a0 | ||
|
|
a021045dce | ||
|
|
ad45f8dab0 | ||
|
|
3bf5956493 | ||
|
|
d86b536d2f | ||
|
|
e2a25f1b31 | ||
|
|
32ee500c65 | ||
|
|
03d8a263ac | ||
|
|
5b0883ca0d | ||
|
|
31bf9360fd | ||
|
|
c195e467ee | ||
|
|
8975fcd714 | ||
|
|
95b416f092 | ||
|
|
172183f1af | ||
|
|
ee766f6e39 | ||
|
|
1668d58aec | ||
|
|
0d3188914a | ||
|
|
f045c6eb17 | ||
|
|
44d12f8f42 | ||
|
|
ff418a77dc | ||
|
|
3dee207529 | ||
|
|
b6448b9575 | ||
|
|
bfb191b5c7 | ||
|
|
3dd39c59b6 | ||
|
|
e249b920ff | ||
|
|
d920a69f69 | ||
|
|
a8ce888981 | ||
|
|
e22ddc0dd6 | ||
|
|
c370912f12 |
5
.github/dependabot.yml
vendored
5
.github/dependabot.yml
vendored
@@ -70,3 +70,8 @@ updates:
|
||||
applies-to: "version-updates"
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
66
.github/scripts/check_version_consistency.py
vendored
Executable file
66
.github/scripts/check_version_consistency.py
vendored
Executable file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from typing import Set, Tuple
|
||||
|
||||
|
||||
def find_version_references(directory: str) -> Tuple[Set[str], Set[str]]:
|
||||
openhands_versions = set()
|
||||
runtime_versions = set()
|
||||
|
||||
version_pattern_openhands = re.compile(r'openhands:(\d{1})\.(\d{2})')
|
||||
version_pattern_runtime = re.compile(r'runtime:(\d{1})\.(\d{2})')
|
||||
|
||||
for root, _, files in os.walk(directory):
|
||||
# Skip .git directory
|
||||
if '.git' in root:
|
||||
continue
|
||||
|
||||
for file in files:
|
||||
if file.endswith(
|
||||
('.md', '.yml', '.yaml', '.txt', '.html', '.py', '.js', '.ts')
|
||||
):
|
||||
file_path = os.path.join(root, file)
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Find all openhands version references
|
||||
matches = version_pattern_openhands.findall(content)
|
||||
openhands_versions.update(matches)
|
||||
|
||||
# Find all runtime version references
|
||||
matches = version_pattern_runtime.findall(content)
|
||||
runtime_versions.update(matches)
|
||||
except Exception as e:
|
||||
print(f'Error reading {file_path}: {e}', file=sys.stderr)
|
||||
|
||||
return openhands_versions, runtime_versions
|
||||
|
||||
|
||||
def main():
|
||||
repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||
openhands_versions, runtime_versions = find_version_references(repo_root)
|
||||
|
||||
exit_code = 0
|
||||
|
||||
if len(openhands_versions) > 1:
|
||||
print('Error: Multiple openhands versions found:', file=sys.stderr)
|
||||
print('Found versions:', sorted(openhands_versions), file=sys.stderr)
|
||||
exit_code = 1
|
||||
elif len(openhands_versions) == 0:
|
||||
print('Warning: No openhands version references found', file=sys.stderr)
|
||||
|
||||
if len(runtime_versions) > 1:
|
||||
print('Error: Multiple runtime versions found:', file=sys.stderr)
|
||||
print('Found versions:', sorted(runtime_versions), file=sys.stderr)
|
||||
exit_code = 1
|
||||
elif len(runtime_versions) == 0:
|
||||
print('Warning: No runtime version references found', file=sys.stderr)
|
||||
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
2
.github/workflows/dummy-agent-test.yml
vendored
2
.github/workflows/dummy-agent-test.yml
vendored
@@ -36,6 +36,8 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Install tmux
|
||||
run: sudo apt-get update && sudo apt-get install -y tmux
|
||||
- name: Install poetry via pipx
|
||||
run: pipx install poetry
|
||||
- name: Set up Python
|
||||
|
||||
4
.github/workflows/eval-runner.yml
vendored
4
.github/workflows/eval-runner.yml
vendored
@@ -29,6 +29,8 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install tmux
|
||||
run: sudo apt-get update && sudo apt-get install -y tmux
|
||||
- name: Install poetry via pipx
|
||||
run: pipx install poetry
|
||||
|
||||
@@ -129,7 +131,7 @@ jobs:
|
||||
|
||||
- name: Post to a Slack channel
|
||||
id: slack
|
||||
uses: slackapi/slack-github-action@v1.27.0
|
||||
uses: slackapi/slack-github-action@v2.0.0
|
||||
with:
|
||||
channel-id: 'C07SVQSCR6F'
|
||||
slack-message: "*Evaluation Trigger:* ${{ github.event_name == 'pull_request' && format('Pull Request (eval-this label on PR #{0})', github.event.pull_request.number) || github.event_name == 'schedule' && 'Daily Schedule' || format('Manual Trigger: {0}', github.event.inputs.reason) }}\n\nLink to summary: [here](https://github.com/${{ github.repository }}/issues/${{ github.event_name == 'pull_request' && github.event.pull_request.number || 4504 }}#issuecomment-${{ steps.create_comment.outputs.comment-id }})"
|
||||
|
||||
2
.github/workflows/fe-unit-tests.yml
vendored
2
.github/workflows/fe-unit-tests.yml
vendored
@@ -43,6 +43,6 @@ jobs:
|
||||
working-directory: ./frontend
|
||||
run: npm run test:coverage
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@v5
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
8
.github/workflows/ghcr-build.yml
vendored
8
.github/workflows/ghcr-build.yml
vendored
@@ -56,7 +56,7 @@ jobs:
|
||||
docker-images: false
|
||||
swap-storage: true
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3.0.0
|
||||
uses: docker/setup-qemu-action@v3.3.0
|
||||
with:
|
||||
image: tonistiigi/binfmt:latest
|
||||
- name: Login to GHCR
|
||||
@@ -119,7 +119,7 @@ jobs:
|
||||
docker-images: false
|
||||
swap-storage: true
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3.0.0
|
||||
uses: docker/setup-qemu-action@v3.3.0
|
||||
with:
|
||||
image: tonistiigi/binfmt:latest
|
||||
- name: Login to GHCR
|
||||
@@ -293,7 +293,7 @@ jobs:
|
||||
RUN_AS_OPENHANDS=false \
|
||||
poetry run pytest -n 3 -raRs --reruns 2 --reruns-delay 5 --cov=openhands --cov-report=xml -s ./tests/runtime --ignore=tests/runtime/test_browsergym_envs.py
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@v5
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
@@ -370,7 +370,7 @@ jobs:
|
||||
RUN_AS_OPENHANDS=true \
|
||||
poetry run pytest -n 3 -raRs --reruns 2 --reruns-delay 5 --cov=openhands --cov-report=xml -s ./tests/runtime --ignore=tests/runtime/test_browsergym_envs.py
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@v5
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
|
||||
110
.github/workflows/integration-runner.yml
vendored
110
.github/workflows/integration-runner.yml
vendored
@@ -56,6 +56,7 @@ jobs:
|
||||
LLM_MODEL: "litellm_proxy/claude-3-5-haiku-20241022"
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
|
||||
MAX_ITERATIONS: 10
|
||||
run: |
|
||||
echo "[llm.eval]" > config.toml
|
||||
echo "model = \"$LLM_MODEL\"" >> config.toml
|
||||
@@ -70,7 +71,7 @@ jobs:
|
||||
env:
|
||||
SANDBOX_FORCE_REBUILD_RUNTIME: True
|
||||
run: |
|
||||
poetry run ./evaluation/integration_tests/scripts/run_infer.sh llm.eval HEAD CodeActAgent '' $N_PROCESSES '' 'haiku_run'
|
||||
poetry run ./evaluation/integration_tests/scripts/run_infer.sh llm.eval HEAD CodeActAgent '' 10 $N_PROCESSES '' 'haiku_run'
|
||||
|
||||
# get integration tests report
|
||||
REPORT_FILE_HAIKU=$(find evaluation/evaluation_outputs/outputs/integration_tests/CodeActAgent/*haiku*_maxiter_10_N* -name "report.md" -type f | head -n 1)
|
||||
@@ -88,6 +89,7 @@ jobs:
|
||||
LLM_MODEL: "litellm_proxy/deepseek-chat"
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
|
||||
MAX_ITERATIONS: 10
|
||||
run: |
|
||||
echo "[llm.eval]" > config.toml
|
||||
echo "model = \"$LLM_MODEL\"" >> config.toml
|
||||
@@ -99,7 +101,7 @@ jobs:
|
||||
env:
|
||||
SANDBOX_FORCE_REBUILD_RUNTIME: True
|
||||
run: |
|
||||
poetry run ./evaluation/integration_tests/scripts/run_infer.sh llm.eval HEAD CodeActAgent '' $N_PROCESSES '' 'deepseek_run'
|
||||
poetry run ./evaluation/integration_tests/scripts/run_infer.sh llm.eval HEAD CodeActAgent '' 10 $N_PROCESSES '' 'deepseek_run'
|
||||
|
||||
# get integration tests report
|
||||
REPORT_FILE_DEEPSEEK=$(find evaluation/evaluation_outputs/outputs/integration_tests/CodeActAgent/deepseek*_maxiter_10_N* -name "report.md" -type f | head -n 1)
|
||||
@@ -109,11 +111,104 @@ jobs:
|
||||
echo >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# Run DelegatorAgent tests for Haiku, limited to t01 and t02
|
||||
- name: Wait a little bit (again)
|
||||
run: sleep 5
|
||||
|
||||
- name: Configure config.toml for testing DelegatorAgent (Haiku)
|
||||
env:
|
||||
LLM_MODEL: "litellm_proxy/claude-3-5-haiku-20241022"
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
|
||||
MAX_ITERATIONS: 30
|
||||
run: |
|
||||
echo "[llm.eval]" > config.toml
|
||||
echo "model = \"$LLM_MODEL\"" >> config.toml
|
||||
echo "api_key = \"$LLM_API_KEY\"" >> config.toml
|
||||
echo "base_url = \"$LLM_BASE_URL\"" >> config.toml
|
||||
echo "temperature = 0.0" >> config.toml
|
||||
|
||||
- name: Run integration test evaluation for DelegatorAgent (Haiku)
|
||||
env:
|
||||
SANDBOX_FORCE_REBUILD_RUNTIME: True
|
||||
run: |
|
||||
poetry run ./evaluation/integration_tests/scripts/run_infer.sh llm.eval HEAD DelegatorAgent '' 30 $N_PROCESSES "t01_fix_simple_typo,t02_add_bash_hello" 'delegator_haiku_run'
|
||||
|
||||
# Find and export the delegator test results
|
||||
REPORT_FILE_DELEGATOR_HAIKU=$(find evaluation/evaluation_outputs/outputs/integration_tests/DelegatorAgent/*haiku*_maxiter_30_N* -name "report.md" -type f | head -n 1)
|
||||
echo "REPORT_FILE_DELEGATOR_HAIKU: $REPORT_FILE_DELEGATOR_HAIKU"
|
||||
echo "INTEGRATION_TEST_REPORT_DELEGATOR_HAIKU<<EOF" >> $GITHUB_ENV
|
||||
cat $REPORT_FILE_DELEGATOR_HAIKU >> $GITHUB_ENV
|
||||
echo >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
# -------------------------------------------------------------
|
||||
# Run DelegatorAgent tests for DeepSeek, limited to t01 and t02
|
||||
- name: Wait a little bit (again)
|
||||
run: sleep 5
|
||||
|
||||
- name: Configure config.toml for testing DelegatorAgent (DeepSeek)
|
||||
env:
|
||||
LLM_MODEL: "litellm_proxy/deepseek-chat"
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
|
||||
MAX_ITERATIONS: 30
|
||||
run: |
|
||||
echo "[llm.eval]" > config.toml
|
||||
echo "model = \"$LLM_MODEL\"" >> config.toml
|
||||
echo "api_key = \"$LLM_API_KEY\"" >> config.toml
|
||||
echo "base_url = \"$LLM_BASE_URL\"" >> config.toml
|
||||
echo "temperature = 0.0" >> config.toml
|
||||
- name: Run integration test evaluation for DelegatorAgent (DeepSeek)
|
||||
env:
|
||||
SANDBOX_FORCE_REBUILD_RUNTIME: True
|
||||
run: |
|
||||
poetry run ./evaluation/integration_tests/scripts/run_infer.sh llm.eval HEAD DelegatorAgent '' 30 $N_PROCESSES "t01_fix_simple_typo,t02_add_bash_hello" 'delegator_deepseek_run'
|
||||
|
||||
# Find and export the delegator test results
|
||||
REPORT_FILE_DELEGATOR_DEEPSEEK=$(find evaluation/evaluation_outputs/outputs/integration_tests/DelegatorAgent/deepseek*_maxiter_30_N* -name "report.md" -type f | head -n 1)
|
||||
echo "REPORT_FILE_DELEGATOR_DEEPSEEK: $REPORT_FILE_DELEGATOR_DEEPSEEK"
|
||||
echo "INTEGRATION_TEST_REPORT_DELEGATOR_DEEPSEEK<<EOF" >> $GITHUB_ENV
|
||||
cat $REPORT_FILE_DELEGATOR_DEEPSEEK >> $GITHUB_ENV
|
||||
echo >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
# -------------------------------------------------------------
|
||||
# Run VisualBrowsingAgent tests for DeepSeek, limited to t05 and t06
|
||||
- name: Wait a little bit (again)
|
||||
run: sleep 5
|
||||
|
||||
- name: Configure config.toml for testing VisualBrowsingAgent (DeepSeek)
|
||||
env:
|
||||
LLM_MODEL: "litellm_proxy/deepseek-chat"
|
||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
||||
LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
|
||||
MAX_ITERATIONS: 15
|
||||
run: |
|
||||
echo "[llm.eval]" > config.toml
|
||||
echo "model = \"$LLM_MODEL\"" >> config.toml
|
||||
echo "api_key = \"$LLM_API_KEY\"" >> config.toml
|
||||
echo "base_url = \"$LLM_BASE_URL\"" >> config.toml
|
||||
echo "temperature = 0.0" >> config.toml
|
||||
- name: Run integration test evaluation for VisualBrowsingAgent (DeepSeek)
|
||||
env:
|
||||
SANDBOX_FORCE_REBUILD_RUNTIME: True
|
||||
run: |
|
||||
poetry run ./evaluation/integration_tests/scripts/run_infer.sh llm.eval HEAD VisualBrowsingAgent '' 15 $N_PROCESSES "t05_simple_browsing,t06_github_pr_browsing.py" 'visualbrowsing_deepseek_run'
|
||||
|
||||
# Find and export the visual browsing agent test results
|
||||
REPORT_FILE_VISUALBROWSING_DEEPSEEK=$(find evaluation/evaluation_outputs/outputs/integration_tests/VisualBrowsingAgent/deepseek*_maxiter_15_N* -name "report.md" -type f | head -n 1)
|
||||
echo "REPORT_FILE_VISUALBROWSING_DEEPSEEK: $REPORT_FILE_VISUALBROWSING_DEEPSEEK"
|
||||
echo "INTEGRATION_TEST_REPORT_VISUALBROWSING_DEEPSEEK<<EOF" >> $GITHUB_ENV
|
||||
cat $REPORT_FILE_VISUALBROWSING_DEEPSEEK >> $GITHUB_ENV
|
||||
echo >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: Create archive of evaluation outputs
|
||||
run: |
|
||||
TIMESTAMP=$(date +'%y-%m-%d-%H-%M')
|
||||
cd evaluation/evaluation_outputs/outputs # Change to the outputs directory
|
||||
tar -czvf ../../../integration_tests_${TIMESTAMP}.tar.gz integration_tests/CodeActAgent/* # Only include the actual result directories
|
||||
tar -czvf ../../../integration_tests_${TIMESTAMP}.tar.gz integration_tests/CodeActAgent/* integration_tests/DelegatorAgent/* integration_tests/VisualBrowsingAgent/* # Only include the actual result directories
|
||||
|
||||
- name: Upload evaluation results as artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -154,5 +249,14 @@ jobs:
|
||||
**Integration Tests Report (DeepSeek)**
|
||||
DeepSeek LLM Test Results:
|
||||
${{ env.INTEGRATION_TEST_REPORT_DEEPSEEK }}
|
||||
---
|
||||
**Integration Tests Report Delegator (Haiku)**
|
||||
${{ env.INTEGRATION_TEST_REPORT_DELEGATOR_HAIKU }}
|
||||
---
|
||||
**Integration Tests Report Delegator (DeepSeek)**
|
||||
${{ env.INTEGRATION_TEST_REPORT_DELEGATOR_DEEPSEEK }}
|
||||
---
|
||||
**Integration Tests Report VisualBrowsing (DeepSeek)**
|
||||
${{ env.INTEGRATION_TEST_REPORT_VISUALBROWSING_DEEPSEEK }}
|
||||
---
|
||||
Download testing outputs (includes both Haiku and DeepSeek results): [Download](${{ steps.upload_results_artifact.outputs.artifact-url }})
|
||||
|
||||
13
.github/workflows/lint.yml
vendored
13
.github/workflows/lint.yml
vendored
@@ -53,3 +53,16 @@ jobs:
|
||||
run: pip install pre-commit==3.7.0
|
||||
- name: Run pre-commit hooks
|
||||
run: pre-commit run --files openhands/**/* evaluation/**/* tests/**/* --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yaml
|
||||
|
||||
# Check version consistency across documentation
|
||||
check-version-consistency:
|
||||
name: Check version consistency
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.12
|
||||
- name: Run version consistency check
|
||||
run: .github/scripts/check_version_consistency.py
|
||||
|
||||
27
.github/workflows/openhands-resolver.yml
vendored
27
.github/workflows/openhands-resolver.yml
vendored
@@ -84,6 +84,10 @@ jobs:
|
||||
run: |
|
||||
python -m pip index versions openhands-ai > openhands_versions.txt
|
||||
OPENHANDS_VERSION=$(head -n 1 openhands_versions.txt | awk '{print $2}' | tr -d '()')
|
||||
# Ensure requirements.txt ends with newline before appending
|
||||
if [ -f requirements.txt ] && [ -s requirements.txt ]; then
|
||||
sed -i -e '$a\' requirements.txt
|
||||
fi
|
||||
echo "openhands-ai==${OPENHANDS_VERSION}" >> requirements.txt
|
||||
cat requirements.txt
|
||||
|
||||
@@ -100,7 +104,7 @@ jobs:
|
||||
contains(github.event.review.body, '@openhands-agent-exp')
|
||||
)
|
||||
)
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ env.pythonLocation }}/lib/python3.12/site-packages/*
|
||||
key: ${{ runner.os }}-pip-openhands-resolver-${{ hashFiles('requirements.txt') }}
|
||||
@@ -184,14 +188,19 @@ jobs:
|
||||
});
|
||||
|
||||
- name: Install OpenHands
|
||||
id: install_openhands
|
||||
uses: actions/github-script@v7
|
||||
env:
|
||||
COMMENT_BODY: ${{ github.event.comment.body || '' }}
|
||||
REVIEW_BODY: ${{ github.event.review.body || '' }}
|
||||
LABEL_NAME: ${{ github.event.label.name || '' }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
with:
|
||||
script: |
|
||||
const commentBody = `${{ github.event.comment.body || '' }}`.trim();
|
||||
const reviewBody = `${{ github.event.review.body || '' }}`.trim();
|
||||
const labelName = `${{ github.event.label.name || '' }}`.trim();
|
||||
const eventName = `${{ github.event_name }}`.trim();
|
||||
|
||||
const commentBody = process.env.COMMENT_BODY.trim();
|
||||
const reviewBody = process.env.REVIEW_BODY.trim();
|
||||
const labelName = process.env.LABEL_NAME.trim();
|
||||
const eventName = process.env.EVENT_NAME.trim();
|
||||
// Check conditions
|
||||
const isExperimentalLabel = labelName === "fix-me-experimental";
|
||||
const isIssueCommentExperimental =
|
||||
@@ -200,6 +209,9 @@ jobs:
|
||||
const isReviewCommentExperimental =
|
||||
eventName === "pull_request_review" && reviewBody.includes("@openhands-agent-exp");
|
||||
|
||||
// Set output variable
|
||||
core.setOutput('isExperimental', isExperimentalLabel || isIssueCommentExperimental || isReviewCommentExperimental);
|
||||
|
||||
// Perform package installation
|
||||
if (isExperimentalLabel || isIssueCommentExperimental || isReviewCommentExperimental) {
|
||||
console.log("Installing experimental OpenHands...");
|
||||
@@ -225,7 +237,8 @@ jobs:
|
||||
--issue-number ${{ env.ISSUE_NUMBER }} \
|
||||
--issue-type ${{ env.ISSUE_TYPE }} \
|
||||
--max-iterations ${{ env.MAX_ITERATIONS }} \
|
||||
--comment-id ${{ env.COMMENT_ID }}
|
||||
--comment-id ${{ env.COMMENT_ID }} \
|
||||
--is-experimental ${{ steps.install_openhands.outputs.isExperimental }}
|
||||
|
||||
- name: Check resolution result
|
||||
id: check_result
|
||||
|
||||
4
.github/workflows/py-unit-tests-mac.yml
vendored
4
.github/workflows/py-unit-tests-mac.yml
vendored
@@ -31,6 +31,8 @@ jobs:
|
||||
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
|
||||
@@ -91,6 +93,6 @@ jobs:
|
||||
- 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@v4
|
||||
uses: codecov/codecov-action@v5
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
4
.github/workflows/py-unit-tests.yml
vendored
4
.github/workflows/py-unit-tests.yml
vendored
@@ -30,6 +30,8 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Install tmux
|
||||
run: sudo apt-get update && sudo apt-get install -y tmux
|
||||
- name: Install poetry via pipx
|
||||
run: pipx install poetry
|
||||
- name: Set up Python
|
||||
@@ -44,6 +46,6 @@ jobs:
|
||||
- name: Run Tests
|
||||
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
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@v5
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
2
.github/workflows/run-eval.yml
vendored
2
.github/workflows/run-eval.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout PR branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -176,6 +176,7 @@ evaluation/gorilla/data
|
||||
evaluation/toolqa/data
|
||||
evaluation/scienceagentbench/benchmark
|
||||
evaluation/commit0_bench/repos
|
||||
evaluation/visualcodebench/
|
||||
|
||||
# openhands resolver
|
||||
output/
|
||||
|
||||
42
.openhands/microagents/repo.md
Normal file
42
.openhands/microagents/repo.md
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
name: repo
|
||||
type: repo
|
||||
agent: CodeActAgent
|
||||
---
|
||||
This repository contains the code for OpenHands, an automated AI software engineer. It has a Python backend
|
||||
(in the `openhands` directory) and React frontend (in the `frontend` directory).
|
||||
|
||||
## General Setup:
|
||||
To set up the entire repo, including frontend and backend, run `make build`.
|
||||
You don't need to do this unless the user asks you to, or if you're trying to run the entire application.
|
||||
|
||||
Before pushing any changes, you should ensure that any lint errors or simple test errors have been fixed.
|
||||
|
||||
* If you've made changes to the backend, you should run `pre-commit run --all-files --config ./dev_config/python/.pre-commit-config.yaml`
|
||||
* If you've made changes to the frontend, you should run `cd frontend && npm run lint:fix && npm run build ; cd ..`
|
||||
|
||||
If either command fails, it may have automatically fixed some issues. You should fix any issues that weren't automatically fixed,
|
||||
then re-run the command to ensure it passes.
|
||||
|
||||
## Repository Structure
|
||||
Backend:
|
||||
- Located in the `openhands` directory
|
||||
- Testing:
|
||||
- All tests are in `tests/unit/test_*.py`
|
||||
- To test new code, run `poetry run pytest tests/unit/test_xxx.py` where `xxx` is the appropriate file for the current functionality
|
||||
- Write all tests with pytest
|
||||
|
||||
Frontend:
|
||||
- Located in the `frontend` directory
|
||||
- Prerequisites: A recent version of NodeJS / NPM
|
||||
- Setup: Run `npm install` in the frontend directory
|
||||
- Testing:
|
||||
- Run tests: `npm run test`
|
||||
- To run specific tests: `npm run test -- -t "TestName"`
|
||||
- Building:
|
||||
- Build for production: `npm run build`
|
||||
- Environment Variables:
|
||||
- Set in `frontend/.env` or as environment variables
|
||||
- Available variables: VITE_BACKEND_HOST, VITE_USE_TLS, VITE_INSECURE_SKIP_VERIFY, VITE_FRONTEND_PORT
|
||||
- Internationalization:
|
||||
- Generate i18n declaration file: `npm run make-i18n`
|
||||
@@ -1,28 +0,0 @@
|
||||
OpenHands is an automated AI software engineer. It is a repo with a Python backend
|
||||
(in the `openhands` directory) and TypeScript frontend (in the `frontend` directory).
|
||||
|
||||
General Setup:
|
||||
- To set up the entire repo, including frontend and backend, run `make build`
|
||||
- To run linting and type-checking before finishing the job, run `poetry run pre-commit run --all-files --config ./dev_config/python/.pre-commit-config.yaml`
|
||||
|
||||
Backend:
|
||||
- Located in the `openhands` directory
|
||||
- Testing:
|
||||
- All tests are in `tests/unit/test_*.py`
|
||||
- To test new code, run `poetry run pytest tests/unit/test_xxx.py` where `xxx` is the appropriate file for the current functionality
|
||||
- Write all tests with pytest
|
||||
|
||||
Frontend:
|
||||
- Located in the `frontend` directory
|
||||
- Prerequisites: A recent version of NodeJS / NPM
|
||||
- Setup: Run `npm install` in the frontend directory
|
||||
- Testing:
|
||||
- Run tests: `npm run test`
|
||||
- To run specific tests: `npm run test -- -t "TestName"`
|
||||
- Building:
|
||||
- Build for production: `npm run build`
|
||||
- Environment Variables:
|
||||
- Set in `frontend/.env` or as environment variables
|
||||
- Available variables: VITE_BACKEND_HOST, VITE_USE_TLS, VITE_INSECURE_SKIP_VERIFY, VITE_FRONTEND_PORT
|
||||
- Internationalization:
|
||||
- Generate i18n declaration file: `npm run make-i18n`
|
||||
@@ -18,24 +18,24 @@ diverse, inclusive, and healthy community.
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Demonstrating empathy and kindness toward other people.
|
||||
* Being respectful of differing opinions, viewpoints, and experiences.
|
||||
* Giving and gracefully accepting constructive feedback.
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
and learning from the experience.
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
community.
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
any kind.
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks.
|
||||
* Public or private harassment.
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
without their explicit permission.
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
professional setting.
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
@@ -61,7 +61,7 @@ representative at an online or offline event.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
contact@all-hands.dev
|
||||
contact@all-hands.dev.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
@@ -113,6 +113,20 @@ individual, or aggression toward or disparagement of classes of individuals.
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
### Slack and Discord Etiquettes
|
||||
|
||||
These Slack and Discord etiquette guidelines are designed to foster an inclusive, respectful, and productive environment for all community members. By following these best practices, we ensure effective communication and collaboration while minimizing disruptions. Let’s work together to build a supportive and welcoming community!
|
||||
|
||||
- Communicate respectfully and professionally, avoiding sarcasm or harsh language, and remember that tone can be difficult to interpret in text.
|
||||
- Use threads for specific discussions to keep channels organized and easier to follow.
|
||||
- Tag others only when their input is critical or urgent, and use @here, @channel or @everyone sparingly to minimize disruptions.
|
||||
- Be patient, as open-source contributors and maintainers often have other commitments and may need time to respond.
|
||||
- Post questions or discussions in the most relevant channel (e.g., for [slack - #general](https://app.slack.com/client/T06P212QSEA/C06P5NCGSFP) for general topics, [slack - #questions](https://openhands-ai.slack.com/archives/C06U8UTKSAD) for queries/questions, [discord - #general](https://discord.com/channels/1222935860639563850/1222935861386018885)).
|
||||
- When asking for help or raising issues, include necessary details like links, screenshots, or clear explanations to provide context.
|
||||
- Keep discussions in public channels whenever possible to allow others to benefit from the conversation, unless the matter is sensitive or private.
|
||||
- Always adhere to [our standards](https://github.com/All-Hands-AI/OpenHands/blob/main/CODE_OF_CONDUCT.md#our-standards) to ensure a welcoming and collaborative environment.
|
||||
- If you choose to mute a channel, consider setting up alerts for topics that still interest you to stay engaged. For Slack, Go to Settings → Notifications → My Keywords to add specific keywords that will notify you when mentioned. For example, if you're here for discussions about LLMs, mute the channel if it’s too busy, but set notifications to alert you only when “LLMs” appears in messages. Also for Discord, go to the channel notifications and choose the option that best describes your need.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
|
||||
@@ -11,11 +11,11 @@ To understand the codebase, please refer to the README in each module:
|
||||
- [agenthub](./openhands/agenthub/README.md)
|
||||
- [server](./openhands/server/README.md)
|
||||
|
||||
## Setting up your development environment
|
||||
## Setting up Your Development Environment
|
||||
|
||||
We have a separate doc [Development.md](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md) that tells you how to set up a development workflow.
|
||||
|
||||
## How can I contribute?
|
||||
## How Can I Contribute?
|
||||
|
||||
There are many ways that you can contribute:
|
||||
|
||||
@@ -23,7 +23,7 @@ There are many ways that you can contribute:
|
||||
2. **Send feedback** after each session by [clicking the thumbs-up thumbs-down buttons](https://docs.all-hands.dev/modules/usage/feedback), so we can see where things are working and failing, and also build an open dataset for training code agents.
|
||||
3. **Improve the Codebase** by sending [PRs](#sending-pull-requests-to-openhands) (see details below). In particular, we have some [good first issues](https://github.com/All-Hands-AI/OpenHands/labels/good%20first%20issue) that may be ones to start on.
|
||||
|
||||
## What can I build?
|
||||
## What Can I Build?
|
||||
Here are a few ways you can help improve the codebase.
|
||||
|
||||
#### UI/UX
|
||||
@@ -35,7 +35,7 @@ of the application, please open an issue first, or better, join the #frontend ch
|
||||
to gather consensus from our design team first.
|
||||
|
||||
#### Improving the agent
|
||||
Our main agent is the CodeAct agent. You can [see its prompts here](https://github.com/All-Hands-AI/OpenHands/tree/main/openhands/agenthub/codeact_agent)
|
||||
Our main agent is the CodeAct agent. You can [see its prompts here](https://github.com/All-Hands-AI/OpenHands/tree/main/openhands/agenthub/codeact_agent).
|
||||
|
||||
Changes to these prompts, and to the underlying behavior in Python, can have a huge impact on user experience.
|
||||
You can try modifying the prompts to see how they change the behavior of the agent as you use the app
|
||||
@@ -63,7 +63,7 @@ At the moment, we have two kinds of tests: [`unit`](./tests/unit) and [`integrat
|
||||
## Sending Pull Requests to OpenHands
|
||||
|
||||
You'll need to fork our repository to send us a Pull Request. You can learn more
|
||||
about how to fork a GitHub repo and open a PR with your changes in [this article](https://medium.com/swlh/forks-and-pull-requests-how-to-contribute-to-github-repos-8843fac34ce8)
|
||||
about how to fork a GitHub repo and open a PR with your changes in [this article](https://medium.com/swlh/forks-and-pull-requests-how-to-contribute-to-github-repos-8843fac34ce8).
|
||||
|
||||
### Pull Request title
|
||||
As described [here](https://github.com/commitizen/conventional-commit-types/blob/master/index.json), a valid PR title should begin with one of the following prefixes:
|
||||
@@ -103,7 +103,7 @@ Further, if you see an issue you like, please leave a "thumbs-up" or a comment,
|
||||
|
||||
### Making Pull Requests
|
||||
|
||||
We're generally happy to consider all [PRs](https://github.com/All-Hands-AI/OpenHands/pulls), with the evaluation process varying based on the type of change:
|
||||
We're generally happy to consider all pull requests with the evaluation process varying based on the type of change:
|
||||
|
||||
#### For Small Improvements
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ This guide is for people working on OpenHands and editing the source code.
|
||||
If you wish to contribute your changes, check out the [CONTRIBUTING.md](https://github.com/All-Hands-AI/OpenHands/blob/main/CONTRIBUTING.md) on how to clone and setup the project initially before moving on.
|
||||
Otherwise, you can clone the OpenHands project directly.
|
||||
|
||||
## Start the server for development
|
||||
## Start the Server for Development
|
||||
### 1. Requirements
|
||||
* Linux, Mac OS, or [WSL on Windows](https://learn.microsoft.com/en-us/windows/wsl/install) [Ubuntu <= 22.04]
|
||||
* Linux, Mac OS, or [WSL on Windows](https://learn.microsoft.com/en-us/windows/wsl/install) [Ubuntu >= 22.04]
|
||||
* [Docker](https://docs.docker.com/engine/install/) (For those on MacOS, make sure to allow the default Docker socket to be used from advanced settings!)
|
||||
* [Python](https://www.python.org/downloads/) = 3.12
|
||||
* [NodeJS](https://nodejs.org/en/download/package-manager) >= 18.17.1
|
||||
* [NodeJS](https://nodejs.org/en/download/package-manager) >= 20.x
|
||||
* [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer) >= 1.8
|
||||
* OS-specific dependencies:
|
||||
- Ubuntu: build-essential => `sudo apt-get install build-essential`
|
||||
@@ -58,7 +58,7 @@ See [our documentation](https://docs.all-hands.dev/modules/usage/llms) for recom
|
||||
|
||||
### 4. Running the application
|
||||
#### Option A: Run the Full Application
|
||||
Once the setup is complete, launching OpenHands is as simple as running a single command. This command starts both the backend and frontend servers seamlessly, allowing you to interact with OpenHands:
|
||||
Once the setup is complete, this command starts both the backend and frontend servers, allowing you to interact with OpenHands:
|
||||
```bash
|
||||
make run
|
||||
```
|
||||
@@ -75,11 +75,11 @@ make run
|
||||
```
|
||||
|
||||
### 6. LLM Debugging
|
||||
If you encounter any issues with the Language Model (LM) or you're simply curious, you can inspect the actual LLM prompts and responses. To do so, export DEBUG=1 in the environment and restart the backend.
|
||||
OpenHands will then log the prompts and responses in the logs/llm/CURRENT_DATE directory, allowing you to identify the causes.
|
||||
If you encounter any issues with the Language Model (LM) or you're simply curious, export DEBUG=1 in the environment and restart the backend.
|
||||
OpenHands will log the prompts and responses in the logs/llm/CURRENT_DATE directory, allowing you to identify the causes.
|
||||
|
||||
### 7. Help
|
||||
Need assistance or information on available targets and commands? The help command provides all the necessary guidance to ensure a smooth experience with OpenHands.
|
||||
Need help or info on available targets and commands? Use the help command for all the guidance you need with OpenHands.
|
||||
```bash
|
||||
make help
|
||||
```
|
||||
@@ -93,14 +93,14 @@ poetry run pytest ./tests/unit/test_*.py
|
||||
```
|
||||
|
||||
### 9. Add or update dependency
|
||||
1. Add your dependency in `pyproject.toml` or use `poetry add xxx`
|
||||
2. Update the poetry.lock file via `poetry lock --no-update`
|
||||
1. Add your dependency in `pyproject.toml` or use `poetry add xxx`.
|
||||
2. Update the poetry.lock file via `poetry lock --no-update`.
|
||||
|
||||
### 9. Use existing Docker image
|
||||
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.
|
||||
|
||||
Example: `export SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:0.16-nikolaik`
|
||||
Example: `export SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:0.21-nikolaik`
|
||||
|
||||
## Develop inside Docker container
|
||||
|
||||
@@ -110,7 +110,7 @@ TL;DR
|
||||
make docker-dev
|
||||
```
|
||||
|
||||
See more details [here](./containers/dev/README.md)
|
||||
See more details [here](./containers/dev/README.md).
|
||||
|
||||
If you are just interested in running `OpenHands` without installing all the required tools on your host.
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
These are the procedures and guidelines on how issues are triaged in this repo by the maintainers.
|
||||
|
||||
## General
|
||||
* Most issues must be tagged with **enhancement** or **bug**
|
||||
* Issues may be tagged with what it relates to (**backend**, **frontend**, **agent quality**, etc.)
|
||||
* Most issues must be tagged with **enhancement** or **bug**.
|
||||
* Issues may be tagged with what it relates to (**backend**, **frontend**, **agent quality**, etc.).
|
||||
|
||||
## Severity
|
||||
* **Low**: Minor issues or affecting single user.
|
||||
@@ -11,10 +11,10 @@ These are the procedures and guidelines on how issues are triaged in this repo b
|
||||
* **Critical**: Affecting all users or potential security issues.
|
||||
|
||||
## Effort
|
||||
* Issues may be estimated with effort required (**small effort**, **medium effort**, **large effort**)
|
||||
* Issues may be estimated with effort required (**small effort**, **medium effort**, **large effort**).
|
||||
|
||||
## Difficulty
|
||||
* Issues with low implementation difficulty may be tagged with **good first issue**
|
||||
* Issues with low implementation difficulty may be tagged with **good first issue**.
|
||||
|
||||
## Not Enough Information
|
||||
* User is asked to provide more information (logs, how to reproduce, etc.) when the issue is not clear.
|
||||
|
||||
8
Makefile
8
Makefile
@@ -81,10 +81,10 @@ check-nodejs:
|
||||
@if command -v node > /dev/null; then \
|
||||
NODE_VERSION=$(shell node --version | sed -E 's/v//g'); \
|
||||
IFS='.' read -r -a NODE_VERSION_ARRAY <<< "$$NODE_VERSION"; \
|
||||
if [ "$${NODE_VERSION_ARRAY[0]}" -gt 18 ] || ([ "$${NODE_VERSION_ARRAY[0]}" -eq 18 ] && [ "$${NODE_VERSION_ARRAY[1]}" -gt 17 ]) || ([ "$${NODE_VERSION_ARRAY[0]}" -eq 18 ] && [ "$${NODE_VERSION_ARRAY[1]}" -eq 17 ] && [ "$${NODE_VERSION_ARRAY[2]}" -ge 1 ]); then \
|
||||
if [ "$${NODE_VERSION_ARRAY[0]}" -ge 20 ]; then \
|
||||
echo "$(BLUE)Node.js $$NODE_VERSION is already installed.$(RESET)"; \
|
||||
else \
|
||||
echo "$(RED)Node.js 18.17.1 or later is required. Please install Node.js 18.17.1 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; \
|
||||
fi; \
|
||||
else \
|
||||
@@ -106,7 +106,7 @@ check-poetry:
|
||||
@if command -v poetry > /dev/null; then \
|
||||
POETRY_VERSION=$(shell poetry --version 2>&1 | sed -E 's/Poetry \(version ([0-9]+\.[0-9]+\.[0-9]+)\)/\1/'); \
|
||||
IFS='.' read -r -a POETRY_VERSION_ARRAY <<< "$$POETRY_VERSION"; \
|
||||
if [ $${POETRY_VERSION_ARRAY[0]} -ge 1 ] && [ $${POETRY_VERSION_ARRAY[1]} -ge 8 ]; then \
|
||||
if [ $${POETRY_VERSION_ARRAY[0]} -gt 1 ] || ([ $${POETRY_VERSION_ARRAY[0]} -eq 1 ] && [ $${POETRY_VERSION_ARRAY[1]} -ge 8 ]); then \
|
||||
echo "$(BLUE)$(shell poetry --version) is already installed.$(RESET)"; \
|
||||
else \
|
||||
echo "$(RED)Poetry 1.8 or later is required. You can install poetry by running the following command, then adding Poetry to your PATH:"; \
|
||||
@@ -190,7 +190,7 @@ build-frontend:
|
||||
# Start backend
|
||||
start-backend:
|
||||
@echo "$(YELLOW)Starting backend...$(RESET)"
|
||||
@poetry run uvicorn openhands.server.listen:app --host $(BACKEND_HOST) --port $(BACKEND_PORT) --reload --reload-exclude "$(shell pwd)/workspace"
|
||||
@poetry run uvicorn openhands.server.listen:app --host $(BACKEND_HOST) --port $(BACKEND_PORT) --reload --reload-exclude "./workspace"
|
||||
|
||||
# Start frontend
|
||||
start-frontend:
|
||||
|
||||
20
README.md
20
README.md
@@ -39,21 +39,21 @@ Learn more at [docs.all-hands.dev](https://docs.all-hands.dev), or jump to the [
|
||||
## ⚡ Quick Start
|
||||
|
||||
The easiest way to run OpenHands is in Docker.
|
||||
See the [Installation](https://docs.all-hands.dev/modules/usage/installation) guide for
|
||||
See the [Running OpenHands](https://docs.all-hands.dev/modules/usage/installation) guide for
|
||||
system requirements and more information.
|
||||
|
||||
```bash
|
||||
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.16-nikolaik
|
||||
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik
|
||||
|
||||
docker run -it --rm --pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.16-nikolaik \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e LOG_ALL_EVENTS=true \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v ~/.openhands:/home/openhands/.openhands \
|
||||
-v ~/.openhands-state:/.openhands-state \
|
||||
-p 3000:3000 \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app \
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.16
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.21
|
||||
```
|
||||
|
||||
You'll find OpenHands running at [http://localhost:3000](http://localhost:3000)!
|
||||
@@ -64,16 +64,16 @@ works best, but you have [many options](https://docs.all-hands.dev/modules/usage
|
||||
|
||||
---
|
||||
|
||||
You can also [connect OpenHands to your local filesystem](https://docs.all-hands.dev/modules/usage/runtimes),
|
||||
You can also [connect OpenHands to your local filesystem](https://docs.all-hands.dev/modules/usage/runtimes#connecting-to-your-filesystem),
|
||||
run OpenHands in a scriptable [headless mode](https://docs.all-hands.dev/modules/usage/how-to/headless-mode),
|
||||
interact with it via a [friendly CLI](https://docs.all-hands.dev/modules/usage/how-to/cli-mode),
|
||||
or run it on tagged issues with [a github action](https://github.com/All-Hands-AI/OpenHands/blob/main/openhands/resolver/README.md).
|
||||
or run it on tagged issues with [a github action](https://docs.all-hands.dev/modules/usage/how-to/github-action).
|
||||
|
||||
Visit [Installation](https://docs.all-hands.dev/modules/usage/installation) for more information and setup instructions.
|
||||
Visit [Running OpenHands](https://docs.all-hands.dev/modules/usage/installation) for more information and setup instructions.
|
||||
|
||||
> [!CAUTION]
|
||||
> OpenHands is meant to be run by a single user on their local workstation.
|
||||
> It is not appropriate for multi-tenant deployments, where multiple users share the same instance--there is no built-in isolation or scalability.
|
||||
> It is not appropriate for multi-tenant deployments where multiple users share the same instance. There is no built-in isolation or scalability.
|
||||
>
|
||||
> If you're interested in running OpenHands in a multi-tenant environment, please
|
||||
> [get in touch with us](https://docs.google.com/forms/d/e/1FAIpQLSet3VbGaz8z32gW9Wm-Grl4jpt5WgMXPgJ4EDPVmCETCBpJtQ/viewform)
|
||||
@@ -86,7 +86,7 @@ Having issues? The [Troubleshooting Guide](https://docs.all-hands.dev/modules/us
|
||||
## 📖 Documentation
|
||||
|
||||
To learn more about the project, and for tips on using OpenHands,
|
||||
**check out our [documentation](https://docs.all-hands.dev/modules/usage/getting-started)**.
|
||||
check out our [documentation](https://docs.all-hands.dev/modules/usage/getting-started).
|
||||
|
||||
There you'll find resources on how to use different LLM providers,
|
||||
troubleshooting resources, and advanced configuration options.
|
||||
|
||||
@@ -23,6 +23,9 @@ workspace_base = "./workspace"
|
||||
# Cache directory path
|
||||
#cache_dir = "/tmp/cache"
|
||||
|
||||
# Reasoning effort for o1 models (low, medium, high, or not set)
|
||||
#reasoning_effort = "medium"
|
||||
|
||||
# Debugging enabled
|
||||
#debug = false
|
||||
|
||||
@@ -34,7 +37,12 @@ workspace_base = "./workspace"
|
||||
|
||||
# Path to store trajectories, can be a folder or a file
|
||||
# If it's a folder, the session id will be used as the file name
|
||||
#trajectories_path="./trajectories"
|
||||
#save_trajectory_path="./trajectories"
|
||||
|
||||
# Path to replay a trajectory, must be a file path
|
||||
# If provided, trajectory will be loaded and replayed before the
|
||||
# agent responds to any user instruction
|
||||
#replay_trajectory_path = ""
|
||||
|
||||
# File store path
|
||||
#file_store_path = "/tmp/file_store"
|
||||
@@ -67,7 +75,7 @@ workspace_base = "./workspace"
|
||||
#run_as_openhands = true
|
||||
|
||||
# Runtime environment
|
||||
#runtime = "eventstream"
|
||||
#runtime = "docker"
|
||||
|
||||
# Name of the default agent
|
||||
#default_agent = "CodeActAgent"
|
||||
@@ -180,6 +188,12 @@ model = "gpt-4o"
|
||||
# https://docs.litellm.ai/docs/completion/token_usage
|
||||
#custom_tokenizer = ""
|
||||
|
||||
# Whether to use native tool calling if supported by the model. Can be true, false, or None by default, which chooses the model's default behavior based on the evaluation.
|
||||
# ATTENTION: Based on evaluation, enabling native function calling may lead to worse results
|
||||
# in some scenarios. Use with caution and consider testing with your specific use case.
|
||||
# https://github.com/All-Hands-AI/OpenHands/pull/4711
|
||||
#native_tool_calling = None
|
||||
|
||||
[llm.gpt4o-mini]
|
||||
api_key = "your-api-key"
|
||||
model = "gpt-4o"
|
||||
@@ -192,6 +206,16 @@ model = "gpt-4o"
|
||||
# agent.CodeActAgent
|
||||
##############################################################################
|
||||
[agent]
|
||||
|
||||
# whether the browsing tool is enabled
|
||||
codeact_enable_browsing = true
|
||||
|
||||
# whether the LLM draft editor is enabled
|
||||
codeact_enable_llm_editor = false
|
||||
|
||||
# whether the IPython tool is enabled
|
||||
codeact_enable_jupyter = true
|
||||
|
||||
# Name of the micro agent to use for this agent
|
||||
#micro_agent_name = ""
|
||||
|
||||
@@ -204,6 +228,12 @@ model = "gpt-4o"
|
||||
# LLM config group to use
|
||||
#llm_config = 'your-llm-config-group'
|
||||
|
||||
# Whether to use prompt extension (e.g., microagent, repo/runtime info) at all
|
||||
#enable_prompt_extensions = true
|
||||
|
||||
# List of microagents to disable
|
||||
#disabled_microagents = []
|
||||
|
||||
[agent.RepoExplorerAgent]
|
||||
# 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
|
||||
|
||||
@@ -43,7 +43,8 @@ ENV WORKSPACE_BASE=/opt/workspace_base
|
||||
ENV OPENHANDS_BUILD_VERSION=$OPENHANDS_BUILD_VERSION
|
||||
ENV SANDBOX_USER_ID=0
|
||||
ENV FILE_STORE=local
|
||||
ENV FILE_STORE_PATH=~/.openhands
|
||||
ENV FILE_STORE_PATH=/.openhands-state
|
||||
RUN mkdir -p $FILE_STORE_PATH
|
||||
RUN mkdir -p $WORKSPACE_BASE
|
||||
|
||||
RUN apt-get update -y \
|
||||
@@ -70,6 +71,7 @@ ENV VIRTUAL_ENV=/app/.venv \
|
||||
COPY --chown=openhands:app --chmod=770 --from=backend-builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
||||
RUN playwright install --with-deps chromium
|
||||
|
||||
COPY --chown=openhands:app --chmod=770 ./microagents ./microagents
|
||||
COPY --chown=openhands:app --chmod=770 ./openhands ./openhands
|
||||
COPY --chown=openhands:app --chmod=777 ./openhands/runtime/plugins ./openhands/runtime/plugins
|
||||
COPY --chown=openhands:app --chmod=770 ./openhands/agenthub ./openhands/agenthub
|
||||
|
||||
@@ -11,7 +11,7 @@ services:
|
||||
- BACKEND_HOST=${BACKEND_HOST:-"0.0.0.0"}
|
||||
- SANDBOX_API_HOSTNAME=host.docker.internal
|
||||
#
|
||||
- SANDBOX_RUNTIME_CONTAINER_IMAGE=${SANDBOX_RUNTIME_CONTAINER_IMAGE:-ghcr.io/all-hands-ai/runtime:0.16-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}
|
||||
- WORKSPACE_MOUNT_PATH=${WORKSPACE_BASE:-$PWD/workspace}
|
||||
ports:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#
|
||||
|
||||
services:
|
||||
openhands:
|
||||
build:
|
||||
@@ -7,8 +7,8 @@ services:
|
||||
image: openhands:latest
|
||||
container_name: openhands-app-${DATE:-}
|
||||
environment:
|
||||
- SANDBOX_RUNTIME_CONTAINER_IMAGE=${SANDBOX_RUNTIME_CONTAINER_IMAGE:-ghcr.io/all-hands-ai/runtime:0.16-nikolaik}
|
||||
- SANDBOX_USER_ID=${SANDBOX_USER_ID:-1234}
|
||||
- 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
|
||||
- WORKSPACE_MOUNT_PATH=${WORKSPACE_BASE:-$PWD/workspace}
|
||||
ports:
|
||||
- "3000:3000"
|
||||
@@ -16,6 +16,7 @@ services:
|
||||
- "host.docker.internal:host-gateway"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ~/.openhands-state:/.openhands-state
|
||||
- ${WORKSPACE_BASE:-$PWD/workspace}:/opt/workspace_base
|
||||
pull_policy: build
|
||||
stdin_open: true
|
||||
48
docs/DOC_STYLE_GUIDE.md
Normal file
48
docs/DOC_STYLE_GUIDE.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# Documentation Style Guide
|
||||
|
||||
## General Writing Principles
|
||||
|
||||
- **Clarity & Conciseness**: Always prioritize clarity and brevity. Avoid unnecessary jargon or overly complex explanations.
|
||||
Keep sentences short and to the point.
|
||||
- **Gradual Complexity**: Start with the simplest, most basic setup, and then gradually introduce more advanced
|
||||
concepts and configurations.
|
||||
|
||||
## Formatting Guidelines
|
||||
|
||||
### Headers
|
||||
|
||||
Use **Title Case** for the first and second level headers.
|
||||
|
||||
Example:
|
||||
- **Basic Usage**
|
||||
- **Advanced Configuration Options**
|
||||
|
||||
### Lists
|
||||
|
||||
When listing items or options, use bullet points to enhance readability.
|
||||
|
||||
Example:
|
||||
- Option A
|
||||
- Option B
|
||||
- Option C
|
||||
|
||||
### Procedures
|
||||
|
||||
For instructions or processes that need to be followed in a specific order, use numbered steps.
|
||||
|
||||
Example:
|
||||
1. Step one: Do this.
|
||||
2. Step two: Complete this action.
|
||||
3. Step three: Verify the result.
|
||||
|
||||
### Code Blocks
|
||||
|
||||
* Use code blocks for multi-line inputs, outputs, commands and code samples.
|
||||
|
||||
Example:
|
||||
```bash
|
||||
docker run -it \
|
||||
-e THIS=this \
|
||||
-e THAT=that
|
||||
...
|
||||
```
|
||||
@@ -1,42 +1,21 @@
|
||||
# 📚 Divers
|
||||
|
||||
## ⭐️ Stratégie de recherche
|
||||
|
||||
# À propos d'OpenHands
|
||||
|
||||
## Stratégie de recherche
|
||||
|
||||
La réplication complète d'applications de niveau production avec des LLM est une entreprise complexe. Notre stratégie implique :
|
||||
|
||||
1. **Recherche technique fondamentale :** Se concentrer sur la recherche fondamentale pour comprendre et améliorer les aspects techniques de la génération et de la gestion de code
|
||||
2. **Capacités spécialisées :** Améliorer l'efficacité des composants de base grâce à la curation de données, aux méthodes d'entraînement, etc.
|
||||
3. **Planification des tâches :** Développer des capacités de détection de bugs, de gestion de base de code et d'optimisation
|
||||
1. **Recherche technique fondamentale :** Se concentrer sur la recherche fondamentale pour comprendre et améliorer les aspects techniques de la génération et de la gestion du code
|
||||
2. **Capacités spécialisées :** Améliorer l'efficacité des composants de base grâce à la curation des données, aux méthodes d'entraînement, et plus encore
|
||||
3. **Planification des tâches :** Développer des capacités pour la détection des bugs, la gestion des bases de code et l'optimisation
|
||||
4. **Évaluation :** Établir des métriques d'évaluation complètes pour mieux comprendre et améliorer nos modèles
|
||||
|
||||
## 🚧 Agent par défaut
|
||||
## Agent par défaut
|
||||
|
||||
Notre Agent par défaut est actuellement le [CodeActAgent](agents), qui est capable de générer du code et de gérer des fichiers.
|
||||
|
||||
## 🤝 Comment contribuer
|
||||
|
||||
OpenHands est un projet communautaire et nous accueillons les contributions de tous. Que vous soyez développeur, chercheur ou simplement enthousiaste à l'idée de faire progresser le domaine de l'ingénierie logicielle avec l'IA, il existe de nombreuses façons de s'impliquer :
|
||||
|
||||
- **Contributions de code :** Aidez-nous à développer les fonctionnalités de base, l'interface frontend ou les solutions de sandboxing
|
||||
- **Recherche et évaluation :** Contribuez à notre compréhension des LLM dans l'ingénierie logicielle, participez à l'évaluation des modèles ou suggérez des améliorations
|
||||
- **Retours et tests :** Utilisez la boîte à outils OpenHands, signalez des bugs, suggérez des fonctionnalités ou donnez votre avis sur la facilité d'utilisation
|
||||
|
||||
Pour plus de détails, veuillez consulter [ce document](https://github.com/All-Hands-AI/OpenHands/blob/main/CONTRIBUTING.md).
|
||||
|
||||
## 🤖 Rejoignez notre communauté
|
||||
|
||||
Nous avons à la fois un espace de travail Slack pour la collaboration sur la construction d'OpenHands et un serveur Discord pour discuter de tout ce qui est lié, par exemple, à ce projet, LLM, agent, etc.
|
||||
|
||||
- [Espace de travail Slack](https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw)
|
||||
- [Serveur Discord](https://discord.gg/ESHStjSjD4)
|
||||
|
||||
Si vous souhaitez contribuer, n'hésitez pas à rejoindre notre communauté. Simplifions ensemble l'ingénierie logicielle !
|
||||
|
||||
🐚 **Codez moins, faites plus avec OpenHands.**
|
||||
|
||||
[](https://star-history.com/#All-Hands-AI/OpenHands&Date)
|
||||
|
||||
## 🛠️ Construit avec
|
||||
## Construit avec
|
||||
|
||||
OpenHands est construit en utilisant une combinaison de frameworks et de bibliothèques puissants, fournissant une base solide pour son développement. Voici les principales technologies utilisées dans le projet :
|
||||
|
||||
@@ -44,6 +23,6 @@ OpenHands est construit en utilisant une combinaison de frameworks et de bibliot
|
||||
|
||||
Veuillez noter que la sélection de ces technologies est en cours et que des technologies supplémentaires peuvent être ajoutées ou des technologies existantes peuvent être supprimées à mesure que le projet évolue. Nous nous efforçons d'adopter les outils les plus appropriés et les plus efficaces pour améliorer les capacités d'OpenHands.
|
||||
|
||||
## 📜 Licence
|
||||
## Licence
|
||||
|
||||
Distribué sous la licence MIT. Voir [notre licence](https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE) pour plus d'informations.
|
||||
Distribué sous la [Licence](https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE) MIT.
|
||||
|
||||
@@ -0,0 +1,395 @@
|
||||
# Options de configuration
|
||||
|
||||
Ce guide détaille toutes les options de configuration disponibles pour OpenHands, vous aidant à personnaliser son comportement et à l'intégrer avec d'autres services.
|
||||
|
||||
:::note
|
||||
Si vous exécutez en [Mode GUI](https://docs.all-hands.dev/modules/usage/how-to/gui-mode), les paramètres disponibles dans l'interface utilisateur des paramètres auront toujours
|
||||
la priorité.
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
# Table des matières
|
||||
|
||||
1. [Configuration de base](#configuration-de-base)
|
||||
- [Clés API](#clés-api)
|
||||
- [Espace de travail](#espace-de-travail)
|
||||
- [Débogage et journalisation](#débogage-et-journalisation)
|
||||
- [Gestion des sessions](#gestion-des-sessions)
|
||||
- [Trajectoires](#trajectoires)
|
||||
- [Stockage de fichiers](#stockage-de-fichiers)
|
||||
- [Gestion des tâches](#gestion-des-tâches)
|
||||
- [Configuration du bac à sable](#configuration-du-bac-à-sable)
|
||||
- [Divers](#divers)
|
||||
2. [Configuration LLM](#configuration-llm)
|
||||
- [Informations d'identification AWS](#informations-didentification-aws)
|
||||
- [Configuration de l'API](#configuration-de-lapi)
|
||||
- [Fournisseur LLM personnalisé](#fournisseur-llm-personnalisé)
|
||||
- [Embeddings](#embeddings)
|
||||
- [Gestion des messages](#gestion-des-messages)
|
||||
- [Sélection du modèle](#sélection-du-modèle)
|
||||
- [Nouvelles tentatives](#nouvelles-tentatives)
|
||||
- [Options avancées](#options-avancées)
|
||||
3. [Configuration de l'agent](#configuration-de-lagent)
|
||||
- [Configuration du micro-agent](#configuration-du-micro-agent)
|
||||
- [Configuration de la mémoire](#configuration-de-la-mémoire)
|
||||
- [Configuration LLM](#configuration-llm-2)
|
||||
- [Configuration de l'espace d'action](#configuration-de-lespace-daction)
|
||||
- [Utilisation du micro-agent](#utilisation-du-micro-agent)
|
||||
4. [Configuration du bac à sable](#configuration-du-bac-à-sable-2)
|
||||
- [Exécution](#exécution)
|
||||
- [Image de conteneur](#image-de-conteneur)
|
||||
- [Mise en réseau](#mise-en-réseau)
|
||||
- [Linting et plugins](#linting-et-plugins)
|
||||
- [Dépendances et environnement](#dépendances-et-environnement)
|
||||
- [Évaluation](#évaluation)
|
||||
5. [Configuration de sécurité](#configuration-de-sécurité)
|
||||
- [Mode de confirmation](#mode-de-confirmation)
|
||||
- [Analyseur de sécurité](#analyseur-de-sécurité)
|
||||
|
||||
---
|
||||
|
||||
## Configuration de base
|
||||
|
||||
Les options de configuration de base sont définies dans la section `[core]` du fichier `config.toml`.
|
||||
|
||||
**Clés API**
|
||||
- `e2b_api_key`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Clé API pour E2B
|
||||
|
||||
- `modal_api_token_id`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : ID du jeton API pour Modal
|
||||
|
||||
- `modal_api_token_secret`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Secret du jeton API pour Modal
|
||||
|
||||
**Espace de travail**
|
||||
- `workspace_base`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"./workspace"`
|
||||
- Description : Chemin de base pour l'espace de travail
|
||||
|
||||
- `cache_dir`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"/tmp/cache"`
|
||||
- Description : Chemin du répertoire de cache
|
||||
|
||||
**Débogage et journalisation**
|
||||
- `debug`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `false`
|
||||
- Description : Activer le débogage
|
||||
|
||||
- `disable_color`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `false`
|
||||
- Description : Désactiver la couleur dans la sortie du terminal
|
||||
|
||||
**Trajectoires**
|
||||
- `save_trajectory_path`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"./trajectories"`
|
||||
- Description : Chemin pour stocker les trajectoires (peut être un dossier ou un fichier). Si c'est un dossier, les trajectoires seront enregistrées dans un fichier nommé avec l'ID de session et l'extension .json, dans ce dossier.
|
||||
|
||||
**Stockage de fichiers**
|
||||
- `file_store_path`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"/tmp/file_store"`
|
||||
- Description : Chemin de stockage des fichiers
|
||||
|
||||
- `file_store`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"memory"`
|
||||
- Description : Type de stockage de fichiers
|
||||
|
||||
- `file_uploads_allowed_extensions`
|
||||
- Type : `list of str`
|
||||
- Valeur par défaut : `[".*"]`
|
||||
- Description : Liste des extensions de fichiers autorisées pour les téléchargements
|
||||
|
||||
- `file_uploads_max_file_size_mb`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `0`
|
||||
- Description : Taille maximale des fichiers pour les téléchargements, en mégaoctets
|
||||
|
||||
- `file_uploads_restrict_file_types`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `false`
|
||||
- Description : Restreindre les types de fichiers pour les téléchargements de fichiers
|
||||
|
||||
- `file_uploads_allowed_extensions`
|
||||
- Type : `list of str`
|
||||
- Valeur par défaut : `[".*"]`
|
||||
- Description : Liste des extensions de fichiers autorisées pour les téléchargements
|
||||
|
||||
**Gestion des tâches**
|
||||
- `max_budget_per_task`
|
||||
- Type : `float`
|
||||
- Valeur par défaut : `0.0`
|
||||
- Description : Budget maximal par tâche (0.0 signifie aucune limite)
|
||||
|
||||
- `max_iterations`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `100`
|
||||
- Description : Nombre maximal d'itérations
|
||||
|
||||
**Configuration du bac à sable**
|
||||
- `workspace_mount_path_in_sandbox`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"/workspace"`
|
||||
- Description : Chemin de montage de l'espace de travail dans le bac à sable
|
||||
|
||||
- `workspace_mount_path`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Chemin de montage de l'espace de travail
|
||||
|
||||
- `workspace_mount_rewrite`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Chemin pour réécrire le chemin de montage de l'espace de travail. Vous pouvez généralement ignorer cela, cela fait référence à des cas spéciaux d'exécution à l'intérieur d'un autre conteneur.
|
||||
|
||||
**Divers**
|
||||
- `run_as_openhands`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `true`
|
||||
- Description : Exécuter en tant qu'OpenHands
|
||||
|
||||
- `runtime`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"eventstream"`
|
||||
- Description : Environnement d'exécution
|
||||
|
||||
- `default_agent`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"CodeActAgent"`
|
||||
- Description : Nom de l'agent par défaut
|
||||
|
||||
- `jwt_secret`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `uuid.uuid4().hex`
|
||||
- Description : Secret JWT pour l'authentification. Veuillez le définir sur votre propre valeur.
|
||||
|
||||
## Configuration LLM
|
||||
|
||||
Les options de configuration LLM (Large Language Model) sont définies dans la section `[llm]` du fichier `config.toml`.
|
||||
|
||||
Pour les utiliser avec la commande docker, passez `-e LLM_<option>`. Exemple : `-e LLM_NUM_RETRIES`.
|
||||
|
||||
:::note
|
||||
Pour les configurations de développement, vous pouvez également définir des configurations LLM personnalisées. Voir [Configurations LLM personnalisées](./llms/custom-llm-configs) pour plus de détails.
|
||||
:::
|
||||
|
||||
**Informations d'identification AWS**
|
||||
- `aws_access_key_id`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : ID de clé d'accès AWS
|
||||
|
||||
- `aws_region_name`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Nom de la région AWS
|
||||
|
||||
- `aws_secret_access_key`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Clé d'accès secrète AWS
|
||||
|
||||
**Configuration de l'API**
|
||||
- `api_key`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `None`
|
||||
- Description : Clé API à utiliser
|
||||
|
||||
- `base_url`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : URL de base de l'API
|
||||
|
||||
- `api_version`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Version de l'API
|
||||
|
||||
- `input_cost_per_token`
|
||||
- Type : `float`
|
||||
- Valeur par défaut : `0.0`
|
||||
- Description : Coût par jeton d'entrée
|
||||
|
||||
- `output_cost_per_token`
|
||||
- Type : `float`
|
||||
- Valeur par défaut : `0.0`
|
||||
- Description : Coût par jeton de sortie
|
||||
|
||||
**Fournisseur LLM personnalisé**
|
||||
- `custom_llm_provider`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Fournisseur LLM personnalisé
|
||||
|
||||
**Embeddings**
|
||||
- `embedding_base_url`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : URL de base de l'API d'embedding
|
||||
|
||||
- `embedding_deployment_name`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Nom du déploiement d'embedding
|
||||
|
||||
- `embedding_model`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"local"`
|
||||
- Description : Modèle d'embedding à utiliser
|
||||
|
||||
**Gestion des messages**
|
||||
- `max_message_chars`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `30000`
|
||||
- Description : Le nombre maximum approximatif de caractères dans le contenu d'un événement inclus dans l'invite au LLM. Les observations plus grandes sont tronquées.
|
||||
|
||||
- `max_input_tokens`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `0`
|
||||
- Description : Nombre maximal de jetons d'entrée
|
||||
|
||||
- `max_output_tokens`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `0`
|
||||
- Description : Nombre maximal de jetons de sortie
|
||||
|
||||
**Sélection du modèle**
|
||||
- `model`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `"claude-3-5-sonnet-20241022"`
|
||||
- Description : Modèle à utiliser
|
||||
|
||||
**Nouvelles tentatives**
|
||||
- `num_retries`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `8`
|
||||
- Description : Nombre de nouvelles tentatives à effectuer
|
||||
|
||||
- `retry_max_wait`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `120`
|
||||
- Description : Temps d'attente maximal (en secondes) entre les tentatives de nouvelle tentative
|
||||
|
||||
- `retry_min_wait`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `15`
|
||||
- Description : Temps d'attente minimal (en secondes) entre les tentatives de nouvelle tentative
|
||||
|
||||
- `retry_multiplier`
|
||||
- Type : `float`
|
||||
- Valeur par défaut : `2.0`
|
||||
- Description : Multiplicateur pour le calcul du backoff exponentiel
|
||||
|
||||
**Options avancées**
|
||||
- `drop_params`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `false`
|
||||
- Description : Supprimer tous les paramètres non mappés (non pris en charge) sans provoquer d'exception
|
||||
|
||||
- `caching_prompt`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `true`
|
||||
- Description : Utiliser la fonctionnalité de mise en cache des invites si elle est fournie par le LLM et prise en charge
|
||||
|
||||
- `ollama_base_url`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : URL de base pour l'API OLLAMA
|
||||
|
||||
- `temperature`
|
||||
- Type : `float`
|
||||
- Valeur par défaut : `0.0`
|
||||
- Description : Température pour l'API
|
||||
|
||||
- `timeout`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `0`
|
||||
- Description : Délai d'expiration pour l'API
|
||||
|
||||
- `top_p`
|
||||
- Type : `float`
|
||||
- Valeur par défaut : `1.0`
|
||||
- Description : Top p pour l'API
|
||||
|
||||
- `disable_vision`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `None`
|
||||
- Description : Si le modèle est capable de vision, cette option permet de désactiver le traitement des images (utile pour réduire les coûts)
|
||||
|
||||
## Configuration de l'agent
|
||||
|
||||
Les options de configuration de l'agent sont définies dans les sections `[agent]` et `[agent.<agent_name>]` du fichier `config.toml`.
|
||||
|
||||
**Configuration du micro-agent**
|
||||
- `micro_agent_name`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `""`
|
||||
- Description : Nom du micro-agent à utiliser pour cet agent
|
||||
|
||||
**Configuration de la mémoire**
|
||||
- `memory_enabled`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `false`
|
||||
- Description : Si la mémoire à long terme (embeddings) est activée
|
||||
|
||||
- `memory_max_threads`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `3`
|
||||
- Description : Le nombre maximum de threads indexant en même temps pour les embeddings
|
||||
|
||||
**Configuration LLM**
|
||||
- `llm_config`
|
||||
- Type : `str`
|
||||
- Valeur par défaut : `'your-llm-config-group'`
|
||||
- Description : Le nom de la configuration LLM à utiliser
|
||||
|
||||
**Configuration de l'espace d'action**
|
||||
- `function_calling`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `true`
|
||||
- Description : Si l'appel de fonction est activé
|
||||
|
||||
- `codeact_enable_browsing`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `false`
|
||||
- Description : Si le délégué de navigation est activé dans l'espace d'action (fonctionne uniquement avec l'appel de fonction)
|
||||
|
||||
- `codeact_enable_llm_editor`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `false`
|
||||
- Description : Si l'éditeur LLM est activé dans l'espace d'action (fonctionne uniquement avec l'appel de fonction)
|
||||
|
||||
**Utilisation du micro-agent**
|
||||
- `enable_prompt_extensions`
|
||||
- Type : `bool`
|
||||
- Valeur par défaut : `true`
|
||||
- Description : Indique si l'utilisation des micro-agents est activée ou non
|
||||
|
||||
- `disabled_microagents`
|
||||
- Type : `list of str`
|
||||
- Valeur par défaut : `None`
|
||||
- Description : Liste des micro-agents à désactiver
|
||||
|
||||
### Exécution
|
||||
- `timeout`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `120`
|
||||
- Description : Délai d'expiration du bac à sable, en secondes
|
||||
|
||||
- `user_id`
|
||||
- Type : `int`
|
||||
- Valeur par défaut : `1000`
|
||||
- Description : ID de l'utilisateur du bac à sable
|
||||
@@ -5,7 +5,7 @@
|
||||
Vous avez donc [installé OpenHands](./installation) et avez
|
||||
[configuré votre LLM](./installation#setup). Et maintenant ?
|
||||
|
||||
OpenHands peut vous aider à vous attaquer à une grande variété de tâches d'ingénierie. Mais la technologie
|
||||
OpenHands peut vous aider à aborder une grande variété de tâches d'ingénierie. Mais la technologie
|
||||
est encore nouvelle, et nous sommes loin d'avoir des agents capables de prendre en charge des tâches
|
||||
d'ingénierie vastes et compliquées sans aucune aide. Il est donc important de se faire une idée de ce que l'agent
|
||||
fait bien, et où il pourrait avoir besoin d'un coup de main.
|
||||
@@ -16,7 +16,7 @@ La première chose que vous voudrez peut-être essayer est un simple exemple "he
|
||||
Cela peut être plus compliqué qu'il n'y paraît !
|
||||
|
||||
Essayez de demander à l'agent :
|
||||
> Please write a bash script hello.sh that prints "hello world!"
|
||||
> Veuillez écrire un script bash hello.sh qui affiche "hello world!"
|
||||
|
||||
Vous devriez constater que l'agent non seulement écrit le script, mais définit également les
|
||||
permissions correctes et exécute le script pour vérifier la sortie.
|
||||
@@ -24,12 +24,12 @@ permissions correctes et exécute le script pour vérifier la sortie.
|
||||
Vous pouvez continuer à demander à l'agent d'affiner votre code. C'est une excellente façon de
|
||||
travailler avec les agents. Commencez simplement, et itérez.
|
||||
|
||||
> Please modify hello.sh so that it accepts a name as the first argument, but defaults to "world"
|
||||
> Veuillez modifier hello.sh pour qu'il accepte un nom comme premier argument, mais par défaut "world"
|
||||
|
||||
Vous pouvez également travailler dans n'importe quel langage dont vous avez besoin, bien que l'agent puisse avoir besoin de passer un peu de
|
||||
Vous pouvez également travailler dans n'importe quel langage dont vous avez besoin, bien que l'agent puisse avoir besoin de passer du
|
||||
temps à configurer son environnement !
|
||||
|
||||
> Please convert hello.sh to a Ruby script, and run it
|
||||
> Veuillez convertir hello.sh en un script Ruby, et l'exécuter
|
||||
|
||||
## Construire à partir de zéro
|
||||
|
||||
@@ -41,18 +41,18 @@ aussi précis que possible sur ce que vous voulez, sur la pile technologique à
|
||||
|
||||
Par exemple, nous pourrions construire une application TODO :
|
||||
|
||||
> Please build a basic TODO list app in React. It should be frontend-only, and all state
|
||||
> should be kept in localStorage.
|
||||
> Veuillez créer une application basique de liste de tâches en React. Elle devrait être uniquement frontend, et tout l'état
|
||||
> devrait être conservé dans localStorage.
|
||||
|
||||
Nous pouvons continuer à itérer sur l'application une fois le squelette en place :
|
||||
|
||||
> Please allow adding an optional due date to every task
|
||||
> Veuillez permettre d'ajouter une date d'échéance optionnelle à chaque tâche
|
||||
|
||||
Tout comme avec le développement normal, il est bon de commiter et de pousser votre code fréquemment.
|
||||
De cette façon, vous pouvez toujours revenir à un ancien état si l'agent dévie.
|
||||
Vous pouvez demander à l'agent de commiter et de pousser pour vous :
|
||||
|
||||
> Please commit the changes and push them to a new branch called "feature/due-dates"
|
||||
> Veuillez commiter les changements et les pousser sur une nouvelle branche appelée "feature/due-dates"
|
||||
|
||||
|
||||
## Ajouter du nouveau code
|
||||
@@ -61,18 +61,18 @@ OpenHands peut également faire un excellent travail en ajoutant du nouveau code
|
||||
|
||||
Par exemple, vous pouvez demander à OpenHands d'ajouter une nouvelle action GitHub à votre projet
|
||||
qui analyse votre code. OpenHands peut jeter un coup d'œil à votre base de code pour voir quel langage
|
||||
il doit utiliser, mais ensuite il peut simplement déposer un nouveau fichier dans `./github/workflows/lint.yml`.
|
||||
il doit utiliser, mais ensuite il peut simplement déposer un nouveau fichier dans `./github/workflows/lint.yml`
|
||||
|
||||
> Please add a GitHub action that lints the code in this repository
|
||||
> Veuillez ajouter une action GitHub qui analyse le code dans ce dépôt
|
||||
|
||||
Certaines tâches peuvent nécessiter un peu plus de contexte. Bien qu'OpenHands puisse utiliser `ls` et `grep`
|
||||
pour rechercher dans votre base de code, fournir le contexte à l'avance lui permet d'aller plus vite,
|
||||
et plus précisément. Et cela vous coûtera moins de tokens !
|
||||
|
||||
> Please modify ./backend/api/routes.js to add a new route that returns a list of all tasks
|
||||
> Veuillez modifier ./backend/api/routes.js pour ajouter une nouvelle route qui renvoie une liste de toutes les tâches
|
||||
|
||||
> Please add a new React component that displays a list of Widgets to the ./frontend/components
|
||||
> directory. It should use the existing Widget component.
|
||||
> Veuillez ajouter un nouveau composant React qui affiche une liste de Widgets dans le répertoire ./frontend/components.
|
||||
> Il devrait utiliser le composant Widget existant.
|
||||
|
||||
## Refactoring
|
||||
|
||||
@@ -80,34 +80,34 @@ OpenHands est excellent pour refactoriser du code existant, surtout par petits m
|
||||
Vous ne voulez probablement pas essayer de réarchitecturer toute votre base de code, mais diviser
|
||||
les longs fichiers et fonctions, renommer les variables, etc. ont tendance à très bien fonctionner.
|
||||
|
||||
> Please rename all the single-letter variables in ./app.go
|
||||
> Veuillez renommer toutes les variables à une lettre dans ./app.go
|
||||
|
||||
> Please break the function `build_and_deploy_widgets` into two functions, `build_widgets` and `deploy_widgets` in widget.php
|
||||
> Veuillez diviser la fonction `build_and_deploy_widgets` en deux fonctions, `build_widgets` et `deploy_widgets` dans widget.php
|
||||
|
||||
> Please break ./api/routes.js into separate files for each route
|
||||
> Veuillez diviser ./api/routes.js en fichiers séparés pour chaque route
|
||||
|
||||
## Corrections de bugs
|
||||
|
||||
OpenHands peut également vous aider à traquer et corriger des bugs dans votre code. Mais, comme tout
|
||||
développeur le sait, la correction de bugs peut être extrêmement délicate, et souvent OpenHands aura besoin de plus de contexte.
|
||||
Cela aide si vous avez diagnostiqué le bug, mais que vous voulez qu'OpenHands trouve la logique.
|
||||
Cela aide si vous avez diagnostiqué le bug, mais que vous voulez qu'OpenHands comprenne la logique.
|
||||
|
||||
> Currently the email field in the `/subscribe` endpoint is rejecting .io domains. Please fix this.
|
||||
> Actuellement, le champ email dans le point de terminaison `/subscribe` rejette les domaines .io. Veuillez corriger cela.
|
||||
|
||||
> The `search_widgets` function in ./app.py is doing a case-sensitive search. Please make it case-insensitive.
|
||||
> La fonction `search_widgets` dans ./app.py effectue une recherche sensible à la casse. Veuillez la rendre insensible à la casse.
|
||||
|
||||
Il est souvent utile de faire du développement piloté par les tests lors de la correction de bugs avec un agent.
|
||||
Vous pouvez demander à l'agent d'écrire un nouveau test, puis d'itérer jusqu'à ce qu'il corrige le bug :
|
||||
|
||||
> The `hello` function crashes on the empty string. Please write a test that reproduces this bug, then fix the code so it passes.
|
||||
> La fonction `hello` plante sur la chaîne vide. Veuillez écrire un test qui reproduit ce bug, puis corrigez le code pour qu'il passe.
|
||||
|
||||
## Plus
|
||||
|
||||
OpenHands est capable d'aider sur à peu près n'importe quelle tâche de codage. Mais il faut un peu de pratique
|
||||
OpenHands est capable d'aider sur à peu près n'importe quelle tâche de codage. Mais il faut de la pratique
|
||||
pour en tirer le meilleur parti. N'oubliez pas de :
|
||||
* Garder vos tâches petites
|
||||
* Être aussi précis que possible
|
||||
* Fournir autant de contexte que possible
|
||||
* Commiter et pousser fréquemment
|
||||
|
||||
Voir [Bonnes pratiques de prompting](./prompting-best-practices) pour plus de conseils sur la façon de tirer le meilleur parti d'OpenHands.
|
||||
Voir [Bonnes pratiques de prompting](./prompting/prompting-best-practices) pour plus de conseils sur la façon de tirer le meilleur parti d'OpenHands.
|
||||
|
||||
@@ -28,16 +28,17 @@ Vous devrez vous assurer de définir votre modèle, votre clé API et d'autres p
|
||||
|
||||
Pour exécuter OpenHands en mode CLI avec Docker, suivez ces étapes :
|
||||
|
||||
1. Définissez `WORKSPACE_BASE` sur le répertoire que vous souhaitez qu'OpenHands modifie :
|
||||
1. Définissez `WORKSPACE_BASE` sur le répertoire que vous voulez qu'OpenHands modifie :
|
||||
|
||||
```bash
|
||||
WORKSPACE_BASE=$(pwd)/workspace
|
||||
```
|
||||
|
||||
2. Définissez `LLM_MODEL` sur le modèle que vous souhaitez utiliser :
|
||||
2. Définissez `LLM_MODEL` sur le modèle que vous voulez utiliser :
|
||||
|
||||
```bash
|
||||
LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"
|
||||
|
||||
```
|
||||
|
||||
3. Définissez `LLM_API_KEY` sur votre clé API :
|
||||
@@ -51,6 +52,7 @@ LLM_API_KEY="sk_test_12345"
|
||||
```bash
|
||||
docker run -it \
|
||||
--pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-e LLM_API_KEY=$LLM_API_KEY \
|
||||
@@ -59,7 +61,7 @@ docker run -it \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app-$(date +%Y%m%d%H%M%S) \
|
||||
ghcr.io/all-hands-ai/openhands:0.11 \
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.21 \
|
||||
python -m openhands.core.cli
|
||||
```
|
||||
|
||||
@@ -72,7 +74,7 @@ Voici quelques exemples de commandes CLI et leurs sorties attendues :
|
||||
### Exemple 1 : Tâche simple
|
||||
|
||||
```bash
|
||||
Comment puis-je vous aider ? >> Écrivez un script Python qui affiche "Hello, World!"
|
||||
How can I help? >> Écrivez un script Python qui affiche "Hello, World!"
|
||||
```
|
||||
|
||||
Sortie attendue :
|
||||
@@ -86,7 +88,7 @@ Sortie attendue :
|
||||
### Exemple 2 : Commande Bash
|
||||
|
||||
```bash
|
||||
Comment puis-je vous aider ? >> Créez un répertoire nommé "test_dir"
|
||||
How can I help? >> Créez un répertoire nommé "test_dir"
|
||||
```
|
||||
|
||||
Sortie attendue :
|
||||
@@ -100,7 +102,7 @@ Sortie attendue :
|
||||
### Exemple 3 : Gestion des erreurs
|
||||
|
||||
```bash
|
||||
Comment puis-je vous aider ? >> Supprimez un fichier inexistant
|
||||
How can I help? >> Supprimez un fichier inexistant
|
||||
```
|
||||
|
||||
Sortie attendue :
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Le sandbox est l'endroit où l'agent effectue ses tâches. Au lieu d'exécuter des commandes directement sur votre ordinateur (ce qui pourrait être risqué), l'agent les exécute à l'intérieur d'un conteneur Docker.
|
||||
|
||||
Le sandbox OpenHands par défaut (`python-nodejs:python3.12-nodejs22` de [nikolaik/python-nodejs](https://hub.docker.com/r/nikolaik/python-nodejs)) est livré avec certains paquets installés tels que Python et Node.js, mais peut nécessiter l'installation d'autres logiciels par défaut.
|
||||
Le sandbox OpenHands par défaut (`python-nodejs:python3.12-nodejs22` de [nikolaik/python-nodejs](https://hub.docker.com/r/nikolaik/python-nodejs)) est livré avec certains paquets installés tels que Python et Node.js mais peut nécessiter l'installation d'autres logiciels par défaut.
|
||||
|
||||
Vous avez deux options pour la personnalisation :
|
||||
|
||||
@@ -36,7 +36,7 @@ Cela produira une nouvelle image appelée `custom-image`, qui sera disponible da
|
||||
|
||||
> Notez que dans la configuration décrite dans ce document, OpenHands s'exécutera en tant qu'utilisateur "openhands" à l'intérieur du sandbox et donc tous les paquets installés via le docker file devraient être disponibles pour tous les utilisateurs du système, pas seulement root.
|
||||
|
||||
## Utiliser le Workflow de Développement
|
||||
## Utilisation du Workflow de Développement
|
||||
|
||||
### Configuration
|
||||
|
||||
@@ -52,32 +52,10 @@ Dans le fichier `config.toml` dans le répertoire OpenHands, définissez `sandbo
|
||||
sandbox_base_container_image="custom-image"
|
||||
```
|
||||
|
||||
### Exécuter
|
||||
### Exécution
|
||||
|
||||
Exécutez OpenHands en exécutant ```make run``` dans le répertoire de niveau supérieur.
|
||||
|
||||
## Explication Technique
|
||||
|
||||
Veuillez vous référer à la [section image docker personnalisée de la documentation d'exécution](https://docs.all-hands.dev/modules/usage/architecture/runtime#advanced-how-openhands-builds-and-maintains-od-runtime-images) pour plus de détails.
|
||||
|
||||
## Dépannage / Erreurs
|
||||
|
||||
### Erreur : ```useradd: UID 1000 is not unique```
|
||||
|
||||
Si vous voyez cette erreur dans la sortie de la console, c'est parce qu'OpenHands essaie de créer l'utilisateur openhands dans le sandbox avec un UID de 1000, mais cet UID est déjà utilisé dans l'image (pour une raison quelconque). Pour corriger cela, changez le champ sandbox_user_id dans le fichier config.toml à une valeur différente :
|
||||
|
||||
```toml
|
||||
[core]
|
||||
workspace_base="./workspace"
|
||||
run_as_openhands=true
|
||||
sandbox_base_container_image="custom_image"
|
||||
sandbox_user_id="1001"
|
||||
```
|
||||
|
||||
### Erreurs d'utilisation de port
|
||||
|
||||
Si vous voyez une erreur concernant un port déjà utilisé ou indisponible, essayez de supprimer tous les conteneurs Docker en cours d'exécution (exécutez `docker ps` et `docker rm` sur les conteneurs pertinents) 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 !
|
||||
|
||||
@@ -15,7 +15,6 @@ Voici un exemple de fichier de configuration que vous pouvez utiliser pour défi
|
||||
[llm]
|
||||
# IMPORTANT : ajoutez votre clé API ici et définissez le modèle que vous souhaitez évaluer
|
||||
model = "claude-3-5-sonnet-20241022"
|
||||
|
||||
api_key = "sk-XXX"
|
||||
|
||||
[llm.eval_gpt4_1106_preview_llm]
|
||||
@@ -191,7 +190,7 @@ En suivant cette structure, vous pouvez créer un workflow d'évaluation robuste
|
||||
|
||||
## Comprendre la `user_response_fn`
|
||||
|
||||
La `user_response_fn` est un composant crucial dans le workflow d'évaluation d'OpenHands. Elle simule l'interaction de l'utilisateur avec l'agent, permettant des réponses automatisées pendant le processus d'évaluation. Cette fonction est particulièrement utile lorsque vous souhaitez fournir des réponses cohérentes et prédéfinies aux requêtes ou actions de l'agent.
|
||||
La `user_response_fn` est un composant crucial dans le workflow d'évaluation d'OpenHands. Elle simule l'interaction de l'utilisateur avec l'agent, permettant des réponses automatisées pendant le processus d'évaluation. Cette fonction est particulièrement utile lorsque vous voulez fournir des réponses cohérentes et prédéfinies aux requêtes ou actions de l'agent.
|
||||
|
||||
|
||||
### Workflow et interaction
|
||||
@@ -242,7 +241,7 @@ Dans ce workflow :
|
||||
- Les actions non exécutables (généralement lorsque l'agent veut communiquer ou demander des clarifications) sont gérées par la `user_response_fn`
|
||||
- L'agent traite ensuite le feedback, qu'il s'agisse d'une Observation du Runtime ou d'une réponse simulée de la `user_response_fn`
|
||||
|
||||
Cette approche permet une gestion automatisée des actions concrètes et des interactions utilisateur simulées, ce qui la rend adaptée aux scénarios d'évaluation où vous souhaitez tester la capacité de l'agent à effectuer des tâches avec une intervention humaine minimale.
|
||||
Cette approche permet une gestion automatisée des actions concrètes et des interactions utilisateur simulées, ce qui la rend adaptée aux scénarios d'évaluation où vous voulez tester la capacité de l'agent à accomplir des tâches avec une intervention humaine minimale.
|
||||
|
||||
### Exemple d'implémentation
|
||||
|
||||
@@ -264,7 +263,7 @@ def codeact_user_response(state: State | None) -> str:
|
||||
if isinstance(event, MessageAction) and event.source == 'user'
|
||||
]
|
||||
if len(user_msgs) >= 2:
|
||||
# faire savoir à l'agent qu'il peut abandonner lorsqu'il a essayé 3 fois
|
||||
# faire savoir à l'agent qu'il peut abandonner quand il a essayé 3 fois
|
||||
return (
|
||||
msg
|
||||
+ 'Si vous voulez abandonner, exécutez : <execute_bash> exit </execute_bash>.\n'
|
||||
@@ -278,4 +277,4 @@ Cette fonction fait ce qui suit :
|
||||
2. Vérifie combien de fois l'agent a tenté de communiquer avec l'utilisateur
|
||||
3. Si l'agent a fait plusieurs tentatives, il lui donne la possibilité d'abandonner
|
||||
|
||||
En utilisant cette fonction, vous pouvez garantir un comportement cohérent sur plusieurs exécutions d'évaluation et empêcher l'agent de rester bloqué en attendant une entrée humaine.
|
||||
En utilisant cette fonction, vous pouvez assurer un comportement cohérent sur plusieurs exécutions d'évaluation et empêcher l'agent de rester bloqué en attendant une entrée humaine.
|
||||
|
||||
@@ -6,12 +6,46 @@ Ce guide explique comment utiliser l'Action GitHub OpenHands, à la fois dans le
|
||||
|
||||
## Utilisation de l'Action dans le dépôt OpenHands
|
||||
|
||||
Pour utiliser l'Action GitHub OpenHands dans le dépôt OpenHands, un mainteneur OpenHands peut :
|
||||
Pour utiliser l'Action GitHub OpenHands dans un dépôt, vous pouvez :
|
||||
|
||||
1. Créer une issue dans le dépôt.
|
||||
2. Ajouter le label `fix-me` à l'issue.
|
||||
3. L'action se déclenchera automatiquement et tentera de résoudre l'issue.
|
||||
1. Créer un ticket dans le dépôt.
|
||||
2. Ajouter l'étiquette `fix-me` au ticket ou laisser un commentaire sur le ticket commençant par `@openhands-agent`.
|
||||
|
||||
L'action se déclenchera automatiquement et tentera de résoudre le ticket.
|
||||
|
||||
## Installation de l'Action dans un nouveau dépôt
|
||||
|
||||
Pour installer l'Action GitHub OpenHands dans votre propre dépôt, suivez les [instructions dans le dépôt OpenHands Resolver](https://github.com/All-Hands-AI/OpenHands/blob/main/openhands/resolver/README.md).
|
||||
Pour installer l'Action GitHub OpenHands dans votre propre dépôt, suivez le [README pour le Resolver OpenHands](https://github.com/All-Hands-AI/OpenHands/blob/main/openhands/resolver/README.md).
|
||||
|
||||
## Conseils d'utilisation
|
||||
|
||||
### Résolution itérative
|
||||
|
||||
1. Créez un ticket dans le dépôt.
|
||||
2. Ajoutez l'étiquette `fix-me` au ticket, ou laissez un commentaire commençant par `@openhands-agent`
|
||||
3. Examinez la tentative de résolution du ticket en vérifiant la pull request
|
||||
4. Faites un suivi avec des commentaires via des commentaires généraux, des commentaires de revue ou des commentaires de fil en ligne
|
||||
5. Ajoutez l'étiquette `fix-me` à la pull request, ou adressez un commentaire spécifique en commençant par `@openhands-agent`
|
||||
|
||||
### Étiquette versus Macro
|
||||
|
||||
- Étiquette (`fix-me`) : Demande à OpenHands de traiter le ticket ou la pull request dans son **intégralité**.
|
||||
- Macro (`@openhands-agent`) : Demande à OpenHands de ne considérer que la description du ticket/de la pull request et **le commentaire spécifique**.
|
||||
|
||||
## Paramètres avancés
|
||||
|
||||
### Ajouter des paramètres de dépôt personnalisés
|
||||
|
||||
Vous pouvez fournir des instructions personnalisées pour OpenHands en suivant le [README pour le resolver](https://github.com/All-Hands-AI/OpenHands/blob/main/openhands/resolver/README.md#providing-custom-instructions).
|
||||
|
||||
### Configurations personnalisées
|
||||
|
||||
Le resolver Github vérifiera automatiquement les [secrets de dépôt](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions?tool=webui#creating-secrets-for-a-repository) ou les [variables de dépôt](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#creating-configuration-variables-for-a-repository) valides pour personnaliser son comportement.
|
||||
Les options de personnalisation que vous pouvez définir sont :
|
||||
|
||||
| **Nom de l'attribut** | **Type** | **Objectif** | **Exemple** |
|
||||
|----------------------------------| -------- |-------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
|
||||
| `LLM_MODEL` | Variable | Définir le LLM à utiliser avec OpenHands | `LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"` |
|
||||
| `OPENHANDS_MAX_ITER` | Variable | Définir la limite maximale pour les itérations de l'agent | `OPENHANDS_MAX_ITER=10` |
|
||||
| `OPENHANDS_MACRO` | Variable | Personnaliser la macro par défaut pour invoquer le resolver | `OPENHANDS_MACRO=@resolveit` |
|
||||
| `OPENHANDS_BASE_CONTAINER_IMAGE` | Variable | Sandbox personnalisé ([en savoir plus](https://docs.all-hands.dev/modules/usage/how-to/custom-sandbox-guide))| `OPENHANDS_BASE_CONTAINER_IMAGE="custom_image"` |
|
||||
|
||||
@@ -8,7 +8,7 @@ OpenHands fournit un mode Interface Graphique (GUI) convivial pour interagir ave
|
||||
|
||||
## Installation et Configuration
|
||||
|
||||
1. Suivez les instructions du guide d'[Installation](../installation) pour installer OpenHands.
|
||||
1. Suivez les instructions du guide [Installation](../installation) pour installer OpenHands.
|
||||
|
||||
2. Après avoir exécuté la commande, accédez à OpenHands à l'adresse [http://localhost:3000](http://localhost:3000).
|
||||
|
||||
@@ -21,33 +21,107 @@ OpenHands fournit un mode Interface Graphique (GUI) convivial pour interagir ave
|
||||
3. Entrez la `Clé API` correspondante pour le fournisseur choisi.
|
||||
4. Cliquez sur "Enregistrer" pour appliquer les paramètres.
|
||||
|
||||
### Configuration du Jeton GitHub
|
||||
|
||||
OpenHands exporte automatiquement un `GITHUB_TOKEN` vers l'environnement shell s'il est disponible. Cela peut se produire de deux manières :
|
||||
|
||||
1. **Localement (OSS)** : L'utilisateur saisit directement son jeton GitHub
|
||||
2. **En ligne (SaaS)** : Le jeton est obtenu via l'authentification OAuth GitHub
|
||||
|
||||
#### Configuration d'un Jeton GitHub Local
|
||||
|
||||
1. **Générer un Personal Access Token (PAT)** :
|
||||
- Allez dans Paramètres GitHub > Paramètres développeur > Personal Access Tokens > Tokens (classique)
|
||||
- Cliquez sur "Générer un nouveau jeton (classique)"
|
||||
- Portées requises :
|
||||
- `repo` (Contrôle total des dépôts privés)
|
||||
- `workflow` (Mettre à jour les workflows GitHub Action)
|
||||
- `read:org` (Lire les données de l'organisation)
|
||||
|
||||
2. **Entrer le Jeton dans OpenHands** :
|
||||
- Cliquez sur le bouton Paramètres (icône d'engrenage) en haut à droite
|
||||
- Accédez à la section "GitHub"
|
||||
- Collez votre jeton dans le champ "Jeton GitHub"
|
||||
- Cliquez sur "Enregistrer" pour appliquer les modifications
|
||||
|
||||
#### Politiques de Jetons Organisationnels
|
||||
|
||||
Si vous travaillez avec des dépôts organisationnels, une configuration supplémentaire peut être nécessaire :
|
||||
|
||||
1. **Vérifier les Exigences de l'Organisation** :
|
||||
- Les administrateurs de l'organisation peuvent appliquer des politiques de jetons spécifiques
|
||||
- Certaines organisations exigent que les jetons soient créés avec SSO activé
|
||||
- Consultez les [paramètres de politique de jetons](https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization) de votre organisation
|
||||
|
||||
2. **Vérifier l'Accès à l'Organisation** :
|
||||
- Allez dans les paramètres de votre jeton sur GitHub
|
||||
- Recherchez l'organisation sous "Accès à l'organisation"
|
||||
- Si nécessaire, cliquez sur "Activer SSO" à côté de votre organisation
|
||||
- Terminez le processus d'autorisation SSO
|
||||
|
||||
#### Authentification OAuth (Mode En Ligne)
|
||||
|
||||
Lorsque vous utilisez OpenHands en mode en ligne, le flux OAuth GitHub :
|
||||
|
||||
1. Demande les autorisations suivantes :
|
||||
- Accès au dépôt (lecture/écriture)
|
||||
- Gestion des workflows
|
||||
- Accès en lecture à l'organisation
|
||||
|
||||
2. Étapes d'authentification :
|
||||
- Cliquez sur "Se connecter avec GitHub" lorsque vous y êtes invité
|
||||
- Examinez les autorisations demandées
|
||||
- Autorisez OpenHands à accéder à votre compte GitHub
|
||||
- Si vous utilisez une organisation, autorisez l'accès à l'organisation si vous y êtes invité
|
||||
|
||||
#### Dépannage
|
||||
|
||||
Problèmes courants et solutions :
|
||||
|
||||
1. **Jeton Non Reconnu** :
|
||||
- Assurez-vous que le jeton est correctement enregistré dans les paramètres
|
||||
- Vérifiez que le jeton n'a pas expiré
|
||||
- Vérifiez que le jeton a les portées requises
|
||||
- Essayez de régénérer le jeton
|
||||
|
||||
2. **Accès à l'Organisation Refusé** :
|
||||
- Vérifiez si SSO est requis mais non activé
|
||||
- Vérifiez l'appartenance à l'organisation
|
||||
- Contactez l'administrateur de l'organisation si les politiques de jetons bloquent l'accès
|
||||
|
||||
3. **Vérifier que le Jeton Fonctionne** :
|
||||
- L'application affichera une coche verte si le jeton est valide
|
||||
- Essayez d'accéder à un dépôt pour confirmer les autorisations
|
||||
- Vérifiez la console du navigateur pour tout message d'erreur
|
||||
- Utilisez le bouton "Tester la connexion" dans les paramètres s'il est disponible
|
||||
|
||||
### Paramètres Avancés
|
||||
|
||||
1. Activez `Options Avancées` pour accéder aux paramètres supplémentaires.
|
||||
2. Utilisez la zone de texte `Modèle Personnalisé` pour entrer manuellement un modèle s'il n'est pas dans la liste.
|
||||
3. Spécifiez une `URL de Base` si requise par votre fournisseur LLM.
|
||||
1. Basculez sur `Options Avancées` pour accéder aux paramètres supplémentaires.
|
||||
2. Utilisez la zone de texte `Modèle Personnalisé` pour saisir manuellement un modèle s'il ne figure pas dans la liste.
|
||||
3. Spécifiez une `URL de Base` si requis par votre fournisseur LLM.
|
||||
|
||||
### Interface Principale
|
||||
|
||||
L'interface principale se compose de plusieurs éléments clés :
|
||||
L'interface principale se compose de plusieurs composants clés :
|
||||
|
||||
1. **Fenêtre de Chat** : La zone centrale où vous pouvez voir l'historique de conversation avec l'assistant IA.
|
||||
2. **Zone de Saisie** : Située en bas de l'écran, utilisez-la pour taper vos messages ou commandes à l'IA.
|
||||
3. **Bouton Envoyer** : Cliquez dessus pour envoyer votre message à l'IA.
|
||||
4. **Bouton Paramètres** : Une icône d'engrenage qui ouvre la fenêtre modale des paramètres, vous permettant d'ajuster votre configuration à tout moment.
|
||||
5. **Panneau Espace de Travail** : Affiche les fichiers et dossiers de votre espace de travail, vous permettant de naviguer et visualiser les fichiers, ou l'historique des commandes passées de l'agent ou de navigation web.
|
||||
5. **Panneau Espace de Travail** : Affiche les fichiers et dossiers de votre espace de travail, vous permettant de naviguer et de visualiser les fichiers, ou les commandes passées de l'agent ou l'historique de navigation web.
|
||||
|
||||
### Interagir avec l'IA
|
||||
|
||||
1. Tapez votre question, requête ou description de tâche dans la zone de saisie.
|
||||
2. Cliquez sur le bouton envoyer ou appuyez sur Entrée pour soumettre votre message.
|
||||
1. Tapez votre question, demande ou description de tâche dans la zone de saisie.
|
||||
2. Cliquez sur le bouton d'envoi ou appuyez sur Entrée pour soumettre votre message.
|
||||
3. L'IA traitera votre saisie et fournira une réponse dans la fenêtre de chat.
|
||||
4. Vous pouvez poursuivre la conversation en posant des questions de suivi ou en fournissant des informations supplémentaires.
|
||||
|
||||
## Conseils pour une Utilisation Efficace
|
||||
|
||||
1. Soyez spécifique dans vos requêtes pour obtenir les réponses les plus précises et utiles, comme décrit dans les [meilleures pratiques d'invite](../prompting-best-practices).
|
||||
1. Soyez précis dans vos demandes pour obtenir les réponses les plus précises et utiles, comme décrit dans les [meilleures pratiques d'incitation](../prompting/prompting-best-practices).
|
||||
2. Utilisez le panneau d'espace de travail pour explorer la structure de votre projet.
|
||||
3. Utilisez l'un des modèles recommandés, comme décrit dans la section [LLMs](usage/llms/llms.md).
|
||||
|
||||
N'oubliez pas, le mode Interface Graphique d'OpenHands est conçu pour rendre votre interaction avec l'assistant IA aussi fluide et intuitive que possible. N'hésitez pas à explorer ses fonctionnalités pour maximiser votre productivité.
|
||||
N'oubliez pas que le mode Interface Graphique d'OpenHands est conçu pour rendre votre interaction avec l'assistant IA aussi fluide et intuitive que possible. N'hésitez pas à explorer ses fonctionnalités pour maximiser votre productivité.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Vous pouvez exécuter OpenHands avec une seule commande, sans démarrer l'application web.
|
||||
Cela facilite l'écriture de scripts et l'automatisation des tâches avec OpenHands.
|
||||
|
||||
Ceci est différent du [Mode CLI](cli-mode), qui est interactif et plus adapté au développement actif.
|
||||
Ceci est différent du [Mode CLI](cli-mode), qui est interactif et mieux adapté au développement actif.
|
||||
|
||||
## Avec Python
|
||||
|
||||
@@ -32,6 +32,7 @@ WORKSPACE_BASE=$(pwd)/workspace
|
||||
|
||||
```bash
|
||||
LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"
|
||||
|
||||
```
|
||||
|
||||
3. Définissez `LLM_API_KEY` sur votre clé API :
|
||||
@@ -45,14 +46,16 @@ LLM_API_KEY="sk_test_12345"
|
||||
```bash
|
||||
docker run -it \
|
||||
--pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-e LLM_API_KEY=$LLM_API_KEY \
|
||||
-e LLM_MODEL=$LLM_MODEL \
|
||||
-e LOG_ALL_EVENTS=true \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app-$(date +%Y%m%d%H%M%S) \
|
||||
ghcr.io/all-hands-ai/openhands:0.11 \
|
||||
python -m openhands.core.main -t "write a bash script that prints hi"
|
||||
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
|
||||
```
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
# Persistance des données de session
|
||||
|
||||
Avec l'installation standard, les données de session sont stockées en mémoire. Actuellement, si le service OpenHands est redémarré,
|
||||
les sessions précédentes deviennent invalides (un nouveau secret est généré) et ne sont donc pas récupérables.
|
||||
|
||||
## Comment persister les données de session
|
||||
|
||||
### Workflow de développement
|
||||
Dans le fichier `config.toml`, spécifiez ce qui suit :
|
||||
```
|
||||
[core]
|
||||
...
|
||||
file_store="local"
|
||||
file_store_path="/absolute/path/to/openhands/cache/directory"
|
||||
jwt_secret="secretpass"
|
||||
```
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Installation
|
||||
|
||||
## Configuration requise
|
||||
## Configuration système requise
|
||||
|
||||
* Docker version 26.0.0+ ou Docker Desktop 4.31.0+.
|
||||
* Vous devez utiliser Linux ou Mac OS.
|
||||
@@ -10,39 +10,31 @@
|
||||
|
||||
## Démarrer l'application
|
||||
|
||||
La façon la plus simple d'exécuter OpenHands est avec Docker. Vous pouvez modifier `WORKSPACE_BASE` ci-dessous pour pointer OpenHands vers
|
||||
du code existant que vous souhaitez modifier.
|
||||
La façon la plus simple d'exécuter OpenHands est avec Docker.
|
||||
|
||||
```bash
|
||||
export WORKSPACE_BASE=$(pwd)/workspace
|
||||
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik
|
||||
|
||||
docker pull ghcr.io/all-hands-ai/runtime:0.11-nikolaik
|
||||
|
||||
docker run -it --pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:0.11-nikolaik \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
docker run -it --rm --pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e LOG_ALL_EVENTS=true \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app-$(date +%Y%m%d%H%M%S) \
|
||||
ghcr.io/all-hands-ai/openhands:0.11
|
||||
--name openhands-app \
|
||||
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), comme un [CLI interactif](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).
|
||||
|
||||
## Configuration
|
||||
|
||||
Après avoir exécuté la commande ci-dessus, vous trouverez OpenHands en cours d'exécution à l'adresse [http://localhost:3000](http://localhost:3000).
|
||||
|
||||
L'agent aura accès au dossier `./workspace` pour effectuer son travail. Vous pouvez copier du code existant ici, ou modifier `WORKSPACE_BASE` dans la
|
||||
commande pour pointer vers un dossier existant.
|
||||
Au lancement d'OpenHands, vous verrez une fenêtre modale de paramètres. Vous **devez** sélectionner un `Fournisseur LLM` et un `Modèle LLM`, et entrer une `Clé API` correspondante.
|
||||
Ces paramètres peuvent être modifiés à tout moment en sélectionnant le bouton `Paramètres` (icône d'engrenage) dans l'interface utilisateur.
|
||||
|
||||
Au lancement d'OpenHands, vous verrez une fenêtre modale de paramètres. Vous **devez** sélectionner un `Fournisseur LLM` et un `Modèle LLM` et entrer une `Clé API` correspondante.
|
||||
Ceux-ci peuvent être modifiés à tout moment en sélectionnant le bouton `Paramètres` (icône d'engrenage) dans l'interface utilisateur.
|
||||
|
||||
Si le `Modèle LLM` requis n'existe pas dans la liste, vous pouvez activer les `Options avancées` et le saisir manuellement avec le préfixe correct
|
||||
Si le `Modèle LLM` requis n'existe pas dans la liste, vous pouvez activer les `Options avancées` et l'entrer manuellement avec le préfixe correct
|
||||
dans la zone de texte `Modèle personnalisé`.
|
||||
Les `Options avancées` vous permettent également de spécifier une `URL de base` si nécessaire.
|
||||
|
||||
@@ -54,11 +46,11 @@ Les `Options avancées` vous permettent également de spécifier une `URL de bas
|
||||
## Versions
|
||||
|
||||
La commande ci-dessus récupère la version stable la plus récente d'OpenHands. Vous avez également d'autres options :
|
||||
- Pour une version spécifique, utilisez `ghcr.io/all-hands-ai/openhands:$VERSION`, en remplaçant $VERSION par le numéro de version.
|
||||
- Nous utilisons semver et publions des tags majeurs, mineurs et de correctifs. Ainsi, `0.9` pointera automatiquement vers la dernière version `0.9.x`, et `0` pointera vers la dernière version `0.x.x`.
|
||||
- Pour la version de développement la plus à jour, vous pouvez utiliser `ghcr.io/all-hands-ai/openhands:main`. Cette version est instable et n'est recommandée qu'à des fins de test ou de développement.
|
||||
- Pour une version spécifique, utilisez `docker.all-hands.dev/all-hands-ai/openhands:$VERSION`, en remplaçant $VERSION par le numéro de version.
|
||||
- Nous utilisons semver et publions des tags majeurs, mineurs et de patch. Ainsi, `0.9` pointera automatiquement vers la dernière version `0.9.x`, et `0` pointera vers la dernière version `0.x.x`.
|
||||
- Pour la version de développement la plus à jour, vous pouvez utiliser `docker.all-hands.dev/all-hands-ai/openhands:main`. Cette version est instable et n'est recommandée qu'à des fins de test ou de développement.
|
||||
|
||||
Vous pouvez choisir le tag qui correspond le mieux à vos besoins en fonction des exigences de stabilité et des fonctionnalités souhaitées.
|
||||
Vous pouvez choisir le tag qui convient le mieux à vos besoins en fonction des exigences de stabilité et des fonctionnalités souhaitées.
|
||||
|
||||
Pour le workflow de développement, consultez [Development.md](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md).
|
||||
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
# Configurations LLM personnalisées
|
||||
|
||||
OpenHands permet de définir plusieurs configurations LLM nommées dans votre fichier `config.toml`. Cette fonctionnalité vous permet d'utiliser différentes configurations LLM pour différents usages, comme utiliser un modèle moins coûteux pour les tâches qui ne nécessitent pas de réponses de haute qualité, ou utiliser différents modèles avec différents paramètres pour des agents spécifiques.
|
||||
|
||||
## Comment ça fonctionne
|
||||
|
||||
Les configurations LLM nommées sont définies dans le fichier `config.toml` en utilisant des sections qui commencent par `llm.`. Par exemple :
|
||||
|
||||
```toml
|
||||
# Configuration LLM par défaut
|
||||
[llm]
|
||||
model = "gpt-4"
|
||||
api_key = "votre-clé-api"
|
||||
temperature = 0.0
|
||||
|
||||
# Configuration LLM personnalisée pour un modèle moins coûteux
|
||||
[llm.gpt3]
|
||||
model = "gpt-3.5-turbo"
|
||||
api_key = "votre-clé-api"
|
||||
temperature = 0.2
|
||||
|
||||
# Une autre configuration personnalisée avec des paramètres différents
|
||||
[llm.haute-creativite]
|
||||
model = "gpt-4"
|
||||
api_key = "votre-clé-api"
|
||||
temperature = 0.8
|
||||
top_p = 0.9
|
||||
```
|
||||
|
||||
Chaque configuration nommée hérite de tous les paramètres de la section `[llm]` par défaut et peut remplacer n'importe lequel de ces paramètres. Vous pouvez définir autant de configurations personnalisées que nécessaire.
|
||||
|
||||
## Utilisation des configurations personnalisées
|
||||
|
||||
### Avec les agents
|
||||
|
||||
Vous pouvez spécifier quelle configuration LLM un agent doit utiliser en définissant le paramètre `llm_config` dans la section de configuration de l'agent :
|
||||
|
||||
```toml
|
||||
[agent.RepoExplorerAgent]
|
||||
# Utiliser la configuration GPT-3 moins coûteuse pour cet agent
|
||||
llm_config = 'gpt3'
|
||||
|
||||
[agent.CodeWriterAgent]
|
||||
# Utiliser la configuration haute créativité pour cet agent
|
||||
llm_config = 'haute-creativite'
|
||||
```
|
||||
|
||||
### Options de configuration
|
||||
|
||||
Chaque configuration LLM nommée prend en charge toutes les mêmes options que la configuration LLM par défaut. Celles-ci incluent :
|
||||
|
||||
- Sélection du modèle (`model`)
|
||||
- Configuration de l'API (`api_key`, `base_url`, etc.)
|
||||
- Paramètres du modèle (`temperature`, `top_p`, etc.)
|
||||
- Paramètres de nouvelle tentative (`num_retries`, `retry_multiplier`, etc.)
|
||||
- Limites de jetons (`max_input_tokens`, `max_output_tokens`)
|
||||
- Et toutes les autres options de configuration LLM
|
||||
|
||||
Pour une liste complète des options disponibles, consultez la section Configuration LLM dans la documentation des [Options de configuration](../configuration-options).
|
||||
|
||||
## Cas d'utilisation
|
||||
|
||||
Les configurations LLM personnalisées sont particulièrement utiles dans plusieurs scénarios :
|
||||
|
||||
- **Optimisation des coûts** : Utiliser des modèles moins coûteux pour les tâches qui ne nécessitent pas de réponses de haute qualité, comme l'exploration de dépôt ou les opérations simples sur les fichiers.
|
||||
- **Réglage spécifique aux tâches** : Configurer différentes valeurs de température et de top_p pour les tâches qui nécessitent différents niveaux de créativité ou de déterminisme.
|
||||
- **Différents fournisseurs** : Utiliser différents fournisseurs LLM ou points d'accès API pour différentes tâches.
|
||||
- **Tests et développement** : Basculer facilement entre différentes configurations de modèles pendant le développement et les tests.
|
||||
|
||||
## Exemple : Optimisation des coûts
|
||||
|
||||
Un exemple pratique d'utilisation des configurations LLM personnalisées pour optimiser les coûts :
|
||||
|
||||
```toml
|
||||
# Configuration par défaut utilisant GPT-4 pour des réponses de haute qualité
|
||||
[llm]
|
||||
model = "gpt-4"
|
||||
api_key = "votre-clé-api"
|
||||
temperature = 0.0
|
||||
|
||||
# Configuration moins coûteuse pour l'exploration de dépôt
|
||||
[llm.repo-explorer]
|
||||
model = "gpt-3.5-turbo"
|
||||
temperature = 0.2
|
||||
|
||||
# Configuration pour la génération de code
|
||||
[llm.code-gen]
|
||||
model = "gpt-4"
|
||||
temperature = 0.0
|
||||
max_output_tokens = 2000
|
||||
|
||||
[agent.RepoExplorerAgent]
|
||||
llm_config = 'repo-explorer'
|
||||
|
||||
[agent.CodeWriterAgent]
|
||||
llm_config = 'code-gen'
|
||||
```
|
||||
|
||||
Dans cet exemple :
|
||||
- L'exploration de dépôt utilise un modèle moins coûteux car il s'agit principalement de comprendre et de naviguer dans le code
|
||||
- La génération de code utilise GPT-4 avec une limite de jetons plus élevée pour générer des blocs de code plus importants
|
||||
- La configuration par défaut reste disponible pour les autres tâches
|
||||
|
||||
:::note
|
||||
Les configurations LLM personnalisées ne sont disponibles que lors de l'utilisation d'OpenHands en mode développement, via `main.py` ou `cli.py`. Lors de l'exécution via `docker run`, veuillez utiliser les options de configuration standard.
|
||||
:::
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
|
||||
# Proxy LiteLLM
|
||||
|
||||
OpenHands prend en charge l'utilisation du [proxy LiteLLM](https://docs.litellm.ai/docs/proxy/quick_start) pour accéder à divers fournisseurs de LLM.
|
||||
|
||||
## Configuration
|
||||
|
||||
Pour utiliser le proxy LiteLLM avec OpenHands, vous devez :
|
||||
|
||||
1. Configurer un serveur proxy LiteLLM (voir la [documentation LiteLLM](https://docs.litellm.ai/docs/proxy/quick_start))
|
||||
2. Lors de l'exécution d'OpenHands, vous devrez définir les éléments suivants dans l'interface utilisateur d'OpenHands via les paramètres :
|
||||
* Activer les `Options avancées`
|
||||
* `Custom Model` au préfixe `litellm_proxy/` + le modèle que vous utiliserez (par exemple, `litellm_proxy/anthropic.claude-3-5-sonnet-20241022-v2:0`)
|
||||
* `Base URL` à l'URL de votre proxy LiteLLM (par exemple, `https://your-litellm-proxy.com`)
|
||||
* `API Key` à votre clé API du proxy LiteLLM
|
||||
|
||||
## Modèles pris en charge
|
||||
|
||||
Les modèles pris en charge dépendent de la configuration de votre proxy LiteLLM. OpenHands prend en charge tous les modèles que votre proxy LiteLLM est configuré pour gérer.
|
||||
|
||||
Reportez-vous à la configuration de votre proxy LiteLLM pour obtenir la liste des modèles disponibles et leurs noms.
|
||||
@@ -2,17 +2,17 @@
|
||||
|
||||
# 🤖 Backends LLM
|
||||
|
||||
OpenHands peut se connecter à n'importe quel LLM pris en charge par LiteLLM. Cependant, il nécessite un modèle puissant pour fonctionner.
|
||||
OpenHands peut se connecter à n'importe quel LLM supporté par LiteLLM. Cependant, il nécessite un modèle puissant pour fonctionner.
|
||||
|
||||
## Recommandations de modèles
|
||||
|
||||
Sur la base d'une évaluation récente des modèles de langage pour les tâches de codage (en utilisant le jeu de données SWE-bench), nous pouvons fournir quelques recommandations pour la sélection des modèles. L'analyse complète se trouve dans [cet article de blog](https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed).
|
||||
Sur la base de nos évaluations des modèles de langage pour les tâches de codage (en utilisant le jeu de données SWE-bench), nous pouvons fournir quelques recommandations pour la sélection des modèles. Certaines analyses peuvent être trouvées dans [cet article de blog comparant les LLM](https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed) et [cet article de blog avec des résultats plus récents](https://www.all-hands.dev/blog/openhands-codeact-21-an-open-state-of-the-art-software-development-agent).
|
||||
|
||||
Lors du choix d'un modèle, tenez compte à la fois de la qualité des sorties et des coûts associés. Voici un résumé des résultats :
|
||||
Lors du choix d'un modèle, considérez à la fois la qualité des sorties et les coûts associés. Voici un résumé des résultats :
|
||||
|
||||
- Claude 3.5 Sonnet est le meilleur d'une bonne marge, atteignant un taux de résolution de 27% avec l'agent par défaut dans OpenHands.
|
||||
- GPT-4o est à la traîne, et o1-mini a en fait obtenu des résultats légèrement inférieurs à ceux de GPT-4o. Nous avons analysé les résultats un peu, et brièvement, il semblait que o1 "réfléchissait trop" parfois, effectuant des tâches de configuration d'environnement supplémentaires alors qu'il aurait pu simplement aller de l'avant et terminer la tâche.
|
||||
- Enfin, les modèles ouverts les plus puissants étaient Llama 3.1 405 B et deepseek-v2.5, et ils ont obtenu des résultats raisonnables, surpassant même certains des modèles fermés.
|
||||
- Claude 3.5 Sonnet est le meilleur de loin, atteignant un taux de résolution de 53% sur SWE-Bench Verified avec l'agent par défaut dans OpenHands.
|
||||
- GPT-4o est à la traîne, et o1-mini a en fait obtenu des performances légèrement inférieures à celles de GPT-4o. Nous avons analysé les résultats un peu, et brièvement, il semblait que o1 "réfléchissait trop" parfois, effectuant des tâches de configuration d'environnement supplémentaires alors qu'il aurait pu simplement aller de l'avant et terminer la tâche.
|
||||
- Enfin, les modèles ouverts les plus puissants étaient Llama 3.1 405 B et deepseek-v2.5, et ils ont obtenu des performances raisonnables, surpassant même certains des modèles fermés.
|
||||
|
||||
Veuillez vous référer à [l'article complet](https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed) pour plus de détails.
|
||||
|
||||
@@ -32,7 +32,7 @@ Si vous avez réussi à exécuter OpenHands avec des LLM spécifiques qui ne fig
|
||||
Pour une liste complète des fournisseurs et des modèles disponibles, veuillez consulter la [documentation litellm](https://docs.litellm.ai/docs/providers).
|
||||
|
||||
:::note
|
||||
La plupart des modèles locaux et open source actuels ne sont pas aussi puissants. Lorsque vous utilisez de tels modèles, vous pouvez constater de longs temps d'attente entre les messages, des réponses médiocres ou des erreurs concernant du JSON malformé. OpenHands ne peut être aussi puissant que les modèles qui le pilotent. Cependant, si vous en trouvez qui fonctionnent, veuillez les ajouter à la liste vérifiée ci-dessus.
|
||||
La plupart des modèles locaux et open source actuels ne sont pas aussi puissants. Lors de l'utilisation de tels modèles, vous pouvez constater de longs temps d'attente entre les messages, des réponses médiocres ou des erreurs concernant du JSON mal formé. OpenHands ne peut être aussi puissant que les modèles qui le pilotent. Cependant, si vous en trouvez qui fonctionnent, veuillez les ajouter à la liste vérifiée ci-dessus.
|
||||
:::
|
||||
|
||||
## Configuration LLM
|
||||
@@ -44,7 +44,7 @@ Les éléments suivants peuvent être définis dans l'interface utilisateur d'Op
|
||||
- `Clé API`
|
||||
- `URL de base` (via `Paramètres avancés`)
|
||||
|
||||
Certains paramètres peuvent être nécessaires pour certains LLM/fournisseurs qui ne peuvent pas être définis via l'interface utilisateur. Au lieu de cela, ceux-ci peuvent être définis via des variables d'environnement passées à la [commande docker run](/modules/usage/installation#start-the-app) en utilisant `-e` :
|
||||
Il existe certains paramètres qui peuvent être nécessaires pour certains LLM/fournisseurs et qui ne peuvent pas être définis via l'interface utilisateur. Au lieu de cela, ils peuvent être définis via des variables d'environnement passées à la [commande docker run](/modules/usage/installation#start-the-app) en utilisant `-e` :
|
||||
|
||||
- `LLM_API_VERSION`
|
||||
- `LLM_EMBEDDING_MODEL`
|
||||
@@ -58,6 +58,7 @@ Nous avons quelques guides pour exécuter OpenHands avec des fournisseurs de mod
|
||||
- [Azure](llms/azure-llms)
|
||||
- [Google](llms/google-llms)
|
||||
- [Groq](llms/groq)
|
||||
- [LiteLLM Proxy](llms/litellm-proxy)
|
||||
- [OpenAI](llms/openai-llms)
|
||||
- [OpenRouter](llms/openrouter)
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ Lors de l'utilisation d'un LLM local, OpenHands peut avoir des fonctionnalités
|
||||
Assurez-vous que le serveur Ollama est opérationnel.
|
||||
Pour des instructions détaillées sur le démarrage, référez-vous à [ici](https://github.com/ollama/ollama).
|
||||
|
||||
Ce guide suppose que vous avez démarré ollama avec `ollama serve`. Si vous exécutez ollama différemment (par exemple, à l'intérieur de docker), les instructions peuvent nécessiter des modifications. Veuillez noter que si vous utilisez WSL, la configuration par défaut d'ollama bloque les requêtes provenant des conteneurs docker. Voir [ici](#configuring-ollama-service-wsl-fr).
|
||||
Ce guide suppose que vous avez démarré ollama avec `ollama serve`. Si vous exécutez ollama différemment (par exemple dans docker), les instructions peuvent nécessiter des modifications. Veuillez noter que si vous utilisez WSL, la configuration par défaut d'ollama bloque les requêtes provenant des conteneurs docker. Voir [ici](#configuring-ollama-service-wsl-fr).
|
||||
|
||||
## Récupérer les modèles
|
||||
|
||||
Les noms des modèles Ollama peuvent être trouvés [ici](https://ollama.com/library). Pour un petit exemple, vous pouvez utiliser le modèle `codellama:7b`. Les modèles plus grands auront généralement de meilleures performances.
|
||||
Les noms des modèles Ollama peuvent être trouvés [ici](https://ollama.com/library). Pour un petit exemple, vous pouvez utiliser le modèle `codellama:7b`. Les modèles plus gros auront généralement de meilleures performances.
|
||||
|
||||
```bash
|
||||
ollama pull codellama:7b
|
||||
@@ -36,46 +36,29 @@ Utilisez les instructions [ici](../getting-started) pour démarrer OpenHands en
|
||||
Mais lorsque vous exécutez `docker run`, vous devrez ajouter quelques arguments supplémentaires :
|
||||
|
||||
```bash
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
-e LLM_OLLAMA_BASE_URL="http://host.docker.internal:11434" \
|
||||
```
|
||||
|
||||
LLM_OLLAMA_BASE_URL est facultatif. Si vous le définissez, il sera utilisé pour afficher les modèles installés disponibles dans l'interface utilisateur.
|
||||
|
||||
Exemple :
|
||||
|
||||
```bash
|
||||
# Le répertoire que vous voulez qu'OpenHands modifie. DOIT être un chemin absolu !
|
||||
export WORKSPACE_BASE=$(pwd)/workspace
|
||||
|
||||
docker run \
|
||||
-it \
|
||||
--pull=always \
|
||||
docker run # ...
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e LLM_OLLAMA_BASE_URL="http://host.docker.internal:11434" \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
ghcr.io/all-hands-ai/openhands:main
|
||||
# ...
|
||||
```
|
||||
|
||||
Vous devriez maintenant pouvoir vous connecter à `http://localhost:3000/`
|
||||
LLM_OLLAMA_BASE_URL est optionnel. Si vous le définissez, il sera utilisé pour afficher
|
||||
les modèles installés disponibles dans l'interface utilisateur.
|
||||
|
||||
|
||||
### Configurer l'application Web
|
||||
|
||||
Lors de l'exécution d'`openhands`, vous devrez définir les éléments suivants dans l'interface utilisateur d'OpenHands via les paramètres :
|
||||
- le modèle à "ollama/<nom-du-modèle>"
|
||||
- l'URL de base à `http://host.docker.internal:11434`
|
||||
- la clé API est facultative, vous pouvez utiliser n'importe quelle chaîne, comme `ollama`.
|
||||
- la clé API est optionnelle, vous pouvez utiliser n'importe quelle chaîne, comme `ollama`.
|
||||
|
||||
|
||||
## Exécuter OpenHands en mode développement
|
||||
|
||||
### Construire à partir de la source
|
||||
### Compiler à partir du code source
|
||||
|
||||
Utilisez les instructions dans [Development.md](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md) pour construire OpenHands.
|
||||
Utilisez les instructions dans [Development.md](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md) pour compiler OpenHands.
|
||||
Assurez-vous que `config.toml` est présent en exécutant `make setup-config` qui en créera un pour vous. Dans `config.toml`, entrez ce qui suit :
|
||||
|
||||
```
|
||||
@@ -94,7 +77,7 @@ Terminé ! Vous pouvez maintenant démarrer OpenHands avec : `make run`. Vous de
|
||||
|
||||
Dans l'interface utilisateur d'OpenHands, cliquez sur la roue des paramètres dans le coin inférieur gauche.
|
||||
Ensuite, dans le champ `Model`, entrez `ollama/codellama:7b`, ou le nom du modèle que vous avez récupéré précédemment.
|
||||
S'il n'apparaît pas dans le menu déroulant, activez `Advanced Settings` et tapez-le. Veuillez noter : vous avez besoin du nom du modèle tel qu'il est listé par `ollama list`, avec le préfixe `ollama/`.
|
||||
S'il n'apparaît pas dans la liste déroulante, activez `Advanced Settings` et tapez-le. Veuillez noter : vous avez besoin du nom du modèle tel qu'il est listé par `ollama list`, avec le préfixe `ollama/`.
|
||||
|
||||
Dans le champ API Key, entrez `ollama` ou n'importe quelle valeur, puisque vous n'avez pas besoin d'une clé particulière.
|
||||
|
||||
@@ -104,24 +87,24 @@ Et maintenant vous êtes prêt à démarrer !
|
||||
|
||||
## Configurer le service ollama (WSL) {#configuring-ollama-service-wsl-fr}
|
||||
|
||||
La configuration par défaut pour ollama dans WSL ne sert que localhost. Cela signifie que vous ne pouvez pas y accéder depuis un conteneur docker. Par ex. cela ne fonctionnera pas avec OpenHands. Testons d'abord qu'ollama fonctionne correctement.
|
||||
La configuration par défaut d'ollama dans WSL ne sert que localhost. Cela signifie que vous ne pouvez pas y accéder depuis un conteneur docker. Par ex. cela ne fonctionnera pas avec OpenHands. Testons d'abord qu'ollama fonctionne correctement.
|
||||
|
||||
```bash
|
||||
ollama list # obtenir la liste des modèles installés
|
||||
curl http://localhost:11434/api/generate -d '{"model":"[NOM]","prompt":"hi"}'
|
||||
#ex. curl http://localhost:11434/api/generate -d '{"model":"codellama:7b","prompt":"hi"}'
|
||||
#ex. curl http://localhost:11434/api/generate -d '{"model":"codellama","prompt":"hi"}' #le tag est facultatif s'il n'y en a qu'un seul
|
||||
#ex. curl http://localhost:11434/api/generate -d '{"model":"codellama","prompt":"hi"}' #le tag est optionnel s'il n'y en a qu'un
|
||||
```
|
||||
|
||||
Une fois cela fait, testez qu'il autorise les requêtes "extérieures", comme celles provenant d'un conteneur docker.
|
||||
|
||||
```bash
|
||||
docker ps # obtenir la liste des conteneurs docker en cours d'exécution, pour un test plus précis, choisissez le conteneur sandbox OpenHands.
|
||||
docker ps # obtenir la liste des conteneurs docker en cours d'exécution, pour un test plus précis choisissez le conteneur sandbox OpenHands.
|
||||
docker exec [ID CONTENEUR] curl http://host.docker.internal:11434/api/generate -d '{"model":"[NOM]","prompt":"hi"}'
|
||||
#ex. docker exec cd9cc82f7a11 curl http://host.docker.internal:11434/api/generate -d '{"model":"codellama","prompt":"hi"}'
|
||||
```
|
||||
|
||||
## Le réparer
|
||||
## Résoudre le problème
|
||||
|
||||
Maintenant, faisons en sorte que cela fonctionne. Modifiez /etc/systemd/system/ollama.service avec des privilèges sudo. (Le chemin peut varier selon la distribution Linux)
|
||||
|
||||
@@ -135,14 +118,14 @@ ou
|
||||
sudo nano /etc/systemd/system/ollama.service
|
||||
```
|
||||
|
||||
Dans le crochet [Service], ajoutez ces lignes
|
||||
Dans le bloc [Service], ajoutez ces lignes
|
||||
|
||||
```
|
||||
Environment="OLLAMA_HOST=0.0.0.0:11434"
|
||||
Environment="OLLAMA_ORIGINS=*"
|
||||
```
|
||||
|
||||
Ensuite, enregistrez, rechargez la configuration et redémarrez le service.
|
||||
Ensuite, sauvegardez, rechargez la configuration et redémarrez le service.
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
@@ -153,7 +136,7 @@ Enfin, testez qu'ollama est accessible depuis le conteneur
|
||||
|
||||
```bash
|
||||
ollama list # obtenir la liste des modèles installés
|
||||
docker ps # obtenir la liste des conteneurs docker en cours d'exécution, pour un test plus précis, choisissez le conteneur sandbox OpenHands.
|
||||
docker ps # obtenir la liste des conteneurs docker en cours d'exécution, pour un test plus précis choisissez le conteneur sandbox OpenHands.
|
||||
docker exec [ID CONTENEUR] curl http://host.docker.internal:11434/api/generate -d '{"model":"[NOM]","prompt":"hi"}'
|
||||
```
|
||||
|
||||
@@ -164,7 +147,7 @@ docker exec [ID CONTENEUR] curl http://host.docker.internal:11434/api/generate -
|
||||
1. Ouvrez LM Studio
|
||||
2. Allez dans l'onglet Serveur local.
|
||||
3. Cliquez sur le bouton "Démarrer le serveur".
|
||||
4. Sélectionnez le modèle que vous souhaitez utiliser dans le menu déroulant.
|
||||
4. Sélectionnez le modèle que vous souhaitez utiliser dans la liste déroulante.
|
||||
|
||||
|
||||
Définissez les configurations suivantes :
|
||||
@@ -177,18 +160,11 @@ CUSTOM_LLM_PROVIDER="openai"
|
||||
### Docker
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
-it \
|
||||
--pull=always \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
docker run # ...
|
||||
-e LLM_MODEL="openai/lmstudio" \
|
||||
-e LLM_BASE_URL="http://host.docker.internal:1234/v1" \
|
||||
-e CUSTOM_LLM_PROVIDER="openai" \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
ghcr.io/all-hands-ai/openhands:main
|
||||
# ...
|
||||
```
|
||||
|
||||
Vous devriez maintenant pouvoir vous connecter à `http://localhost:3000/`
|
||||
@@ -209,7 +185,7 @@ Terminé ! Vous pouvez maintenant démarrer OpenHands avec : `make run` sans Doc
|
||||
|
||||
# Note
|
||||
|
||||
Pour WSL, exécutez les commandes suivantes dans cmd pour configurer le mode réseau en mode miroir :
|
||||
Pour WSL, exécutez les commandes suivantes dans cmd pour configurer le mode réseau en miroir :
|
||||
|
||||
```
|
||||
python -c "print('[wsl2]\nnetworkingMode=mirrored',file=open(r'%UserProfile%\.wslconfig','w'))"
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
|
||||
# Personnalisation du comportement de l'agent
|
||||
|
||||
OpenHands peut être personnalisé pour fonctionner plus efficacement avec des dépôts spécifiques en fournissant un contexte et des directives propres à chaque dépôt. Cette section explique comment optimiser OpenHands pour votre projet.
|
||||
|
||||
## Configuration du dépôt
|
||||
|
||||
Vous pouvez personnaliser le comportement d'OpenHands pour votre dépôt en créant un répertoire `.openhands` à la racine de votre dépôt. Au minimum, il doit contenir le fichier `.openhands/microagents/repo.md`, qui comprend les instructions qui seront données à l'agent chaque fois qu'il travaillera avec ce dépôt.
|
||||
|
||||
Nous vous suggérons d'inclure les informations suivantes :
|
||||
1. **Aperçu du dépôt** : Une brève description de l'objectif et de l'architecture de votre projet
|
||||
2. **Structure des répertoires** : Les répertoires clés et leurs objectifs
|
||||
3. **Directives de développement** : Les normes et pratiques de codage spécifiques au projet
|
||||
4. **Exigences de test** : Comment exécuter les tests et quels types de tests sont requis
|
||||
5. **Instructions de configuration** : Les étapes nécessaires pour construire et exécuter le projet
|
||||
|
||||
### Exemple de configuration de dépôt
|
||||
Exemple de fichier `.openhands/microagents/repo.md` :
|
||||
```
|
||||
Repository: MonProjet
|
||||
Description: Une application web pour la gestion des tâches
|
||||
|
||||
Structure des répertoires :
|
||||
- src/ : Code principal de l'application
|
||||
- tests/ : Fichiers de test
|
||||
- docs/ : Documentation
|
||||
|
||||
Configuration :
|
||||
- Exécutez `npm install` pour installer les dépendances
|
||||
- Utilisez `npm run dev` pour le développement
|
||||
- Exécutez `npm test` pour les tests
|
||||
|
||||
Directives :
|
||||
- Suivez la configuration ESLint
|
||||
- Écrivez des tests pour toutes les nouvelles fonctionnalités
|
||||
- Utilisez TypeScript pour le nouveau code
|
||||
```
|
||||
|
||||
### Personnalisation des prompts
|
||||
|
||||
Lorsque vous travaillez avec un dépôt personnalisé :
|
||||
|
||||
1. **Référencez les normes du projet** : Mentionnez les normes ou les modèles de codage spécifiques utilisés dans votre projet
|
||||
2. **Incluez le contexte** : Faites référence à la documentation pertinente ou aux implémentations existantes
|
||||
3. **Spécifiez les exigences de test** : Incluez les exigences de test spécifiques au projet dans vos prompts
|
||||
|
||||
Exemple de prompt personnalisé :
|
||||
```
|
||||
Ajoutez une nouvelle fonctionnalité d'achèvement des tâches à src/components/TaskList.tsx en suivant nos modèles de composants existants.
|
||||
Incluez des tests unitaires dans tests/components/ et mettez à jour la documentation dans docs/features/.
|
||||
Le composant doit utiliser notre style partagé de src/styles/components.
|
||||
```
|
||||
|
||||
### Meilleures pratiques pour la personnalisation du dépôt
|
||||
|
||||
1. **Gardez les instructions à jour** : Mettez régulièrement à jour votre répertoire `.openhands` au fur et à mesure de l'évolution de votre projet
|
||||
2. **Soyez spécifique** : Incluez des chemins, des modèles et des exigences spécifiques à votre projet
|
||||
3. **Documentez les dépendances** : Énumérez tous les outils et dépendances nécessaires au développement
|
||||
4. **Incluez des exemples** : Fournissez des exemples de bons modèles de code de votre projet
|
||||
5. **Spécifiez les conventions** : Documentez les conventions de nommage, l'organisation des fichiers et les préférences de style de code
|
||||
|
||||
En personnalisant OpenHands pour votre dépôt, vous obtiendrez des résultats plus précis et cohérents qui s'alignent sur les normes et les exigences de votre projet.
|
||||
|
||||
## Autres microagents
|
||||
Vous pouvez créer d'autres instructions dans le répertoire `.openhands/microagents/` qui seront envoyées à l'agent si un mot-clé particulier est trouvé, comme `test`, `frontend` ou `migration`. Voir [Microagents](microagents.md) pour plus d'informations.
|
||||
@@ -0,0 +1,215 @@
|
||||
|
||||
|
||||
# Micro-Agents
|
||||
|
||||
OpenHands utilise des micro-agents spécialisés pour gérer efficacement des tâches et des contextes spécifiques. Ces micro-agents sont de petits composants ciblés qui fournissent un comportement et des connaissances spécialisés pour des scénarios particuliers.
|
||||
|
||||
## Aperçu
|
||||
|
||||
Les micro-agents sont définis dans des fichiers markdown sous le répertoire `openhands/agenthub/codeact_agent/micro/`. Chaque micro-agent est configuré avec :
|
||||
|
||||
- Un nom unique
|
||||
- Le type d'agent (généralement CodeActAgent)
|
||||
- Des mots-clés déclencheurs qui activent l'agent
|
||||
- Des instructions et des capacités spécifiques
|
||||
|
||||
## Micro-Agents Disponibles
|
||||
|
||||
### Agent GitHub
|
||||
**Fichier** : `github.md`
|
||||
**Déclencheurs** : `github`, `git`
|
||||
|
||||
L'agent GitHub se spécialise dans les interactions avec l'API GitHub et la gestion des dépôts. Il :
|
||||
- A accès à un `GITHUB_TOKEN` pour l'authentification API
|
||||
- Suit des directives strictes pour les interactions avec les dépôts
|
||||
- Gère les branches et les pull requests
|
||||
- Utilise l'API GitHub au lieu des interactions avec le navigateur web
|
||||
|
||||
Fonctionnalités clés :
|
||||
- Protection des branches (empêche les push directs vers main/master)
|
||||
- Création automatisée de PR
|
||||
- Gestion de la configuration Git
|
||||
- Approche API-first pour les opérations GitHub
|
||||
|
||||
### Agent NPM
|
||||
**Fichier** : `npm.md`
|
||||
**Déclencheurs** : `npm`
|
||||
|
||||
Se spécialise dans la gestion des packages npm avec un focus spécifique sur :
|
||||
- Les opérations shell non interactives
|
||||
- La gestion automatisée des confirmations en utilisant la commande Unix 'yes'
|
||||
- L'automatisation de l'installation des packages
|
||||
|
||||
### Micro-Agents Personnalisés
|
||||
|
||||
Vous pouvez créer vos propres micro-agents en ajoutant de nouveaux fichiers markdown dans le répertoire des micro-agents. Chaque fichier doit suivre cette structure :
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: nom_de_l_agent
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- mot_declencheur1
|
||||
- mot_declencheur2
|
||||
---
|
||||
|
||||
Instructions et capacités pour le micro-agent...
|
||||
```
|
||||
|
||||
## Bonnes Pratiques
|
||||
|
||||
Lorsque vous travaillez avec des micro-agents :
|
||||
|
||||
1. **Utilisez les déclencheurs appropriés** : Assurez-vous que vos commandes incluent les mots-clés déclencheurs pertinents pour activer le bon micro-agent
|
||||
2. **Suivez les directives de l'agent** : Chaque agent a des instructions et des limitations spécifiques - respectez-les pour des résultats optimaux
|
||||
3. **Approche API-First** : Lorsque c'est possible, utilisez les endpoints d'API plutôt que les interfaces web
|
||||
4. **Automatisation conviviale** : Concevez des commandes qui fonctionnent bien dans des environnements non interactifs
|
||||
|
||||
## Intégration
|
||||
|
||||
Les micro-agents sont automatiquement intégrés dans le workflow d'OpenHands. Ils :
|
||||
- Surveillent les commandes entrantes pour détecter leurs mots-clés déclencheurs
|
||||
- S'activent lorsque des déclencheurs pertinents sont détectés
|
||||
- Appliquent leurs connaissances et capacités spécialisées
|
||||
- Suivent leurs directives et restrictions spécifiques
|
||||
|
||||
## Exemple d'utilisation
|
||||
|
||||
```bash
|
||||
# Exemple d'agent GitHub
|
||||
git checkout -b feature-branch
|
||||
git commit -m "Add new feature"
|
||||
git push origin feature-branch
|
||||
|
||||
# Exemple d'agent NPM
|
||||
yes | npm install package-name
|
||||
```
|
||||
|
||||
Pour plus d'informations sur des agents spécifiques, reportez-vous à leurs fichiers de documentation individuels dans le répertoire des micro-agents.
|
||||
|
||||
## Contribuer un Micro-Agent
|
||||
|
||||
Pour contribuer un nouveau micro-agent à OpenHands, suivez ces directives :
|
||||
|
||||
### 1. Planification de votre Micro-Agent
|
||||
|
||||
Avant de créer un micro-agent, considérez :
|
||||
- Quel problème ou cas d'utilisation spécifique va-t-il adresser ?
|
||||
- Quelles capacités ou connaissances uniques devrait-il avoir ?
|
||||
- Quels mots-clés déclencheurs ont du sens pour l'activer ?
|
||||
- Quelles contraintes ou directives devrait-il suivre ?
|
||||
|
||||
### 2. Structure du fichier
|
||||
|
||||
Créez un nouveau fichier markdown dans `openhands/agenthub/codeact_agent/micro/` avec un nom descriptif (par ex., `docker.md` pour un agent axé sur Docker).
|
||||
|
||||
### 3. Composants requis
|
||||
|
||||
Votre fichier de micro-agent doit inclure :
|
||||
|
||||
1. **Front Matter** : Métadonnées YAML au début du fichier :
|
||||
```markdown
|
||||
---
|
||||
name: nom_de_votre_agent
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- mot_declencheur1
|
||||
- mot_declencheur2
|
||||
---
|
||||
```
|
||||
|
||||
2. **Instructions** : Directives claires et spécifiques pour le comportement de l'agent :
|
||||
```markdown
|
||||
Vous êtes responsable de [tâche/domaine spécifique].
|
||||
|
||||
Responsabilités clés :
|
||||
1. [Responsabilité 1]
|
||||
2. [Responsabilité 2]
|
||||
|
||||
Directives :
|
||||
- [Directive 1]
|
||||
- [Directive 2]
|
||||
|
||||
Exemples d'utilisation :
|
||||
[Exemple 1]
|
||||
[Exemple 2]
|
||||
```
|
||||
|
||||
### 4. Bonnes pratiques pour le développement de Micro-Agents
|
||||
|
||||
1. **Portée claire** : Gardez l'agent concentré sur un domaine ou une tâche spécifique
|
||||
2. **Instructions explicites** : Fournissez des directives claires et sans ambiguïté
|
||||
3. **Exemples utiles** : Incluez des exemples pratiques de cas d'utilisation courants
|
||||
4. **Sécurité d'abord** : Incluez les avertissements et contraintes nécessaires
|
||||
5. **Conscience de l'intégration** : Considérez comment l'agent interagit avec les autres composants
|
||||
|
||||
### 5. Tester votre Micro-Agent
|
||||
|
||||
Avant de soumettre :
|
||||
1. Testez l'agent avec divers prompts
|
||||
2. Vérifiez que les mots-clés déclencheurs activent correctement l'agent
|
||||
3. Assurez-vous que les instructions sont claires et complètes
|
||||
4. Vérifiez les conflits potentiels avec les agents existants
|
||||
|
||||
### 6. Exemple d'implémentation
|
||||
|
||||
Voici un modèle pour un nouveau micro-agent :
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: docker
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- docker
|
||||
- conteneur
|
||||
---
|
||||
|
||||
Vous êtes responsable de la gestion des conteneurs Docker et de la création de Dockerfiles.
|
||||
|
||||
Responsabilités clés :
|
||||
1. Créer et modifier des Dockerfiles
|
||||
2. Gérer le cycle de vie des conteneurs
|
||||
3. Gérer les configurations Docker Compose
|
||||
|
||||
Directives :
|
||||
- Utilisez toujours des images de base officielles lorsque possible
|
||||
- Incluez les considérations de sécurité nécessaires
|
||||
- Suivez les bonnes pratiques Docker pour l'optimisation des couches
|
||||
|
||||
Exemples :
|
||||
1. Créer un Dockerfile :
|
||||
```dockerfile
|
||||
FROM node:18-alpine
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
CMD ["npm", "start"]
|
||||
```
|
||||
|
||||
2. Utilisation de Docker Compose :
|
||||
```yaml
|
||||
version: '3'
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000"
|
||||
```
|
||||
|
||||
N'oubliez pas de :
|
||||
- Valider la syntaxe du Dockerfile
|
||||
- Vérifier les vulnérabilités de sécurité
|
||||
- Optimiser le temps de build et la taille de l'image
|
||||
```
|
||||
|
||||
### 7. Processus de soumission
|
||||
|
||||
1. Créez votre fichier de micro-agent dans le bon répertoire
|
||||
2. Testez minutieusement
|
||||
3. Soumettez une pull request avec :
|
||||
- Le nouveau fichier de micro-agent
|
||||
- La documentation mise à jour si nécessaire
|
||||
- La description du but et des capacités de l'agent
|
||||
|
||||
N'oubliez pas que les micro-agents sont un moyen puissant d'étendre les capacités d'OpenHands dans des domaines spécifiques. Des agents bien conçus peuvent améliorer significativement la capacité du système à gérer des tâches spécialisées.
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
# Meilleures pratiques pour les prompts
|
||||
|
||||
Lorsque vous travaillez avec le développeur de logiciels OpenHands AI, il est crucial de fournir des prompts clairs et efficaces. Ce guide décrit les meilleures pratiques pour créer des prompts qui produiront les réponses les plus précises et les plus utiles.
|
||||
|
||||
## Caractéristiques des bons prompts
|
||||
|
||||
Les bons prompts sont :
|
||||
|
||||
1. **Concrets** : Ils expliquent exactement quelle fonctionnalité doit être ajoutée ou quelle erreur doit être corrigée.
|
||||
2. **Spécifiques à l'emplacement** : Si connu, ils expliquent les emplacements dans la base de code qui doivent être modifiés.
|
||||
3. **Correctement dimensionnés** : Ils doivent avoir la taille d'une seule fonctionnalité, ne dépassant généralement pas 100 lignes de code.
|
||||
|
||||
## Exemples
|
||||
|
||||
### Exemples de bons prompts
|
||||
|
||||
1. "Ajoutez une fonction `calculate_average` dans `utils/math_operations.py` qui prend une liste de nombres en entrée et renvoie leur moyenne."
|
||||
|
||||
2. "Corrigez le TypeError dans `frontend/src/components/UserProfile.tsx` se produisant à la ligne 42. L'erreur suggère que nous essayons d'accéder à une propriété de undefined."
|
||||
|
||||
3. "Implémentez la validation des entrées pour le champ email dans le formulaire d'inscription. Mettez à jour `frontend/src/components/RegistrationForm.tsx` pour vérifier si l'email est dans un format valide avant la soumission."
|
||||
|
||||
### Exemples de mauvais prompts
|
||||
|
||||
1. "Améliorez le code." (Trop vague, pas concret)
|
||||
|
||||
2. "Réécrivez tout le backend pour utiliser un framework différent." (Pas correctement dimensionné)
|
||||
|
||||
3. "Il y a un bug quelque part dans l'authentification des utilisateurs. Pouvez-vous le trouver et le corriger ?" (Manque de spécificité et d'informations de localisation)
|
||||
|
||||
## Conseils pour des prompts efficaces
|
||||
|
||||
1. Soyez aussi précis que possible sur le résultat souhaité ou le problème à résoudre.
|
||||
2. Fournissez du contexte, y compris les chemins de fichiers et les numéros de ligne pertinents si disponibles.
|
||||
3. Décomposez les grandes tâches en prompts plus petits et gérables.
|
||||
4. Incluez tous les messages d'erreur ou logs pertinents.
|
||||
5. Spécifiez le langage de programmation ou le framework s'il n'est pas évident d'après le contexte.
|
||||
|
||||
N'oubliez pas, plus votre prompt est précis et informatif, mieux l'IA pourra vous aider à développer ou à modifier le logiciel OpenHands.
|
||||
|
||||
Voir [Démarrer avec OpenHands](../getting-started) pour plus d'exemples de prompts utiles.
|
||||
@@ -0,0 +1,78 @@
|
||||
|
||||
|
||||
# Configuration d'exécution
|
||||
|
||||
Un Runtime est un environnement où l'agent OpenHands peut modifier des fichiers et exécuter des commandes.
|
||||
|
||||
Par défaut, OpenHands utilise un runtime basé sur Docker, s'exécutant sur votre ordinateur local. Cela signifie que vous n'avez à payer que pour le LLM que vous utilisez, et votre code n'est envoyé qu'au LLM.
|
||||
|
||||
Nous prenons également en charge les runtimes "distants", qui sont généralement gérés par des tiers. Ils peuvent simplifier la configuration et la rendre plus évolutive, en particulier si vous exécutez de nombreuses conversations OpenHands en parallèle (par exemple pour faire de l'évaluation).
|
||||
|
||||
## Runtime Docker
|
||||
C'est le Runtime par défaut qui est utilisé lorsque vous démarrez OpenHands. Vous remarquerez peut-être que certains flags sont passés à `docker run` pour rendre cela possible :
|
||||
|
||||
```
|
||||
docker run # ...
|
||||
-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 \
|
||||
# ...
|
||||
```
|
||||
|
||||
Le `SANDBOX_RUNTIME_CONTAINER_IMAGE` de nikolaik est une image de runtime pré-construite qui contient notre serveur Runtime, ainsi que quelques utilitaires de base pour Python et NodeJS. Vous pouvez également [construire votre propre image de runtime](how-to/custom-sandbox-guide).
|
||||
|
||||
### Connexion à votre système de fichiers
|
||||
Une fonctionnalité utile ici est la possibilité de se connecter à votre système de fichiers local.
|
||||
|
||||
Pour monter votre système de fichiers dans le runtime, définissez d'abord WORKSPACE_BASE :
|
||||
```bash
|
||||
export WORKSPACE_BASE=/chemin/vers/votre/code
|
||||
|
||||
# Exemple Linux et Mac
|
||||
# export WORKSPACE_BASE=$HOME/OpenHands
|
||||
# Définira $WORKSPACE_BASE sur /home/<username>/OpenHands
|
||||
#
|
||||
# Exemple WSL sur Windows
|
||||
# export WORKSPACE_BASE=/mnt/c/dev/OpenHands
|
||||
# Définira $WORKSPACE_BASE sur C:\dev\OpenHands
|
||||
```
|
||||
|
||||
puis ajoutez les options suivantes à la commande `docker run` :
|
||||
|
||||
```bash
|
||||
docker run # ...
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
# ...
|
||||
```
|
||||
|
||||
Attention ! Rien n'empêche l'agent OpenHands de supprimer ou de modifier les fichiers montés dans son espace de travail.
|
||||
|
||||
Cette configuration peut causer des problèmes de permissions de fichiers (d'où la variable `SANDBOX_USER_ID`) mais semble bien fonctionner sur la plupart des systèmes.
|
||||
|
||||
## Runtime All Hands
|
||||
Le Runtime All Hands est actuellement en version bêta. Vous pouvez demander l'accès en rejoignant le canal #remote-runtime-limited-beta sur Slack ([voir le README](https://github.com/All-Hands-AI/OpenHands?tab=readme-ov-file#-join-our-community) pour une invitation).
|
||||
|
||||
Pour utiliser le Runtime All Hands, définissez les variables d'environnement suivantes lors du démarrage d'OpenHands :
|
||||
|
||||
```bash
|
||||
docker run # ...
|
||||
-e RUNTIME=remote \
|
||||
-e SANDBOX_REMOTE_RUNTIME_API_URL="https://runtime.app.all-hands.dev" \
|
||||
-e SANDBOX_API_KEY="votre-clé-api-all-hands" \
|
||||
-e SANDBOX_KEEP_RUNTIME_ALIVE="true" \
|
||||
# ...
|
||||
```
|
||||
|
||||
## Runtime Modal
|
||||
Nos partenaires de [Modal](https://modal.com/) ont également fourni un runtime pour OpenHands.
|
||||
|
||||
Pour utiliser le Runtime Modal, créez un compte, puis [créez une clé API.](https://modal.com/settings)
|
||||
|
||||
Vous devrez ensuite définir les variables d'environnement suivantes lors du démarrage d'OpenHands :
|
||||
```bash
|
||||
docker run # ...
|
||||
-e RUNTIME=modal \
|
||||
-e MODAL_API_TOKEN_ID="votre-id" \
|
||||
-e MODAL_API_TOKEN_SECRET="votre-secret" \
|
||||
```
|
||||
@@ -2,149 +2,45 @@
|
||||
|
||||
# 🚧 Dépannage
|
||||
|
||||
Il y a certains messages d'erreur qui sont fréquemment signalés par les utilisateurs.
|
||||
Nous allons essayer de rendre le processus d'installation plus facile, mais pour l'instant vous pouvez rechercher votre message d'erreur ci-dessous et voir s'il y a des solutions de contournement.
|
||||
Si vous trouvez plus d'informations ou une solution de contournement pour l'un de ces problèmes, veuillez ouvrir une *PR* pour ajouter des détails à ce fichier.
|
||||
|
||||
:::tip
|
||||
OpenHands ne prend en charge Windows que via [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
|
||||
Veuillez vous assurer d'exécuter toutes les commandes à l'intérieur de votre terminal WSL.
|
||||
OpenHands ne prend en charge Windows que via WSL. Veuillez vous assurer d'exécuter toutes les commandes dans votre terminal WSL.
|
||||
:::
|
||||
|
||||
## Problèmes courants
|
||||
### Échec du lancement du client docker
|
||||
|
||||
* [Impossible de se connecter à Docker](#impossible-de-se-connecter-à-docker)
|
||||
* [404 Ressource introuvable](#404-ressource-introuvable)
|
||||
* [`make build` bloqué sur les installations de paquets](#make-build-bloqué-sur-les-installations-de-paquets)
|
||||
* [Les sessions ne sont pas restaurées](#les-sessions-ne-sont-pas-restaurées)
|
||||
**Description**
|
||||
|
||||
### Impossible de se connecter à Docker
|
||||
|
||||
[GitHub Issue](https://github.com/All-Hands-AI/OpenHands/issues/1226)
|
||||
|
||||
**Symptômes**
|
||||
|
||||
```bash
|
||||
Error creating controller. Please check Docker is running and visit `https://docs.all-hands.dev/modules/usage/troubleshooting` for more debugging information.
|
||||
Lors de l'exécution d'OpenHands, l'erreur suivante est observée :
|
||||
```
|
||||
Launch docker client failed. Please make sure you have installed docker and started docker desktop/daemon.
|
||||
```
|
||||
|
||||
```bash
|
||||
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
|
||||
```
|
||||
|
||||
**Détails**
|
||||
|
||||
OpenHands utilise un conteneur Docker pour faire son travail en toute sécurité, sans risquer de casser votre machine.
|
||||
|
||||
**Solutions de contournement**
|
||||
|
||||
* Exécutez `docker ps` pour vous assurer que docker est en cours d'exécution
|
||||
* Assurez-vous que vous n'avez pas besoin de `sudo` pour exécuter docker [voir ici](https://www.baeldung.com/linux/docker-run-without-sudo)
|
||||
* Si vous êtes sur un Mac, vérifiez les [exigences d'autorisation](https://docs.docker.com/desktop/mac/permission-requirements/) et en particulier envisagez d'activer `Allow the default Docker socket to be used` sous `Settings > Advanced` dans Docker Desktop.
|
||||
* De plus, mettez à niveau votre Docker vers la dernière version sous `Check for Updates`
|
||||
**Résolution**
|
||||
|
||||
Essayez ces étapes dans l'ordre :
|
||||
* Vérifiez que `docker` est en cours d'exécution sur votre système. Vous devriez pouvoir exécuter `docker ps` dans le terminal avec succès.
|
||||
* Si vous utilisez Docker Desktop, assurez-vous que `Settings > Advanced > Allow the default Docker socket to be used` est activé.
|
||||
* Selon votre configuration, vous devrez peut-être activer `Settings > Resources > Network > Enable host networking` dans Docker Desktop.
|
||||
* Réinstallez Docker Desktop.
|
||||
---
|
||||
### `404 Ressource introuvable`
|
||||
|
||||
**Symptômes**
|
||||
# Spécifique au flux de travail de développement
|
||||
### Erreur lors de la construction de l'image docker du runtime
|
||||
|
||||
```python
|
||||
Traceback (most recent call last):
|
||||
File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai.py", line 414, in completion
|
||||
raise e
|
||||
File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai.py", line 373, in completion
|
||||
response = openai_client.chat.completions.create(**data, timeout=timeout) # type: ignore
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_utils/_utils.py", line 277, in wrapper
|
||||
return func(*args, **kwargs)
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/resources/chat/completions.py", line 579, in create
|
||||
return self._post(
|
||||
^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1232, in post
|
||||
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 921, in request
|
||||
return self._request(
|
||||
^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1012, in _request
|
||||
raise self._make_status_error_from_response(err.response) from None
|
||||
openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}
|
||||
**Description**
|
||||
|
||||
Les tentatives de démarrage d'une nouvelle session échouent et des erreurs contenant des termes comme les suivants apparaissent dans les logs :
|
||||
```
|
||||
debian-security bookworm-security
|
||||
InRelease At least one invalid signature was encountered.
|
||||
```
|
||||
|
||||
**Détails**
|
||||
Cela semble se produire lorsque le hash d'une bibliothèque externe existante change et que votre instance docker locale a
|
||||
mis en cache une version précédente. Pour contourner ce problème, veuillez essayer ce qui suit :
|
||||
|
||||
Cela se produit lorsque LiteLLM (notre bibliothèque pour se connecter à différents fournisseurs de LLM) ne peut pas trouver le point de terminaison d'API auquel vous essayez de vous connecter. Le plus souvent, cela se produit pour les utilisateurs d'Azure ou d'ollama.
|
||||
|
||||
**Solutions de contournement**
|
||||
|
||||
* Vérifiez que vous avez correctement défini `LLM_BASE_URL`
|
||||
* Vérifiez que le modèle est correctement défini, en fonction de la [documentation de LiteLLM](https://docs.litellm.ai/docs/providers)
|
||||
* Si vous exécutez dans l'interface utilisateur, assurez-vous de définir le `model` dans la fenêtre modale des paramètres
|
||||
* Si vous exécutez en mode headless (via main.py), assurez-vous de définir `LLM_MODEL` dans votre env/config
|
||||
* Assurez-vous d'avoir suivi toutes les instructions spéciales pour votre fournisseur de LLM
|
||||
* [Azure](/modules/usage/llms/azure-llms)
|
||||
* [Google](/modules/usage/llms/google-llms)
|
||||
* Assurez-vous que votre clé API est correcte
|
||||
* Voyez si vous pouvez vous connecter au LLM en utilisant `curl`
|
||||
* Essayez de [vous connecter directement via LiteLLM](https://github.com/BerriAI/litellm) pour tester votre configuration
|
||||
|
||||
---
|
||||
### `make build` bloqué sur les installations de paquets
|
||||
|
||||
**Symptômes**
|
||||
|
||||
L'installation des paquets est bloquée sur `Pending...` sans aucun message d'erreur :
|
||||
|
||||
```bash
|
||||
Package operations: 286 installs, 0 updates, 0 removals
|
||||
|
||||
- Installing certifi (2024.2.2): Pending...
|
||||
- Installing h11 (0.14.0): Pending...
|
||||
- Installing idna (3.7): Pending...
|
||||
- Installing sniffio (1.3.1): Pending...
|
||||
- Installing typing-extensions (4.11.0): Pending...
|
||||
```
|
||||
|
||||
**Détails**
|
||||
|
||||
Dans de rares cas, `make build` peut sembler se bloquer sur les installations de paquets sans aucun message d'erreur.
|
||||
|
||||
**Solutions de contournement**
|
||||
|
||||
L'installateur de paquets Poetry peut manquer un paramètre de configuration pour savoir où rechercher les informations d'identification (keyring).
|
||||
|
||||
Vérifiez d'abord avec `env` si une valeur pour `PYTHON_KEYRING_BACKEND` existe.
|
||||
Si ce n'est pas le cas, exécutez la commande ci-dessous pour la définir sur une valeur connue et réessayez la construction :
|
||||
|
||||
```bash
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
```
|
||||
|
||||
---
|
||||
### Les sessions ne sont pas restaurées
|
||||
|
||||
**Symptômes**
|
||||
|
||||
OpenHands demande généralement s'il faut reprendre ou démarrer une nouvelle session lors de l'ouverture de l'interface utilisateur.
|
||||
Mais cliquer sur "Reprendre" démarre quand même un nouveau chat.
|
||||
|
||||
**Détails**
|
||||
|
||||
Avec une installation standard à ce jour, les données de session sont stockées en mémoire.
|
||||
Actuellement, si le service OpenHands est redémarré, les sessions précédentes deviennent invalides (un nouveau secret est généré) et donc non récupérables.
|
||||
|
||||
**Solutions de contournement**
|
||||
|
||||
* Modifiez la configuration pour rendre les sessions persistantes en éditant le fichier `config.toml` (dans le dossier racine d'OpenHands) en spécifiant un `file_store` et un `file_store_path` absolu :
|
||||
|
||||
```toml
|
||||
file_store="local"
|
||||
file_store_path="/absolute/path/to/openhands/cache/directory"
|
||||
```
|
||||
|
||||
* Ajoutez un secret jwt fixe dans votre .bashrc, comme ci-dessous, afin que les ID de session précédents restent acceptés.
|
||||
|
||||
```bash
|
||||
EXPORT JWT_SECRET=A_CONST_VALUE
|
||||
```
|
||||
* Arrêtez tous les conteneurs dont le nom a le préfixe `openhands-runtime-` :
|
||||
`docker ps --filter name=openhands-runtime- --filter status=running -aq | xargs docker stop`
|
||||
* Supprimez tous les conteneurs dont le nom a le préfixe `openhands-runtime-` :
|
||||
`docker rmi $(docker images --filter name=openhands-runtime- -q --no-trunc)`
|
||||
* Arrêtez et supprimez tous les conteneurs / images dont le nom a le préfixe `openhands-runtime-`
|
||||
* Nettoyez les conteneurs / images : `docker container prune -f && docker image prune -f`
|
||||
|
||||
@@ -1,49 +1,26 @@
|
||||
# 📚 其他
|
||||
# 关于 OpenHands
|
||||
|
||||
## ⭐️ 研究策略
|
||||
## 研究策略
|
||||
|
||||
使用大语言模型完全复制生产级应用程序是一项复杂的工作。我们的策略包括:
|
||||
使用 LLM 实现生产级应用的完全复制是一项复杂的工作。我们的策略包括:
|
||||
|
||||
1. **核心技术研究:** 专注于基础研究,以理解和改进代码生成和处理的技术方面
|
||||
2. **专业能力:** 通过数据管理、训练方法等提高核心组件的效率
|
||||
3. **任务规划:** 开发错误检测、代码库管理和优化的能力
|
||||
2. **专业能力:** 通过数据整理、训练方法等提高核心组件的效率
|
||||
3. **任务规划:** 开发 bug 检测、代码库管理和优化的能力
|
||||
4. **评估:** 建立全面的评估指标,以更好地理解和改进我们的模型
|
||||
|
||||
## 🚧 默认代理
|
||||
## 默认 Agent
|
||||
|
||||
我们当前的默认代理是 [CodeActAgent](agents),它能够生成代码并处理文件。
|
||||
我们当前的默认 Agent 是 [CodeActAgent](agents),它能够生成代码并处理文件。
|
||||
|
||||
## 🤝 如何贡献
|
||||
|
||||
OpenHands 是一个社区驱动的项目,我们欢迎每个人的贡献。无论你是开发人员、研究人员,还是只是对用 AI 推进软件工程领域感兴趣,都有很多方式可以参与:
|
||||
|
||||
- **代码贡献:** 帮助我们开发核心功能、前端界面或沙盒解决方案
|
||||
- **研究和评估:** 为我们对大语言模型在软件工程中的应用的理解做出贡献,参与模型评估或提出改进建议
|
||||
- **反馈和测试:** 使用 OpenHands 工具集,报告错误,提出功能建议或提供可用性反馈
|
||||
|
||||
有关详细信息,请查看[此文档](https://github.com/All-Hands-AI/OpenHands/blob/main/CONTRIBUTING.md)。
|
||||
|
||||
## 🤖 加入我们的社区
|
||||
|
||||
我们有 Slack 工作区用于协作构建 OpenHands,也有 Discord 服务器用于讨论任何相关的内容,例如此项目、大语言模型、代理等。
|
||||
|
||||
- [Slack 工作区](https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw)
|
||||
- [Discord 服务器](https://discord.gg/ESHStjSjD4)
|
||||
|
||||
如果你想做出贡献,欢迎加入我们的社区。让我们一起简化软件工程!
|
||||
|
||||
🐚 **用 OpenHands 写更少的代码,做更多的事。**
|
||||
|
||||
[](https://star-history.com/#All-Hands-AI/OpenHands&Date)
|
||||
|
||||
## 🛠️ 构建技术
|
||||
## 构建技术
|
||||
|
||||
OpenHands 使用强大的框架和库组合构建,为其开发提供了坚实的基础。以下是项目中使用的关键技术:
|
||||
|
||||
       
|
||||
|
||||
请注意,这些技术的选择正在进行中,随着项目的发展,可能会添加其他技术或删除现有技术。我们努力采用最合适和最有效的工具来增强 OpenHands 的功能。
|
||||
请注意,这些技术的选择正在进行中,随着项目的发展,可能会添加其他技术或删除现有技术。我们努力采用最合适和最有效的工具来增强 OpenHands 的能力。
|
||||
|
||||
## 📜 许可证
|
||||
## 许可证
|
||||
|
||||
根据 MIT 许可证分发。有关更多信息,请参阅[我们的许可证](https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE)。
|
||||
根据 MIT [许可证](https://github.com/All-Hands-AI/OpenHands/blob/main/LICENSE) 分发。
|
||||
|
||||
@@ -0,0 +1,384 @@
|
||||
# 配置选项
|
||||
|
||||
本指南详细介绍了 OpenHands 的所有可用配置选项,帮助您自定义其行为并与其他服务集成。
|
||||
|
||||
:::note
|
||||
如果您在 [GUI 模式](https://docs.all-hands.dev/modules/usage/how-to/gui-mode) 下运行,Settings UI 中的可用设置将始终优先。
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
# 目录
|
||||
|
||||
1. [核心配置](#核心配置)
|
||||
- [API Keys](#api-keys)
|
||||
- [工作区](#工作区)
|
||||
- [调试和日志记录](#调试和日志记录)
|
||||
- [会话管理](#会话管理)
|
||||
- [轨迹](#轨迹)
|
||||
- [文件存储](#文件存储)
|
||||
- [任务管理](#任务管理)
|
||||
- [沙箱配置](#沙箱配置)
|
||||
- [其他](#其他)
|
||||
2. [LLM 配置](#llm-配置)
|
||||
- [AWS 凭证](#aws-凭证)
|
||||
- [API 配置](#api-配置)
|
||||
- [自定义 LLM Provider](#自定义-llm-provider)
|
||||
- [Embeddings](#embeddings)
|
||||
- [消息处理](#消息处理)
|
||||
- [模型选择](#模型选择)
|
||||
- [重试](#重试)
|
||||
- [高级选项](#高级选项)
|
||||
3. [Agent 配置](#agent-配置)
|
||||
- [Microagent 配置](#microagent-配置)
|
||||
- [内存配置](#内存配置)
|
||||
- [LLM 配置](#llm-配置-2)
|
||||
- [ActionSpace 配置](#actionspace-配置)
|
||||
- [Microagent 使用](#microagent-使用)
|
||||
4. [沙箱配置](#沙箱配置-2)
|
||||
- [执行](#执行)
|
||||
- [容器镜像](#容器镜像)
|
||||
- [网络](#网络)
|
||||
- [Linting 和插件](#linting-和插件)
|
||||
- [依赖和环境](#依赖和环境)
|
||||
- [评估](#评估)
|
||||
5. [安全配置](#安全配置)
|
||||
- [确认模式](#确认模式)
|
||||
- [安全分析器](#安全分析器)
|
||||
|
||||
---
|
||||
|
||||
## 核心配置
|
||||
|
||||
核心配置选项在 `config.toml` 文件的 `[core]` 部分中定义。
|
||||
|
||||
**API Keys**
|
||||
- `e2b_api_key`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: E2B 的 API key
|
||||
|
||||
- `modal_api_token_id`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: Modal 的 API token ID
|
||||
|
||||
- `modal_api_token_secret`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: Modal 的 API token secret
|
||||
|
||||
**工作区**
|
||||
- `workspace_base`
|
||||
- 类型: `str`
|
||||
- 默认值: `"./workspace"`
|
||||
- 描述: 工作区的基础路径
|
||||
|
||||
- `cache_dir`
|
||||
- 类型: `str`
|
||||
- 默认值: `"/tmp/cache"`
|
||||
- 描述: 缓存目录路径
|
||||
|
||||
**调试和日志记录**
|
||||
- `debug`
|
||||
- 类型: `bool`
|
||||
- 默认值: `false`
|
||||
- 描述: 启用调试
|
||||
|
||||
- `disable_color`
|
||||
- 类型: `bool`
|
||||
- 默认值: `false`
|
||||
- 描述: 禁用终端输出中的颜色
|
||||
|
||||
**轨迹**
|
||||
- `save_trajectory_path`
|
||||
- 类型: `str`
|
||||
- 默认值: `"./trajectories"`
|
||||
- 描述: 存储轨迹的路径(可以是文件夹或文件)。如果是文件夹,轨迹将保存在该文件夹中以会话 ID 命名的 .json 文件中。
|
||||
|
||||
**文件存储**
|
||||
- `file_store_path`
|
||||
- 类型: `str`
|
||||
- 默认值: `"/tmp/file_store"`
|
||||
- 描述: 文件存储路径
|
||||
|
||||
- `file_store`
|
||||
- 类型: `str`
|
||||
- 默认值: `"memory"`
|
||||
- 描述: 文件存储类型
|
||||
|
||||
- `file_uploads_allowed_extensions`
|
||||
- 类型: `list of str`
|
||||
- 默认值: `[".*"]`
|
||||
- 描述: 允许上传的文件扩展名列表
|
||||
|
||||
- `file_uploads_max_file_size_mb`
|
||||
- 类型: `int`
|
||||
- 默认值: `0`
|
||||
- 描述: 上传文件的最大文件大小,以 MB 为单位
|
||||
|
||||
- `file_uploads_restrict_file_types`
|
||||
- 类型: `bool`
|
||||
- 默认值: `false`
|
||||
- 描述: 限制文件上传的文件类型
|
||||
|
||||
- `file_uploads_allowed_extensions`
|
||||
- 类型: `list of str`
|
||||
- 默认值: `[".*"]`
|
||||
- 描述: 允许上传的文件扩展名列表
|
||||
|
||||
**任务管理**
|
||||
- `max_budget_per_task`
|
||||
- 类型: `float`
|
||||
- 默认值: `0.0`
|
||||
- 描述: 每个任务的最大预算(0.0 表示无限制)
|
||||
|
||||
- `max_iterations`
|
||||
- 类型: `int`
|
||||
- 默认值: `100`
|
||||
- 描述: 最大迭代次数
|
||||
|
||||
**沙箱配置**
|
||||
- `workspace_mount_path_in_sandbox`
|
||||
- 类型: `str`
|
||||
- 默认值: `"/workspace"`
|
||||
- 描述: 在沙箱中挂载工作区的路径
|
||||
|
||||
- `workspace_mount_path`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: 挂载工作区的路径
|
||||
|
||||
- `workspace_mount_rewrite`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: 重写工作区挂载路径的路径。通常可以忽略这个,它指的是在另一个容器内运行的特殊情况。
|
||||
|
||||
**其他**
|
||||
- `run_as_openhands`
|
||||
- 类型: `bool`
|
||||
- 默认值: `true`
|
||||
- 描述: 以 OpenHands 身份运行
|
||||
|
||||
- `runtime`
|
||||
- 类型: `str`
|
||||
- 默认值: `"eventstream"`
|
||||
- 描述: 运行时环境
|
||||
|
||||
- `default_agent`
|
||||
- 类型: `str`
|
||||
- 默认值: `"CodeActAgent"`
|
||||
- 描述: 默认 agent 的名称
|
||||
|
||||
- `jwt_secret`
|
||||
- 类型: `str`
|
||||
- 默认值: `uuid.uuid4().hex`
|
||||
- 描述: 用于身份验证的 JWT 密钥。请将其设置为您自己的值。
|
||||
|
||||
## LLM 配置
|
||||
|
||||
LLM(大语言模型)配置选项在 `config.toml` 文件的 `[llm]` 部分中定义。
|
||||
|
||||
要在 docker 命令中使用这些选项,请传入 `-e LLM_<option>`。例如: `-e LLM_NUM_RETRIES`。
|
||||
|
||||
**AWS 凭证**
|
||||
- `aws_access_key_id`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: AWS access key ID
|
||||
|
||||
- `aws_region_name`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: AWS region name
|
||||
|
||||
- `aws_secret_access_key`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: AWS secret access key
|
||||
|
||||
**API 配置**
|
||||
- `api_key`
|
||||
- 类型: `str`
|
||||
- 默认值: `None`
|
||||
- 描述: 要使用的 API key
|
||||
|
||||
- `base_url`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: API 基础 URL
|
||||
|
||||
- `api_version`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: API 版本
|
||||
|
||||
- `input_cost_per_token`
|
||||
- 类型: `float`
|
||||
- 默认值: `0.0`
|
||||
- 描述: 每个输入 token 的成本
|
||||
|
||||
- `output_cost_per_token`
|
||||
- 类型: `float`
|
||||
- 默认值: `0.0`
|
||||
- 描述: 每个输出 token 的成本
|
||||
|
||||
**自定义 LLM Provider**
|
||||
- `custom_llm_provider`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: 自定义 LLM provider
|
||||
|
||||
**Embeddings**
|
||||
- `embedding_base_url`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: Embedding API 基础 URL
|
||||
|
||||
- `embedding_deployment_name`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: Embedding 部署名称
|
||||
|
||||
- `embedding_model`
|
||||
- 类型: `str`
|
||||
- 默认值: `"local"`
|
||||
- 描述: 要使用的 Embedding 模型
|
||||
|
||||
**消息处理**
|
||||
- `max_message_chars`
|
||||
- 类型: `int`
|
||||
- 默认值: `30000`
|
||||
- 描述: 包含在提示 LLM 的事件内容中的最大字符数(近似值)。较大的观察结果会被截断。
|
||||
|
||||
- `max_input_tokens`
|
||||
- 类型: `int`
|
||||
- 默认值: `0`
|
||||
- 描述: 最大输入 token 数
|
||||
|
||||
- `max_output_tokens`
|
||||
- 类型: `int`
|
||||
- 默认值: `0`
|
||||
- 描述: 最大输出 token 数
|
||||
|
||||
**模型选择**
|
||||
- `model`
|
||||
- 类型: `str`
|
||||
- 默认值: `"claude-3-5-sonnet-20241022"`
|
||||
- 描述: 要使用的模型
|
||||
|
||||
**重试**
|
||||
- `num_retries`
|
||||
- 类型: `int`
|
||||
- 默认值: `8`
|
||||
- 描述: 尝试重试的次数
|
||||
|
||||
- `retry_max_wait`
|
||||
- 类型: `int`
|
||||
- 默认值: `120`
|
||||
- 描述: 重试尝试之间的最大等待时间(秒)
|
||||
|
||||
- `retry_min_wait`
|
||||
- 类型: `int`
|
||||
- 默认值: `15`
|
||||
- 描述: 重试尝试之间的最小等待时间(秒)
|
||||
|
||||
- `retry_multiplier`
|
||||
- 类型: `float`
|
||||
- 默认值: `2.0`
|
||||
- 描述: 指数退避计算的乘数
|
||||
|
||||
**高级选项**
|
||||
- `drop_params`
|
||||
- 类型: `bool`
|
||||
- 默认值: `false`
|
||||
- 描述: 丢弃任何未映射(不支持)的参数,而不会引发异常
|
||||
|
||||
- `caching_prompt`
|
||||
- 类型: `bool`
|
||||
- 默认值: `true`
|
||||
- 描述: 如果 LLM 提供并支持,则使用提示缓存功能
|
||||
|
||||
- `ollama_base_url`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: OLLAMA API 的基础 URL
|
||||
|
||||
- `temperature`
|
||||
- 类型: `float`
|
||||
- 默认值: `0.0`
|
||||
- 描述: API 的 temperature
|
||||
|
||||
- `timeout`
|
||||
- 类型: `int`
|
||||
- 默认值: `0`
|
||||
- 描述: API 的超时时间
|
||||
|
||||
- `top_p`
|
||||
- 类型: `float`
|
||||
- 默认值: `1.0`
|
||||
- 描述: API 的 top p
|
||||
|
||||
- `disable_vision`
|
||||
- 类型: `bool`
|
||||
- 默认值: `None`
|
||||
- 描述: 如果模型支持视觉,此选项允许禁用图像处理(对于降低成本很有用)
|
||||
|
||||
## Agent 配置
|
||||
|
||||
Agent 配置选项在 `config.toml` 文件的 `[agent]` 和 `[agent.<agent_name>]` 部分中定义。
|
||||
|
||||
**Microagent 配置**
|
||||
- `micro_agent_name`
|
||||
- 类型: `str`
|
||||
- 默认值: `""`
|
||||
- 描述: 用于此 agent 的 micro agent 名称
|
||||
|
||||
**内存配置**
|
||||
- `memory_enabled`
|
||||
- 类型: `bool`
|
||||
- 默认值: `false`
|
||||
- 描述: 是否启用长期记忆(embeddings)
|
||||
|
||||
- `memory_max_threads`
|
||||
- 类型: `int`
|
||||
- 默认值: `3`
|
||||
- 描述: 同时为 embeddings 编制索引的最大线程数
|
||||
|
||||
**LLM 配置**
|
||||
- `llm_config`
|
||||
- 类型: `str`
|
||||
- 默认值: `'your-llm-config-group'`
|
||||
- 描述: 要使用的 LLM 配置的名称
|
||||
|
||||
**ActionSpace 配置**
|
||||
- `function_calling`
|
||||
- 类型: `bool`
|
||||
- 默认值: `true`
|
||||
- 描述: 是否启用函数调用
|
||||
|
||||
- `codeact_enable_browsing`
|
||||
- 类型: `bool`
|
||||
- 默认值: `false`
|
||||
- 描述: 是否在 action space 中启用浏览代理(仅适用于函数调用)
|
||||
|
||||
- `codeact_enable_llm_editor`
|
||||
- 类型: `bool`
|
||||
- 默认值: `false`
|
||||
- 描述: 是否在 action space 中启用 LLM 编辑器(仅适用于函数调用)
|
||||
|
||||
- `codeact_enable_jupyter`
|
||||
- 类型: `bool`
|
||||
- 默认值: `false`
|
||||
- 描述: 是否在 action space 中启用 Jupyter
|
||||
|
||||
**Microagent 使用**
|
||||
- `enable_prompt_extensions`
|
||||
- 类型: `bool`
|
||||
- 默认值: `true`
|
||||
- 描述: 是否使用 microagents
|
||||
|
||||
- `disabled_microagents`
|
||||
- 类型: `list of str`
|
||||
- 默认值: `None`
|
||||
- 描述: 要禁用
|
||||
@@ -1,86 +1,111 @@
|
||||
# OpenHands 入门指南
|
||||
|
||||
你已经[安装了 OpenHands](./installation)并且[设置了你的 LLM](./installation#setup)。接下来呢?
|
||||
您已经[安装了 OpenHands](./installation)并且
|
||||
[设置了您的 LLM](./installation#setup)。接下来呢?
|
||||
|
||||
OpenHands 可以帮助你处理各种各样的工程任务。但这项技术仍然很新,我们还有很长的路要走,才能拥有无需任何指导就能承担大型、复杂工程任务的智能体。因此,了解智能体擅长什么,以及可能需要什么帮助非常重要。
|
||||
OpenHands 可以帮助您处理各种工程任务。但这项技术
|
||||
仍然很新,我们还有很长的路要走,才能拥有无需任何指导就能承担大型、复杂
|
||||
工程任务的智能体。因此,了解智能体擅长什么,以及
|
||||
它可能需要什么帮助非常重要。
|
||||
|
||||
## Hello World
|
||||
|
||||
你可能想尝试的第一件事是一个简单的 "hello world" 示例。这听起来可能比实际操作更复杂!
|
||||
您可能想尝试的第一件事是一个简单的 "hello world" 示例。
|
||||
这可能比听起来更复杂!
|
||||
|
||||
尝试提示智能体:
|
||||
> 请编写一个 bash 脚本 hello.sh,打印 "hello world!"
|
||||
|
||||
你会发现,智能体不仅编写了脚本,还设置了正确的权限并运行脚本来检查输出。
|
||||
您应该看到,智能体不仅编写了脚本,还设置了正确的
|
||||
权限并运行脚本以检查输出。
|
||||
|
||||
你可以继续提示智能体优化你的代码。这是一个与智能体合作的好方法。从简单开始,然后迭代。
|
||||
您可以继续提示智能体优化您的代码。这是一个很好的
|
||||
与智能体合作的方式。从简单开始,然后迭代。
|
||||
|
||||
> 请修改 hello.sh,使其接受一个名称作为第一个参数,但默认为 "world"
|
||||
|
||||
你也可以使用任何你需要的语言,尽管智能体可能需要花一些时间来设置环境!
|
||||
您还可以使用任何需要的语言,尽管智能体可能需要花一些
|
||||
时间来设置它的环境!
|
||||
|
||||
> 请将 hello.sh 转换为 Ruby 脚本,并运行它
|
||||
|
||||
## 从头开始构建
|
||||
|
||||
智能体在 "绿地" 任务(不需要任何关于现有代码库的上下文的任务)上表现得非常出色,它们可以从头开始。
|
||||
智能体在 "绿地" 任务(不需要
|
||||
任何关于现有代码库的上下文的任务)方面表现得非常出色,它们可以直接从头开始。
|
||||
|
||||
最好从一个简单的任务开始,然后迭代它。同时也最好尽可能具体地说明你想要什么,技术栈应该是什么等等。
|
||||
最好从一个简单的任务开始,然后迭代它。最好也要
|
||||
尽可能具体地说明您想要什么,技术栈应该是什么,等等。
|
||||
|
||||
例如,我们可以构建一个 TODO 应用:
|
||||
|
||||
> 请用 React 构建一个基本的 TODO 列表应用。它应该只有前端,所有状态都应该保存在 localStorage 中。
|
||||
> 请在 React 中构建一个基本的 TODO 列表应用。它应该只有前端,所有状态
|
||||
> 应该保存在 localStorage 中。
|
||||
|
||||
一旦骨架搭建好,我们就可以继续迭代应用:
|
||||
|
||||
> 请允许为每个任务添加一个可选的截止日期
|
||||
|
||||
就像普通开发一样,经常提交和推送代码是一个好习惯。这样,如果智能体偏离了轨道,你总是可以恢复到旧的状态。你可以让智能体为你提交和推送:
|
||||
就像正常开发一样,经常提交和推送代码是很好的做法。
|
||||
这样,如果智能体偏离轨道,您总是可以恢复到旧的状态。
|
||||
您可以要求智能体为您提交和推送:
|
||||
|
||||
> 请提交更改并将其推送到名为 "feature/due-dates" 的新分支
|
||||
|
||||
> 请提交更改并将其推送到一个名为 "feature/due-dates" 的新分支
|
||||
|
||||
## 添加新代码
|
||||
|
||||
OpenHands 也可以很好地向现有代码库添加新代码。
|
||||
OpenHands 还可以很好地将新代码添加到现有代码库中。
|
||||
|
||||
例如,你可以要求 OpenHands 向你的项目添加一个新的 GitHub action,用于检查你的代码。OpenHands 可能会查看你的代码库,看看它应该使用什么语言,然后它可以直接将一个新文件放入 `./github/workflows/lint.yml`
|
||||
例如,您可以要求 OpenHands 向您的项目添加一个新的 GitHub action
|
||||
来检查您的代码。OpenHands 可能会查看您的代码库以确定应该使用什么语言,
|
||||
但随后它可以直接将一个新文件放入 `./github/workflows/lint.yml`
|
||||
|
||||
> 请添加一个 GitHub action 来检查此仓库中的代码
|
||||
|
||||
有些任务可能需要更多的上下文。虽然 OpenHands 可以使用 `ls` 和 `grep` 来搜索你的代码库,但提前提供上下文可以让它移动得更快、更准确。而且这会让你花费更少的 tokens!
|
||||
某些任务可能需要更多上下文。虽然 OpenHands 可以使用 `ls` 和 `grep`
|
||||
在您的代码库中搜索,但提前提供上下文可以让它移动得更快、
|
||||
更准确。而且这会让您花费更少的 token!
|
||||
|
||||
> 请修改 ./backend/api/routes.js 以添加一个新路由,返回所有任务的列表
|
||||
|
||||
> 请在 ./frontend/components 目录中添加一个新的 React 组件,用于显示 Widgets 列表。它应该使用现有的 Widget 组件。
|
||||
> 请在 ./frontend/components 目录中添加一个新的 React 组件,用于显示 Widget 列表。
|
||||
> 它应该使用现有的 Widget 组件。
|
||||
|
||||
## 重构
|
||||
|
||||
OpenHands 在重构现有代码方面做得很好,尤其是小块的重构。你可能不想尝试重新设计整个代码库,但拆分长文件和函数、重命名变量等往往效果很好。
|
||||
OpenHands 在重构现有代码方面表现出色,尤其是在小块中。
|
||||
您可能不想尝试重新构建整个代码库,但拆分
|
||||
长文件和函数、重命名变量等往往效果很好。
|
||||
|
||||
> 请重命名 ./app.go 中所有单字母变量
|
||||
> 请重命名 ./app.go 中的所有单字母变量
|
||||
|
||||
> 请在 widget.php 中将函数 `build_and_deploy_widgets` 拆分为两个函数:`build_widgets` 和 `deploy_widgets`
|
||||
> 请将 widget.php 中的函数 `build_and_deploy_widgets` 拆分为两个函数:`build_widgets` 和 `deploy_widgets`
|
||||
|
||||
> 请将 ./api/routes.js 拆分为每个路由的单独文件
|
||||
|
||||
## Bug 修复
|
||||
|
||||
OpenHands 还可以帮助你跟踪和修复代码中的 bug。但是,正如任何开发人员都知道的那样,修复 bug 可能非常棘手,OpenHands 通常需要更多的上下文。如果你已经诊断出了 bug,但希望 OpenHands 来解决逻辑问题,这会有所帮助。
|
||||
OpenHands 还可以帮助您跟踪和修复代码中的错误。但是,任何
|
||||
开发人员都知道,修复错误可能非常棘手,通常 OpenHands 需要更多上下文。
|
||||
如果您已经诊断出错误,但希望 OpenHands 找出逻辑,这会有所帮助。
|
||||
|
||||
> 目前 `/subscribe` 端点中的 email 字段正在拒绝 .io 域名。请修复这个问题。
|
||||
> 目前 `/subscribe` 端点中的电子邮件字段拒绝 .io 域名。请修复这个问题。
|
||||
|
||||
> ./app.py 中的 `search_widgets` 函数正在执行区分大小写的搜索。请使其不区分大小写。
|
||||
|
||||
在使用智能体修复 bug 时,进行测试驱动开发通常很有帮助。你可以要求智能体编写一个新的测试,然后迭代直到它修复了 bug:
|
||||
在使用智能体进行错误修复时,进行测试驱动开发通常很有帮助。
|
||||
您可以要求智能体编写一个新测试,然后迭代直到修复错误:
|
||||
|
||||
> `hello` 函数在空字符串上崩溃。请编写一个测试来重现这个 bug,然后修复代码,使其通过测试。
|
||||
> `hello` 函数在空字符串上崩溃。请编写一个测试来重现此错误,然后修复代码以通过测试。
|
||||
|
||||
## 更多
|
||||
|
||||
OpenHands 能够在几乎任何编码任务上提供帮助。但是需要一些练习才能充分利用它。请记住:
|
||||
OpenHands 能够在几乎任何编码任务上提供帮助。但需要一些练习
|
||||
才能充分利用它。请记住:
|
||||
* 保持任务简单
|
||||
* 尽可能具体
|
||||
* 提供尽可能多的上下文
|
||||
* 经常提交和推送
|
||||
|
||||
有关如何充分利用 OpenHands 的更多提示,请参阅[提示最佳实践](./prompting-best-practices)。
|
||||
有关如何充分利用 OpenHands 的更多提示,请参阅[提示最佳实践](./prompting/prompting-best-practices)。
|
||||
|
||||
@@ -50,6 +50,7 @@ LLM_API_KEY="sk_test_12345"
|
||||
```bash
|
||||
docker run -it \
|
||||
--pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-e LLM_API_KEY=$LLM_API_KEY \
|
||||
@@ -58,17 +59,17 @@ docker run -it \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app-$(date +%Y%m%d%H%M%S) \
|
||||
ghcr.io/all-hands-ai/openhands:0.11 \
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.21 \
|
||||
python -m openhands.core.cli
|
||||
```
|
||||
|
||||
该命令将在 Docker 中启动一个交互式会话,你可以在其中输入任务并接收来自 OpenHands 的响应。
|
||||
|
||||
## 命令行命令和预期输出示例
|
||||
## CLI 命令和预期输出示例
|
||||
|
||||
以下是一些命令行命令及其预期输出的示例:
|
||||
以下是一些 CLI 命令及其预期输出的示例:
|
||||
|
||||
### 示例 1: 简单任务
|
||||
### 示例 1:简单任务
|
||||
|
||||
```bash
|
||||
How can I help? >> Write a Python script that prints "Hello, World!"
|
||||
@@ -77,12 +78,12 @@ How can I help? >> Write a Python script that prints "Hello, World!"
|
||||
预期输出:
|
||||
|
||||
```bash
|
||||
🤖 Sure! Here is a Python script that prints "Hello, World!":
|
||||
🤖 当然!这是一个打印 "Hello, World!" 的 Python 脚本:
|
||||
|
||||
❯ print("Hello, World!")
|
||||
```
|
||||
|
||||
### 示例 2: Bash 命令
|
||||
### 示例 2:Bash 命令
|
||||
|
||||
```bash
|
||||
How can I help? >> Create a directory named "test_dir"
|
||||
@@ -91,12 +92,12 @@ How can I help? >> Create a directory named "test_dir"
|
||||
预期输出:
|
||||
|
||||
```bash
|
||||
🤖 Creating a directory named "test_dir":
|
||||
🤖 创建一个名为 "test_dir" 的目录:
|
||||
|
||||
❯ mkdir test_dir
|
||||
```
|
||||
|
||||
### 示例 3: 错误处理
|
||||
### 示例 3:错误处理
|
||||
|
||||
```bash
|
||||
How can I help? >> Delete a non-existent file
|
||||
@@ -105,5 +106,5 @@ How can I help? >> Delete a non-existent file
|
||||
预期输出:
|
||||
|
||||
```bash
|
||||
🤖 An error occurred. Please try again.
|
||||
🤖 发生错误。请重试。
|
||||
```
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
沙箱是代理执行任务的地方。代理不是直接在你的计算机上运行命令(这可能有风险),而是在 Docker 容器内运行。
|
||||
|
||||
默认的 OpenHands 沙箱(来自 [nikolaik/python-nodejs](https://hub.docker.com/r/nikolaik/python-nodejs) 的 `python-nodejs:python3.12-nodejs22`)预装了一些软件包,如 Python 和 Node.js,但可能需要默认安装其他软件。
|
||||
默认的 OpenHands 沙箱(`python-nodejs:python3.12-nodejs22`,来自 [nikolaik/python-nodejs](https://hub.docker.com/r/nikolaik/python-nodejs))预装了一些软件包,如 Python 和 Node.js,但可能需要默认安装其他软件。
|
||||
|
||||
你有两个自定义选项:
|
||||
|
||||
@@ -38,7 +38,7 @@ docker build -t custom-image .
|
||||
|
||||
### 设置
|
||||
|
||||
首先,按照 [Development.md](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md) 中的说明确保你可以运行 OpenHands。
|
||||
首先,按照 [Development.md](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md) 中的说明,确保你可以运行 OpenHands。
|
||||
|
||||
### 指定基础沙箱镜像
|
||||
|
||||
@@ -57,25 +57,3 @@ sandbox_base_container_image="custom-image"
|
||||
## 技术解释
|
||||
|
||||
请参阅[运行时文档的自定义 docker 镜像部分](https://docs.all-hands.dev/modules/usage/architecture/runtime#advanced-how-openhands-builds-and-maintains-od-runtime-images)以获取更多详细信息。
|
||||
|
||||
## 故障排除/错误
|
||||
|
||||
### 错误:```useradd: UID 1000 is not unique```
|
||||
|
||||
如果你在控制台输出中看到此错误,是因为 OpenHands 试图在沙箱中创建 UID 为 1000 的 openhands 用户,但此 UID 已在镜像中使用(出于某种原因)。要解决此问题,请将 config.toml 文件中的 sandbox_user_id 字段更改为其他值:
|
||||
|
||||
```toml
|
||||
[core]
|
||||
workspace_base="./workspace"
|
||||
run_as_openhands=true
|
||||
sandbox_base_container_image="custom_image"
|
||||
sandbox_user_id="1001"
|
||||
```
|
||||
|
||||
### 端口使用错误
|
||||
|
||||
如果你看到有关端口正在使用或不可用的错误,请尝试删除所有正在运行的 Docker 容器(运行 `docker ps` 和 `docker rm` 相关容器),然后重新运行 ```make run```。
|
||||
|
||||
## 讨论
|
||||
|
||||
对于其他问题或疑问,请加入 [Slack](https://join.slack.com/t/openhands-ai/shared_invite/zt-2wkh4pklz-w~h_DVDtEe9H5kyQlcNxVw) 或 [Discord](https://discord.gg/ESHStjSjD4) 并提问!
|
||||
|
||||
@@ -58,7 +58,7 @@ poetry run python ./openhands/core/main.py \
|
||||
|
||||
## OpenHands 如何工作
|
||||
|
||||
OpenHands 的主要入口点在 `openhands/core/main.py` 中。以下是它工作原理的简化流程:
|
||||
OpenHands 的主要入口点在 `openhands/core/main.py` 中。以下是它的简化工作流程:
|
||||
|
||||
1. 解析命令行参数并加载配置
|
||||
2. 使用 `create_runtime()` 创建运行时环境
|
||||
@@ -261,7 +261,7 @@ def codeact_user_response(state: State | None) -> str:
|
||||
if isinstance(event, MessageAction) and event.source == 'user'
|
||||
]
|
||||
if len(user_msgs) >= 2:
|
||||
# 让代理知道它在尝试 3 次后可以放弃
|
||||
# 当代理已尝试 3 次时,让它知道可以放弃
|
||||
return (
|
||||
msg
|
||||
+ 'If you want to give up, run: <execute_bash> exit </execute_bash>.\n'
|
||||
|
||||
@@ -1,15 +1,49 @@
|
||||
# 使用 OpenHands GitHub Action
|
||||
# 在 OpenHands 仓库中使用 GitHub Action
|
||||
|
||||
本指南解释了如何在 OpenHands 仓库内以及你自己的项目中使用 OpenHands GitHub Action。
|
||||
|
||||
## 在 OpenHands 仓库中使用 Action
|
||||
|
||||
要在 OpenHands 仓库中使用 OpenHands GitHub Action,OpenHands 维护者可以:
|
||||
要在仓库中使用 OpenHands GitHub Action,你可以:
|
||||
|
||||
1. 在仓库中创建一个 issue。
|
||||
2. 为该 issue 添加 `fix-me` 标签。
|
||||
3. Action 将自动触发并尝试解决该 issue。
|
||||
2. 为 issue 添加 `fix-me` 标签,或在 issue 中留下以 `@openhands-agent` 开头的评论。
|
||||
|
||||
该 action 将自动触发并尝试解决该 issue。
|
||||
|
||||
## 在新仓库中安装 Action
|
||||
|
||||
要在你自己的仓库中安装 OpenHands GitHub Action,请按照 [OpenHands Resolver 仓库中的说明](https://github.com/All-Hands-AI/OpenHands/blob/main/openhands/resolver/README.md) 进行操作。
|
||||
要在你自己的仓库中安装 OpenHands GitHub Action,请按照 [OpenHands Resolver 的 README](https://github.com/All-Hands-AI/OpenHands/blob/main/openhands/resolver/README.md) 进行操作。
|
||||
|
||||
## 使用技巧
|
||||
|
||||
### 迭代解决
|
||||
|
||||
1. 在仓库中创建一个 issue。
|
||||
2. 为 issue 添加 `fix-me` 标签,或留下以 `@openhands-agent` 开头的评论。
|
||||
3. 通过检查 pull request 来审查解决 issue 的尝试。
|
||||
4. 通过一般评论、审查评论或内联线程评论提供反馈。
|
||||
5. 为 pull request 添加 `fix-me` 标签,或通过以 `@openhands-agent` 开头来解决特定的评论。
|
||||
|
||||
### 标签与宏
|
||||
|
||||
- 标签(`fix-me`):请求 OpenHands 解决**整个** issue 或 pull request。
|
||||
- 宏(`@openhands-agent`):请求 OpenHands 仅考虑 issue/pull request 描述和**特定评论**。
|
||||
|
||||
## 高级设置
|
||||
|
||||
### 添加自定义仓库设置
|
||||
|
||||
你可以按照 [resolver 的 README](https://github.com/All-Hands-AI/OpenHands/blob/main/openhands/resolver/README.md#providing-custom-instructions) 为 OpenHands 提供自定义指令。
|
||||
|
||||
### 自定义配置
|
||||
|
||||
Github resolver 将自动检查有效的 [仓库机密](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions?tool=webui#creating-secrets-for-a-repository) 或 [仓库变量](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#creating-configuration-variables-for-a-repository) 以自定义其行为。
|
||||
你可以设置的自定义选项有:
|
||||
|
||||
| **属性名称** | **类型** | **用途** | **示例** |
|
||||
|----------------------------------| -------- |-------------------------------------------------------------------------------------------|------------------------------------------------------|
|
||||
| `LLM_MODEL` | Variable | 设置与 OpenHands 一起使用的 LLM | `LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"` |
|
||||
| `OPENHANDS_MAX_ITER` | Variable | 设置代理迭代的最大限制 | `OPENHANDS_MAX_ITER=10` |
|
||||
| `OPENHANDS_MACRO` | Variable | 自定义用于调用 resolver 的默认宏 | `OPENHANDS_MACRO=@resolveit` |
|
||||
| `OPENHANDS_BASE_CONTAINER_IMAGE` | Variable | 自定义沙箱 ([了解更多](https://docs.all-hands.dev/modules/usage/how-to/custom-sandbox-guide)) | `OPENHANDS_BASE_CONTAINER_IMAGE="custom_image"` |
|
||||
|
||||
@@ -1,53 +1,125 @@
|
||||
以下是翻译后的内容:
|
||||
|
||||
# 图形用户界面模式
|
||||
# GUI 模式
|
||||
|
||||
## 简介
|
||||
|
||||
OpenHands 提供了一个用户友好的图形用户界面 (GUI) 模式,用于与 AI 助手进行交互。该模式提供了一种直观的方式来设置环境、管理设置以及与 AI 进行通信。
|
||||
OpenHands 提供了一个用户友好的图形用户界面(GUI)模式,用于与 AI 助手交互。这种模式提供了一种直观的方式来设置环境、管理设置和与 AI 通信。
|
||||
|
||||
## 安装和设置
|
||||
|
||||
1. 按照[安装](../installation)指南中的说明安装 OpenHands。
|
||||
|
||||
2. 运行命令后,通过 [http://localhost:3000](http://localhost:3000) 访问 OpenHands。
|
||||
2. 运行命令后,通过 [http://localhost:3000](http://localhost:3000) 访问 OpenHands。
|
||||
|
||||
## 与 GUI 交互
|
||||
|
||||
### 初始设置
|
||||
|
||||
1. 首次启动时,您将看到一个设置模态框。
|
||||
2. 从下拉菜单中选择一个 `LLM Provider` 和 `LLM Model`。
|
||||
3. 输入您选择的提供商对应的 `API Key`。
|
||||
1. 首次启动时,您将看到一个设置模态框。
|
||||
2. 从下拉菜单中选择 `LLM Provider` 和 `LLM Model`。
|
||||
3. 输入所选提供商对应的 `API Key`。
|
||||
4. 点击"保存"应用设置。
|
||||
|
||||
### GitHub Token 设置
|
||||
|
||||
如果可用,OpenHands 会自动将 `GITHUB_TOKEN` 导出到 shell 环境中。这可以通过两种方式实现:
|
||||
|
||||
1. **本地(OSS)**:用户直接输入他们的 GitHub token
|
||||
2. **在线(SaaS)**:通过 GitHub OAuth 身份验证获取 token
|
||||
|
||||
#### 设置本地 GitHub Token
|
||||
|
||||
1. **生成个人访问令牌(PAT)**:
|
||||
- 转到 GitHub 设置 > 开发者设置 > 个人访问令牌 > 令牌(经典)
|
||||
- 点击"生成新令牌(经典)"
|
||||
- 所需范围:
|
||||
- `repo`(完全控制私有仓库)
|
||||
- `workflow`(更新 GitHub Action 工作流)
|
||||
- `read:org`(读取组织数据)
|
||||
|
||||
2. **在 OpenHands 中输入令牌**:
|
||||
- 点击右上角的设置按钮(齿轮图标)
|
||||
- 导航到"GitHub"部分
|
||||
- 将令牌粘贴到"GitHub Token"字段中
|
||||
- 点击"保存"应用更改
|
||||
|
||||
#### 组织令牌策略
|
||||
|
||||
如果您使用组织仓库,可能需要额外的设置:
|
||||
|
||||
1. **检查组织要求**:
|
||||
- 组织管理员可能会强制执行特定的令牌策略
|
||||
- 某些组织要求使用启用 SSO 的令牌
|
||||
- 查看您组织的[令牌策略设置](https://docs.github.com/en/organizations/managing-programmatic-access-to-your-organization/setting-a-personal-access-token-policy-for-your-organization)
|
||||
|
||||
2. **验证组织访问权限**:
|
||||
- 转到 GitHub 上的令牌设置
|
||||
- 在"组织访问"下查找组织
|
||||
- 如果需要,点击组织旁边的"启用 SSO"
|
||||
- 完成 SSO 授权过程
|
||||
|
||||
#### OAuth 身份验证(在线模式)
|
||||
|
||||
在在线模式下使用 OpenHands 时,GitHub OAuth 流程:
|
||||
|
||||
1. 请求以下权限:
|
||||
- 仓库访问(读/写)
|
||||
- 工作流管理
|
||||
- 组织读取访问
|
||||
|
||||
2. 身份验证步骤:
|
||||
- 出现提示时,点击"使用 GitHub 登录"
|
||||
- 查看请求的权限
|
||||
- 授权 OpenHands 访问您的 GitHub 帐户
|
||||
- 如果使用组织,在出现提示时授权组织访问
|
||||
|
||||
#### 故障排除
|
||||
|
||||
常见问题和解决方案:
|
||||
|
||||
1. **令牌无法识别**:
|
||||
- 确保令牌已正确保存在设置中
|
||||
- 检查令牌是否已过期
|
||||
- 验证令牌是否具有所需的范围
|
||||
- 尝试重新生成令牌
|
||||
|
||||
2. **组织访问被拒绝**:
|
||||
- 检查是否需要但未启用 SSO
|
||||
- 验证组织成员资格
|
||||
- 如果令牌策略阻止访问,请联系组织管理员
|
||||
|
||||
3. **验证令牌是否有效**:
|
||||
- 如果令牌有效,应用程序将显示绿色复选标记
|
||||
- 尝试访问仓库以确认权限
|
||||
- 检查浏览器控制台中是否有任何错误消息
|
||||
- 如果可用,使用设置中的"测试连接"按钮
|
||||
|
||||
### 高级设置
|
||||
|
||||
1. 切换 `Advanced Options` 以访问其他设置。
|
||||
2. 如果列表中没有您需要的模型,请使用 `Custom Model` 文本框手动输入模型。
|
||||
3. 如果您的 LLM 提供商需要,请指定一个 `Base URL`。
|
||||
1. 切换`高级选项`以访问其他设置。
|
||||
2. 如果列表中没有所需的模型,使用`自定义模型`文本框手动输入模型。
|
||||
3. 如果您的 LLM 提供商需要,请指定`基本 URL`。
|
||||
|
||||
### 主界面
|
||||
|
||||
主界面由几个关键组件组成:
|
||||
主界面由几个关键组件组成:
|
||||
|
||||
1. **聊天窗口**:您可以查看与 AI 助手的对话历史记录的中心区域。
|
||||
2. **输入框**:位于屏幕底部,用于输入您要发送给 AI 的消息或命令。
|
||||
3. **发送按钮**:点击此按钮将您的消息发送给 AI。
|
||||
4. **设置按钮**:打开设置模态框的齿轮图标,允许您随时调整配置。
|
||||
5. **工作区面板**:显示工作区中的文件和文件夹,允许您导航和查看文件,或查看代理的过去命令或网页浏览历史记录。
|
||||
1. **聊天窗口**:中央区域,您可以在其中查看与 AI 助手的对话历史记录。
|
||||
2. **输入框**:位于屏幕底部,用于输入您要发送给 AI 的消息或命令。
|
||||
3. **发送按钮**:点击此按钮将消息发送给 AI。
|
||||
4. **设置按钮**:打开设置模态框的齿轮图标,允许您随时调整配置。
|
||||
5. **工作区面板**:显示工作区中的文件和文件夹,允许您导航和查看文件,或查看代理的过去命令或网页浏览历史记录。
|
||||
|
||||
### 与 AI 交互
|
||||
|
||||
1. 在输入框中输入您的问题、请求或任务描述。
|
||||
2. 点击发送按钮或按回车键提交您的消息。
|
||||
2. 点击发送按钮或按 Enter 键提交消息。
|
||||
3. AI 将处理您的输入并在聊天窗口中提供响应。
|
||||
4. 您可以通过询问后续问题或提供额外信息来继续对话。
|
||||
|
||||
## 有效使用的提示
|
||||
|
||||
1. 在您的请求中要具体,以获得最准确和最有帮助的响应,如[提示最佳实践](../prompting-best-practices)中所述。
|
||||
2. 使用工作区面板探索您的项目结构。
|
||||
1. 在请求中要具体,以获得最准确和最有帮助的响应,如[提示最佳实践](../prompting/prompting-best-practices)中所述。
|
||||
2. 使用工作区面板探索项目结构。
|
||||
3. 使用[LLMs 部分](usage/llms/llms.md)中描述的推荐模型之一。
|
||||
|
||||
请记住,OpenHands 的 GUI 模式旨在使您与 AI 助手的交互尽可能流畅和直观。不要犹豫探索其功能以最大限度地提高您的工作效率。
|
||||
请记住,OpenHands 的 GUI 模式旨在使您与 AI 助手的交互尽可能流畅和直观。不要犹豫探索其功能以最大限度地提高您的工作效率。
|
||||
|
||||
@@ -47,14 +47,16 @@ LLM_API_KEY="sk_test_12345"
|
||||
```bash
|
||||
docker run -it \
|
||||
--pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-e LLM_API_KEY=$LLM_API_KEY \
|
||||
-e LLM_MODEL=$LLM_MODEL \
|
||||
-e LOG_ALL_EVENTS=true \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app-$(date +%Y%m%d%H%M%S) \
|
||||
ghcr.io/all-hands-ai/openhands:0.11 \
|
||||
python -m openhands.core.main -t "write a bash script that prints hi"
|
||||
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
|
||||
```
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
以下是翻译后的内容:
|
||||
|
||||
# 持久化会话数据
|
||||
|
||||
使用标准安装,会话数据存储在内存中。目前,如果 OpenHands 服务重新启动,之前的会话将失效(生成新的密钥),因此无法恢复。
|
||||
|
||||
## 如何持久化会话数据
|
||||
|
||||
### 开发工作流
|
||||
在 `config.toml` 文件中,指定以下内容:
|
||||
```
|
||||
[core]
|
||||
...
|
||||
file_store="local"
|
||||
file_store_path="/absolute/path/to/openhands/cache/directory"
|
||||
jwt_secret="secretpass"
|
||||
```
|
||||
@@ -8,36 +8,32 @@
|
||||
|
||||
## 启动应用
|
||||
|
||||
在 Docker 中运行 OpenHands 是最简单的方式。你可以将下面的 `WORKSPACE_BASE` 更改为指向你想要修改的现有代码。
|
||||
在 Docker 中运行 OpenHands 是最简单的方式。
|
||||
|
||||
```bash
|
||||
export WORKSPACE_BASE=$(pwd)/workspace
|
||||
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik
|
||||
|
||||
docker pull ghcr.io/all-hands-ai/runtime:0.11-nikolaik
|
||||
|
||||
docker run -it --pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=ghcr.io/all-hands-ai/runtime:0.11-nikolaik \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
docker run -it --rm --pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e LOG_ALL_EVENTS=true \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app-$(date +%Y%m%d%H%M%S) \
|
||||
ghcr.io/all-hands-ai/openhands:0.11
|
||||
--name openhands-app \
|
||||
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)。
|
||||
|
||||
## 设置
|
||||
|
||||
运行上面的命令后,你会发现 OpenHands 运行在 [http://localhost:3000](http://localhost:3000)。
|
||||
运行上述命令后,你可以在 [http://localhost:3000](http://localhost:3000) 找到正在运行的 OpenHands。
|
||||
|
||||
代理将可以访问 `./workspace` 文件夹来完成其工作。你可以将现有代码复制到这里,或在命令中更改 `WORKSPACE_BASE` 以指向现有文件夹。
|
||||
启动 OpenHands 后,你会看到一个设置模态框。你**必须**选择一个 `LLM Provider` 和 `LLM Model`,并输入相应的 `API Key`。
|
||||
这些设置可以随时通过选择 UI 中的 `Settings` 按钮(齿轮图标)进行更改。
|
||||
|
||||
启动 OpenHands 后,你会看到一个设置模态框。你**必须**选择一个 `LLM Provider` 和 `LLM Model`,并输入相应的 `API Key`。这些可以随时通过在 UI 中选择 `Settings` 按钮(齿轮图标)来更改。
|
||||
|
||||
如果所需的 `LLM Model` 不存在于列表中,你可以切换 `Advanced Options`,并在 `Custom Model` 文本框中使用正确的前缀手动输入它。`Advanced Options` 还允许你在需要时指定 `Base URL`。
|
||||
如果所需的 `LLM Model` 不在列表中,你可以切换 `Advanced Options`,并在 `Custom Model` 文本框中使用正确的前缀手动输入。
|
||||
`Advanced Options` 还允许你在需要时指定 `Base URL`。
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'center', gap: '20px' }}>
|
||||
<img src="/img/settings-screenshot.png" alt="settings-modal" width="340" />
|
||||
@@ -46,10 +42,10 @@ docker run -it --pull=always \
|
||||
|
||||
## 版本
|
||||
|
||||
上面的命令拉取最新的 OpenHands 稳定版本。你还有其他选择:
|
||||
- 对于特定版本,使用 `ghcr.io/all-hands-ai/openhands:$VERSION`,将 $VERSION 替换为版本号。
|
||||
- 我们使用语义化版本,并发布主要、次要和补丁标签。因此,`0.9` 将自动指向最新的 `0.9.x` 版本,而 `0` 将指向最新的 `0.x.x` 版本。
|
||||
- 对于最新的开发版本,你可以使用 `ghcr.io/all-hands-ai/openhands:main`。此版本不稳定,仅建议用于测试或开发目的。
|
||||
上述命令拉取最新的 OpenHands 稳定版本。你还有其他选择:
|
||||
- 对于特定版本,使用 `docker.all-hands.dev/all-hands-ai/openhands:$VERSION`,将 $VERSION 替换为版本号。
|
||||
- 我们使用语义化版本,并发布主要版本、次要版本和补丁标签。因此,`0.9` 将自动指向最新的 `0.9.x` 版本,而 `0` 将指向最新的 `0.x.x` 版本。
|
||||
- 对于最新的开发版本,你可以使用 `docker.all-hands.dev/all-hands-ai/openhands:main`。此版本不稳定,仅建议用于测试或开发目的。
|
||||
|
||||
你可以根据稳定性要求和所需功能选择最适合你需求的标签。
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
以下是翻译后的内容:
|
||||
|
||||
# LiteLLM 代理
|
||||
|
||||
OpenHands 支持使用 [LiteLLM 代理](https://docs.litellm.ai/docs/proxy/quick_start)来访问各种 LLM 提供商。
|
||||
|
||||
## 配置
|
||||
|
||||
要在 OpenHands 中使用 LiteLLM 代理,你需要:
|
||||
|
||||
1. 设置一个 LiteLLM 代理服务器(参见 [LiteLLM 文档](https://docs.litellm.ai/docs/proxy/quick_start))
|
||||
2. 运行 OpenHands 时,你需要在 OpenHands UI 的设置中设置以下内容:
|
||||
* 启用`高级选项`
|
||||
* 将`自定义模型`设置为前缀 `litellm_proxy/` + 你将使用的模型(例如 `litellm_proxy/anthropic.claude-3-5-sonnet-20241022-v2:0`)
|
||||
* 将`Base URL`设置为你的 LiteLLM 代理 URL(例如 `https://your-litellm-proxy.com`)
|
||||
* 将`API Key`设置为你的 LiteLLM 代理 API 密钥
|
||||
|
||||
## 支持的模型
|
||||
|
||||
支持的模型取决于你的 LiteLLM 代理配置。OpenHands 支持你的 LiteLLM 代理配置的任何模型。
|
||||
|
||||
有关可用模型及其名称的列表,请参阅你的 LiteLLM 代理配置。
|
||||
@@ -4,17 +4,17 @@ OpenHands 可以连接到 LiteLLM 支持的任何 LLM。但是,它需要一个
|
||||
|
||||
## 模型推荐
|
||||
|
||||
基于最近对编码任务的语言模型评估(使用 SWE-bench 数据集),我们可以为模型选择提供一些建议。完整的分析可以在[这篇博客文章](https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed)中找到。
|
||||
根据我们对编码任务语言模型的评估(使用 SWE-bench 数据集),我们可以为模型选择提供一些建议。一些分析可以在[这篇比较 LLM 的博客文章](https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed)和[这篇包含一些最新结果的博客文章](https://www.all-hands.dev/blog/openhands-codeact-21-an-open-state-of-the-art-software-development-agent)中找到。
|
||||
|
||||
在选择模型时,需要同时考虑输出质量和相关成本。以下是调查结果的总结:
|
||||
在选择模型时,要同时考虑输出质量和相关成本。以下是调查结果的总结:
|
||||
|
||||
- Claude 3.5 Sonnet 是目前最好的,在 OpenHands 中使用默认 agent 可以达到 27% 的解决率。
|
||||
- GPT-4o 落后一些,而 o1-mini 的表现甚至比 GPT-4o 还要差一些。我们进行了一些分析,简单来说,o1 有时会"过度思考",在可以直接完成任务的情况下执行额外的环境配置任务。
|
||||
- Claude 3.5 Sonnet 是目前最好的,在 SWE-Bench Verified 上使用 OpenHands 中的默认代理可以达到 53% 的解决率。
|
||||
- GPT-4o 落后于 Claude,而 o1-mini 的表现甚至比 GPT-4o 还要差一些。我们进行了一些分析,简单来说,o1 有时会"想得太多",在可以直接完成任务的情况下执行额外的环境配置任务。
|
||||
- 最后,最强大的开放模型是 Llama 3.1 405 B 和 deepseek-v2.5,它们表现得相当不错,甚至超过了一些封闭模型。
|
||||
|
||||
请参阅[完整文章](https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed)以获取更多详细信息。
|
||||
请参阅[完整文章](https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed)了解更多详情。
|
||||
|
||||
基于这些发现和社区反馈,以下模型已经验证可以与 OpenHands 很好地配合使用:
|
||||
根据这些发现和社区反馈,以下模型已经验证可以与 OpenHands 很好地配合使用:
|
||||
|
||||
- claude-3-5-sonnet(推荐)
|
||||
- gpt-4 / gpt-4o
|
||||
@@ -22,7 +22,7 @@ OpenHands 可以连接到 LiteLLM 支持的任何 LLM。但是,它需要一个
|
||||
- deepseek-v2.5
|
||||
|
||||
:::warning
|
||||
OpenHands 将向您配置的 LLM 发出许多提示。这些 LLM 中的大多数都需要付费,因此请确保设置支出限制并监控使用情况。
|
||||
OpenHands 将向您配置的 LLM 发出许多提示。这些 LLM 中的大多数都需要付费,因此请务必设置支出限制并监控使用情况。
|
||||
:::
|
||||
|
||||
如果您已经成功地使用特定的未列出的 LLM 运行 OpenHands,请将它们添加到已验证列表中。我们也鼓励您提交 PR 分享您的设置过程,以帮助其他使用相同提供商和 LLM 的人!
|
||||
@@ -42,7 +42,7 @@ OpenHands 将向您配置的 LLM 发出许多提示。这些 LLM 中的大多数
|
||||
- `API Key`
|
||||
- `Base URL`(通过`Advanced Settings`)
|
||||
|
||||
有些设置可能对某些 LLM/提供商是必需的,但无法通过 UI 设置。相反,可以使用 `-e` 通过传递给 [docker run 命令](/modules/usage/installation#start-the-app)的环境变量来设置这些选项:
|
||||
有些设置可能对某些 LLM/提供商是必需的,但无法通过 UI 设置。相反,可以通过传递给 [docker run 命令](/modules/usage/installation#start-the-app)的环境变量使用 `-e` 来设置这些变量:
|
||||
|
||||
- `LLM_API_VERSION`
|
||||
- `LLM_EMBEDDING_MODEL`
|
||||
@@ -56,14 +56,15 @@ OpenHands 将向您配置的 LLM 发出许多提示。这些 LLM 中的大多数
|
||||
- [Azure](llms/azure-llms)
|
||||
- [Google](llms/google-llms)
|
||||
- [Groq](llms/groq)
|
||||
- [LiteLLM Proxy](llms/litellm-proxy)
|
||||
- [OpenAI](llms/openai-llms)
|
||||
- [OpenRouter](llms/openrouter)
|
||||
|
||||
### API 重试和速率限制
|
||||
|
||||
LLM 提供商通常有速率限制,有时非常低,可能需要重试。如果收到速率限制错误(429 错误代码)、API 连接错误或其他瞬时错误,OpenHands 将自动重试请求。
|
||||
LLM 提供商通常有速率限制,有时非常低,可能需要重试。如果 OpenHands 收到速率限制错误(429 错误代码)、API 连接错误或其他瞬时错误,它将自动重试请求。
|
||||
|
||||
您可以根据正在使用的提供商的需要自定义这些选项。查看他们的文档,并设置以下环境变量来控制重试次数和重试之间的时间:
|
||||
您可以根据使用的提供商的需要自定义这些选项。查看他们的文档,并设置以下环境变量来控制重试次数和重试之间的时间:
|
||||
|
||||
- `LLM_NUM_RETRIES`(默认为 8)
|
||||
- `LLM_RETRY_MIN_WAIT`(默认为 15 秒)
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
:::
|
||||
|
||||
确保你已经启动并运行了 Ollama 服务器。
|
||||
详细的启动说明,请参考[这里](https://github.com/ollama/ollama)。
|
||||
有关详细的启动说明,请参考[此处](https://github.com/ollama/ollama)。
|
||||
|
||||
本指南假设你已经使用 `ollama serve` 启动了 ollama。如果你以不同的方式运行 ollama(例如在 docker 内),则可能需要修改说明。请注意,如果你正在运行 WSL,默认的 ollama 配置会阻止来自 docker 容器的请求。请参阅[这里](#configuring-ollama-service-wsl-zh)。
|
||||
本指南假设你已经使用 `ollama serve` 启动了 ollama。如果你以不同的方式运行 ollama(例如在 docker 内),则可能需要修改说明。请注意,如果你正在运行 WSL,默认的 ollama 配置会阻止来自 docker 容器的请求。请参阅[此处](#configuring-ollama-service-wsl-zh)。
|
||||
|
||||
## 拉取模型
|
||||
|
||||
Ollama 模型名称可以在[这里](https://ollama.com/library)找到。对于一个小例子,你可以使用
|
||||
Ollama 模型名称可以在[此处](https://ollama.com/library)找到。对于一个小示例,你可以使用
|
||||
`codellama:7b` 模型。更大的模型通常会有更好的表现。
|
||||
|
||||
```bash
|
||||
@@ -31,36 +31,19 @@ starcoder2:latest f67ae0f64584 1.7 GB 19 hours ago
|
||||
## 使用 Docker 运行 OpenHands
|
||||
|
||||
### 启动 OpenHands
|
||||
使用[这里](../getting-started)的说明,使用 Docker 启动 OpenHands。
|
||||
使用[此处](../getting-started)的说明使用 Docker 启动 OpenHands。
|
||||
但在运行 `docker run` 时,你需要添加一些额外的参数:
|
||||
|
||||
```bash
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
-e LLM_OLLAMA_BASE_URL="http://host.docker.internal:11434" \
|
||||
```
|
||||
|
||||
LLM_OLLAMA_BASE_URL 是可选的。如果设置了,它将用于在 UI 中显示可用的已安装模型。
|
||||
|
||||
示例:
|
||||
|
||||
```bash
|
||||
# 你希望 OpenHands 修改的目录。必须是绝对路径!
|
||||
export WORKSPACE_BASE=$(pwd)/workspace
|
||||
|
||||
docker run \
|
||||
-it \
|
||||
--pull=always \
|
||||
docker run # ...
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e LLM_OLLAMA_BASE_URL="http://host.docker.internal:11434" \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
ghcr.io/all-hands-ai/openhands:main
|
||||
# ...
|
||||
```
|
||||
|
||||
现在你应该可以连接到 `http://localhost:3000/` 了。
|
||||
LLM_OLLAMA_BASE_URL 是可选的。如果设置了它,它将用于在 UI 中显示
|
||||
可用的已安装模型。
|
||||
|
||||
|
||||
### 配置 Web 应用程序
|
||||
|
||||
@@ -74,7 +57,7 @@ docker run \
|
||||
|
||||
### 从源代码构建
|
||||
|
||||
使用 [Development.md](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md) 中的说明来构建 OpenHands。
|
||||
使用 [Development.md](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md) 中的说明构建 OpenHands。
|
||||
通过运行 `make setup-config` 确保 `config.toml` 存在,它将为你创建一个。在 `config.toml` 中,输入以下内容:
|
||||
|
||||
```
|
||||
@@ -87,13 +70,13 @@ ollama_base_url="http://localhost:11434"
|
||||
|
||||
```
|
||||
|
||||
完成!现在你可以通过 `make run` 启动 OpenHands。你现在应该可以连接到 `http://localhost:3000/` 了。
|
||||
完成!现在你可以通过 `make run` 启动 OpenHands。你现在应该能够连接到 `http://localhost:3000/`
|
||||
|
||||
### 配置 Web 应用程序
|
||||
|
||||
在 OpenHands UI 中,点击左下角的设置齿轮。
|
||||
然后在 `Model` 输入框中,输入 `ollama/codellama:7b`,或者你之前拉取的模型名称。
|
||||
如果它没有出现在下拉菜单中,启用 `Advanced Settings` 并输入。请注意:你需要 `ollama list` 列出的模型名称,带有 `ollama/` 前缀。
|
||||
如果它没有出现在下拉列表中,启用 `Advanced Settings` 并输入它。请注意:你需要 `ollama list` 列出的模型名称,带有 `ollama/` 前缀。
|
||||
|
||||
在 API Key 字段中,输入 `ollama` 或任何值,因为你不需要特定的密钥。
|
||||
|
||||
@@ -101,7 +84,7 @@ ollama_base_url="http://localhost:11434"
|
||||
|
||||
现在你已经准备好了!
|
||||
|
||||
## 配置 ollama 服务(WSL){#configuring-ollama-service-wsl-zh}
|
||||
## 配置 ollama 服务(WSL) {#configuring-ollama-service-wsl-zh}
|
||||
|
||||
WSL 中 ollama 的默认配置只服务于 localhost。这意味着你无法从 docker 容器中访问它。例如,它不能与 OpenHands 一起工作。首先让我们测试 ollama 是否正确运行。
|
||||
|
||||
@@ -115,7 +98,7 @@ curl http://localhost:11434/api/generate -d '{"model":"[NAME]","prompt":"hi"}'
|
||||
完成后,测试它是否允许"外部"请求,例如来自 docker 容器内部的请求。
|
||||
|
||||
```bash
|
||||
docker ps # 获取正在运行的 docker 容器列表,为了最准确的测试,选择 OpenHands 沙箱容器。
|
||||
docker ps # 获取正在运行的 docker 容器列表,为了最准确的测试,选择 OpenHands 沙盒容器。
|
||||
docker exec [CONTAINER ID] curl http://host.docker.internal:11434/api/generate -d '{"model":"[NAME]","prompt":"hi"}'
|
||||
#例如 docker exec cd9cc82f7a11 curl http://host.docker.internal:11434/api/generate -d '{"model":"codellama","prompt":"hi"}'
|
||||
```
|
||||
@@ -152,7 +135,7 @@ sudo systemctl restart ollama
|
||||
|
||||
```bash
|
||||
ollama list # 获取已安装模型的列表
|
||||
docker ps # 获取正在运行的 docker 容器列表,为了最准确的测试,选择 OpenHands 沙箱容器。
|
||||
docker ps # 获取正在运行的 docker 容器列表,为了最准确的测试,选择 OpenHands 沙盒容器。
|
||||
docker exec [CONTAINER ID] curl http://host.docker.internal:11434/api/generate -d '{"model":"[NAME]","prompt":"hi"}'
|
||||
```
|
||||
|
||||
@@ -163,7 +146,7 @@ docker exec [CONTAINER ID] curl http://host.docker.internal:11434/api/generate -
|
||||
1. 打开 LM Studio
|
||||
2. 转到 Local Server 选项卡。
|
||||
3. 点击 "Start Server" 按钮。
|
||||
4. 从下拉菜单中选择要使用的模型。
|
||||
4. 从下拉列表中选择要使用的模型。
|
||||
|
||||
|
||||
设置以下配置:
|
||||
@@ -176,21 +159,14 @@ CUSTOM_LLM_PROVIDER="openai"
|
||||
### Docker
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
-it \
|
||||
--pull=always \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
docker run # ...
|
||||
-e LLM_MODEL="openai/lmstudio" \
|
||||
-e LLM_BASE_URL="http://host.docker.internal:1234/v1" \
|
||||
-e CUSTOM_LLM_PROVIDER="openai" \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-p 3000:3000 \
|
||||
ghcr.io/all-hands-ai/openhands:main
|
||||
# ...
|
||||
```
|
||||
|
||||
现在你应该可以连接到 `http://localhost:3000/` 了。
|
||||
你现在应该能够连接到 `http://localhost:3000/`
|
||||
|
||||
在开发环境中,你可以在 `config.toml` 文件中设置以下配置:
|
||||
|
||||
@@ -204,7 +180,7 @@ base_url="http://localhost:1234/v1"
|
||||
custom_llm_provider="openai"
|
||||
```
|
||||
|
||||
完成!现在你可以通过 `make run` 启动 OpenHands,无需 Docker。你现在应该可以连接到 `http://localhost:3000/` 了。
|
||||
完成!现在你可以通过 `make run` 启动 OpenHands,无需 Docker。你现在应该能够连接到 `http://localhost:3000/`
|
||||
|
||||
# 注意
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
# 自定义代理行为
|
||||
|
||||
OpenHands 可以通过提供特定仓库的上下文和指南来进行自定义,以更有效地处理特定仓库。本节将解释如何为你的项目优化 OpenHands。
|
||||
|
||||
## 仓库配置
|
||||
|
||||
你可以通过在仓库根目录下创建 `.openhands` 目录来自定义 OpenHands 在你的仓库中的行为。至少,它应该包含文件 `.openhands/microagents/repo.md`,其中包括每次代理处理此仓库时都会提供给代理的指令。
|
||||
|
||||
我们建议包括以下信息:
|
||||
1. **仓库概述**:简要描述你的项目的目的和架构
|
||||
2. **目录结构**:关键目录及其用途
|
||||
3. **开发指南**:项目特定的编码标准和实践
|
||||
4. **测试要求**:如何运行测试以及需要哪些类型的测试
|
||||
5. **设置说明**:构建和运行项目所需的步骤
|
||||
|
||||
### 仓库配置示例
|
||||
`.openhands/microagents/repo.md` 文件示例:
|
||||
```
|
||||
Repository: MyProject
|
||||
Description: A web application for task management
|
||||
|
||||
Directory Structure:
|
||||
- src/: Main application code
|
||||
- tests/: Test files
|
||||
- docs/: Documentation
|
||||
|
||||
Setup:
|
||||
- Run `npm install` to install dependencies
|
||||
- Use `npm run dev` for development
|
||||
- Run `npm test` for testing
|
||||
|
||||
Guidelines:
|
||||
- Follow ESLint configuration
|
||||
- Write tests for all new features
|
||||
- Use TypeScript for new code
|
||||
```
|
||||
|
||||
### 自定义提示
|
||||
|
||||
在处理自定义仓库时:
|
||||
|
||||
1. **参考项目标准**:提及你的项目中使用的特定编码标准或模式
|
||||
2. **包括上下文**:参考相关文档或现有实现
|
||||
3. **指定测试要求**:在提示中包括项目特定的测试要求
|
||||
|
||||
自定义提示示例:
|
||||
```
|
||||
Add a new task completion feature to src/components/TaskList.tsx following our existing component patterns.
|
||||
Include unit tests in tests/components/ and update the documentation in docs/features/.
|
||||
The component should use our shared styling from src/styles/components.
|
||||
```
|
||||
|
||||
### 仓库自定义的最佳实践
|
||||
|
||||
1. **保持说明更新**:随着项目的发展,定期更新你的 `.openhands` 目录
|
||||
2. **要具体**:包括特定于你的项目的具体路径、模式和要求
|
||||
3. **记录依赖项**:列出开发所需的所有工具和依赖项
|
||||
4. **包括示例**:提供项目中良好代码模式的示例
|
||||
5. **指定约定**:记录命名约定、文件组织和代码风格偏好
|
||||
|
||||
通过为你的仓库自定义 OpenHands,你将获得更准确、更一致的结果,这些结果符合你的项目标准和要求。
|
||||
|
||||
## 其他微代理
|
||||
你可以在 `.openhands/microagents/` 目录中创建其他指令,如果找到特定关键字,如 `test`、`frontend` 或 `migration`,这些指令将发送给代理。有关更多信息,请参阅 [Microagents](microagents.md)。
|
||||
@@ -0,0 +1,213 @@
|
||||
# 微代理
|
||||
|
||||
OpenHands 使用专门的微代理来高效处理特定任务和上下文。这些微代理是小型、专注的组件,为特定场景提供专门的行为和知识。
|
||||
|
||||
## 概述
|
||||
|
||||
微代理在 `openhands/agenthub/codeact_agent/micro/` 目录下的 Markdown 文件中定义。每个微代理都配置有:
|
||||
|
||||
- 唯一的名称
|
||||
- 代理类型(通常是 CodeActAgent)
|
||||
- 触发代理的关键词
|
||||
- 具体的指令和功能
|
||||
|
||||
## 可用的微代理
|
||||
|
||||
### GitHub 代理
|
||||
**文件**:`github.md`
|
||||
**触发词**:`github`、`git`
|
||||
|
||||
GitHub 代理专门用于 GitHub API 交互和仓库管理。它:
|
||||
- 可以访问用于 API 身份验证的 `GITHUB_TOKEN`
|
||||
- 遵循严格的仓库交互准则
|
||||
- 处理分支管理和拉取请求
|
||||
- 使用 GitHub API 而不是网页浏览器交互
|
||||
|
||||
主要特点:
|
||||
- 分支保护(防止直接推送到 main/master)
|
||||
- 自动创建 PR
|
||||
- Git 配置管理
|
||||
- 以 API 为先的 GitHub 操作方式
|
||||
|
||||
### NPM 代理
|
||||
**文件**:`npm.md`
|
||||
**触发词**:`npm`
|
||||
|
||||
专门处理 npm 包管理,特别关注:
|
||||
- 非交互式 shell 操作
|
||||
- 使用 Unix 'yes' 命令自动处理确认
|
||||
- 包安装自动化
|
||||
|
||||
### 自定义微代理
|
||||
|
||||
你可以通过在微代理目录中添加新的 Markdown 文件来创建自己的微代理。每个文件应遵循以下结构:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: agent_name
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- trigger_word1
|
||||
- trigger_word2
|
||||
---
|
||||
|
||||
微代理的指令和功能...
|
||||
```
|
||||
|
||||
## 最佳实践
|
||||
|
||||
使用微代理时:
|
||||
|
||||
1. **使用适当的触发词**:确保你的命令包含相关的触发词以激活正确的微代理
|
||||
2. **遵循代理准则**:每个代理都有特定的指令和限制 - 遵守这些准则以获得最佳结果
|
||||
3. **API 优先方法**:如果可用,使用 API 端点而不是网页界面
|
||||
4. **自动化友好**:设计适合非交互式环境的命令
|
||||
|
||||
## 集成
|
||||
|
||||
微代理自动集成到 OpenHands 的工作流程中。它们:
|
||||
- 监视传入的命令是否包含触发词
|
||||
- 在检测到相关触发词时激活
|
||||
- 应用其专门的知识和能力
|
||||
- 遵循其特定的准则和限制
|
||||
|
||||
## 使用示例
|
||||
|
||||
```bash
|
||||
# GitHub 代理示例
|
||||
git checkout -b feature-branch
|
||||
git commit -m "Add new feature"
|
||||
git push origin feature-branch
|
||||
|
||||
# NPM 代理示例
|
||||
yes | npm install package-name
|
||||
```
|
||||
|
||||
有关特定代理的更多信息,请参阅微代理目录中的各个文档文件。
|
||||
|
||||
## 贡献微代理
|
||||
|
||||
要为 OpenHands 贡献新的微代理,请遵循以下准则:
|
||||
|
||||
### 1. 规划你的微代理
|
||||
|
||||
在创建微代理之前,请考虑:
|
||||
- 它将解决什么具体问题或用例?
|
||||
- 它应该具有什么独特的能力或知识?
|
||||
- 什么触发词适合激活它?
|
||||
- 它应该遵循什么约束或准则?
|
||||
|
||||
### 2. 文件结构
|
||||
|
||||
在 `openhands/agenthub/codeact_agent/micro/` 中创建一个新的 Markdown 文件,文件名要有描述性(例如,`docker.md` 用于专注于 Docker 的代理)。
|
||||
|
||||
### 3. 必需组件
|
||||
|
||||
你的微代理文件必须包括:
|
||||
|
||||
1. **Front Matter**:文件开头的 YAML 元数据:
|
||||
```markdown
|
||||
---
|
||||
name: your_agent_name
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- trigger_word1
|
||||
- trigger_word2
|
||||
---
|
||||
```
|
||||
|
||||
2. **指令**:明确、具体的代理行为准则:
|
||||
```markdown
|
||||
你负责 [特定任务/领域]。
|
||||
|
||||
主要职责:
|
||||
1. [职责 1]
|
||||
2. [职责 2]
|
||||
|
||||
准则:
|
||||
- [准则 1]
|
||||
- [准则 2]
|
||||
|
||||
使用示例:
|
||||
[示例 1]
|
||||
[示例 2]
|
||||
```
|
||||
|
||||
### 4. 微代理开发的最佳实践
|
||||
|
||||
1. **明确范围**:让代理专注于特定领域或任务
|
||||
2. **明确指令**:提供清晰、明确的指引
|
||||
3. **有用的示例**:包括常见用例的实际示例
|
||||
4. **安全第一**:包括必要的警告和约束
|
||||
5. **集成意识**:考虑代理如何与其他组件交互
|
||||
|
||||
### 5. 测试你的微代理
|
||||
|
||||
在提交之前:
|
||||
1. 用各种提示测试代理
|
||||
2. 验证触发词是否正确激活代理
|
||||
3. 确保指令清晰全面
|
||||
4. 检查与现有代理的潜在冲突
|
||||
|
||||
### 6. 示例实现
|
||||
|
||||
这是一个新微代理的模板:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: docker
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- docker
|
||||
- container
|
||||
---
|
||||
|
||||
你负责 Docker 容器管理和 Dockerfile 创建。
|
||||
|
||||
主要职责:
|
||||
1. 创建和修改 Dockerfile
|
||||
2. 管理容器生命周期
|
||||
3. 处理 Docker Compose 配置
|
||||
|
||||
准则:
|
||||
- 尽可能使用官方基础镜像
|
||||
- 包括必要的安全考虑
|
||||
- 遵循 Docker 最佳实践进行层优化
|
||||
|
||||
示例:
|
||||
1. 创建 Dockerfile:
|
||||
```dockerfile
|
||||
FROM node:18-alpine
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
CMD ["npm", "start"]
|
||||
```
|
||||
|
||||
2. Docker Compose 用法:
|
||||
```yaml
|
||||
version: '3'
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000"
|
||||
```
|
||||
|
||||
记住要:
|
||||
- 验证 Dockerfile 语法
|
||||
- 检查安全漏洞
|
||||
- 优化构建时间和镜像大小
|
||||
```
|
||||
|
||||
### 7. 提交流程
|
||||
|
||||
1. 在正确的目录中创建你的微代理文件
|
||||
2. 全面测试
|
||||
3. 提交包含以下内容的拉取请求:
|
||||
- 新的微代理文件
|
||||
- 更新文档(如果需要)
|
||||
- 代理的目的和功能说明
|
||||
|
||||
请记住,微代理是在特定领域扩展 OpenHands 功能的强大方式。设计良好的代理可以显著提高系统处理专门任务的能力。
|
||||
@@ -0,0 +1,43 @@
|
||||
以下是翻译后的内容:
|
||||
|
||||
# 提示最佳实践
|
||||
|
||||
在使用 OpenHands AI 软件开发者时,提供清晰有效的提示至关重要。本指南概述了创建提示的最佳实践,以产生最准确和最有用的响应。
|
||||
|
||||
## 好的提示的特点
|
||||
|
||||
好的提示应该:
|
||||
|
||||
1. **具体**: 它们准确解释应该添加什么功能或需要修复什么错误。
|
||||
2. **位置特定**: 如果已知,它们解释了应该修改代码库中的哪些位置。
|
||||
3. **适当范围**: 它们应该是单个功能的大小,通常不超过100行代码。
|
||||
|
||||
## 示例
|
||||
|
||||
### 好的提示示例
|
||||
|
||||
1. "在 `utils/math_operations.py` 中添加一个函数 `calculate_average`,它接受一个数字列表作为输入并返回它们的平均值。"
|
||||
|
||||
2. "修复 `frontend/src/components/UserProfile.tsx` 第42行发生的 TypeError。错误表明我们试图访问 undefined 的属性。"
|
||||
|
||||
3. "为注册表单中的电子邮件字段实现输入验证。更新 `frontend/src/components/RegistrationForm.tsx` 以在提交之前检查电子邮件是否为有效格式。"
|
||||
|
||||
### 不好的提示示例
|
||||
|
||||
1. "让代码变得更好。"(太模糊,不具体)
|
||||
|
||||
2. "用不同的框架重写整个后端。"(范围不合适)
|
||||
|
||||
3. "用户身份验证中有一个错误。你能找到并修复它吗?"(缺乏具体性和位置信息)
|
||||
|
||||
## 有效提示的技巧
|
||||
|
||||
1. 尽可能具体地说明所需的结果或要解决的问题。
|
||||
2. 提供上下文,包括相关的文件路径和行号(如果可用)。
|
||||
3. 将大型任务分解为更小、更易管理的提示。
|
||||
4. 包括任何相关的错误消息或日志。
|
||||
5. 如果从上下文中不明显,请指定编程语言或框架。
|
||||
|
||||
请记住,您的提示越精确和信息量大,AI 就越能帮助您开发或修改 OpenHands 软件。
|
||||
|
||||
有关更多有用提示的示例,请参阅[OpenHands 入门](../getting-started)。
|
||||
@@ -0,0 +1,76 @@
|
||||
# 运行时配置
|
||||
|
||||
运行时是 OpenHands 代理可以编辑文件和运行命令的环境。
|
||||
|
||||
默认情况下,OpenHands 使用基于 Docker 的运行时,在您的本地计算机上运行。这意味着您只需要为使用的 LLM 付费,并且您的代码只会发送到 LLM。
|
||||
|
||||
我们还支持"远程"运行时,通常由第三方管理。它们可以使设置更简单、更具可扩展性,特别是当您并行运行多个 OpenHands 对话时(例如进行评估)。
|
||||
|
||||
## Docker 运行时
|
||||
这是启动 OpenHands 时使用的默认运行时。您可能会注意到传递给 `docker run` 的一些标志使这成为可能:
|
||||
|
||||
```
|
||||
docker run # ...
|
||||
-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 \
|
||||
# ...
|
||||
```
|
||||
|
||||
来自 nikolaik 的 `SANDBOX_RUNTIME_CONTAINER_IMAGE` 是一个预构建的运行时镜像,其中包含我们的运行时服务器,以及一些用于 Python 和 NodeJS 的基本实用程序。您也可以[构建自己的运行时镜像](how-to/custom-sandbox-guide)。
|
||||
|
||||
### 连接到您的文件系统
|
||||
这里一个有用的功能是能够连接到您的本地文件系统。
|
||||
|
||||
要将文件系统挂载到运行时,首先设置 WORKSPACE_BASE:
|
||||
```bash
|
||||
export WORKSPACE_BASE=/path/to/your/code
|
||||
|
||||
# Linux 和 Mac 示例
|
||||
# export WORKSPACE_BASE=$HOME/OpenHands
|
||||
# 将 $WORKSPACE_BASE 设置为 /home/<username>/OpenHands
|
||||
#
|
||||
# Windows 上的 WSL 示例
|
||||
# export WORKSPACE_BASE=/mnt/c/dev/OpenHands
|
||||
# 将 $WORKSPACE_BASE 设置为 C:\dev\OpenHands
|
||||
```
|
||||
|
||||
然后将以下选项添加到 `docker run` 命令中:
|
||||
|
||||
```bash
|
||||
docker run # ...
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
# ...
|
||||
```
|
||||
|
||||
请小心!没有任何措施可以阻止 OpenHands 代理删除或修改挂载到其工作区的任何文件。
|
||||
|
||||
此设置可能会导致一些文件权限问题(因此有 `SANDBOX_USER_ID` 变量),但似乎在大多数系统上都能很好地工作。
|
||||
|
||||
## All Hands 运行时
|
||||
All Hands 运行时目前处于测试阶段。您可以通过加入 Slack 上的 #remote-runtime-limited-beta 频道来请求访问权限([请参阅自述文件](https://github.com/All-Hands-AI/OpenHands?tab=readme-ov-file#-join-our-community)以获取邀请)。
|
||||
|
||||
要使用 All Hands 运行时,请在启动 OpenHands 时设置以下环境变量:
|
||||
|
||||
```bash
|
||||
docker run # ...
|
||||
-e RUNTIME=remote \
|
||||
-e SANDBOX_REMOTE_RUNTIME_API_URL="https://runtime.app.all-hands.dev" \
|
||||
-e SANDBOX_API_KEY="your-all-hands-api-key" \
|
||||
-e SANDBOX_KEEP_RUNTIME_ALIVE="true" \
|
||||
# ...
|
||||
```
|
||||
|
||||
## Modal 运行时
|
||||
我们在 [Modal](https://modal.com/) 的合作伙伴也为 OpenHands 提供了一个运行时。
|
||||
|
||||
要使用 Modal 运行时,请创建一个帐户,然后[创建一个 API 密钥](https://modal.com/settings)。
|
||||
|
||||
然后,您需要在启动 OpenHands 时设置以下环境变量:
|
||||
```bash
|
||||
docker run # ...
|
||||
-e RUNTIME=modal \
|
||||
-e MODAL_API_TOKEN_ID="your-id" \
|
||||
-e MODAL_API_TOKEN_SECRET="your-secret" \
|
||||
```
|
||||
@@ -1,148 +1,43 @@
|
||||
以下是翻译后的内容:
|
||||
|
||||
# 🚧 故障排除
|
||||
|
||||
有一些错误信息经常被用户报告。我们会尽量让安装过程更简单,但目前您可以在下面查找您的错误信息,看看是否有任何解决方法。如果您找到了更多关于这些问题的信息或解决方法,请提交一个 *PR* 来添加详细信息到这个文件。
|
||||
|
||||
:::tip
|
||||
OpenHands 仅通过 [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) 支持 Windows。
|
||||
请确保在您的 WSL 终端内运行所有命令。
|
||||
OpenHands 仅通过 WSL 支持 Windows。请确保在 WSL 终端内运行所有命令。
|
||||
:::
|
||||
|
||||
## 常见问题
|
||||
### 启动 Docker 客户端失败
|
||||
|
||||
* [无法连接到 Docker](#unable-to-connect-to-docker)
|
||||
* [404 资源未找到](#404-resource-not-found)
|
||||
* [`make build` 在安装包时卡住](#make-build-getting-stuck-on-package-installations)
|
||||
* [会话没有恢复](#sessions-are-not-restored)
|
||||
**描述**
|
||||
|
||||
### 无法连接到 Docker
|
||||
|
||||
[GitHub Issue](https://github.com/All-Hands-AI/OpenHands/issues/1226)
|
||||
|
||||
**症状**
|
||||
|
||||
```bash
|
||||
Error creating controller. Please check Docker is running and visit `https://docs.all-hands.dev/modules/usage/troubleshooting` for more debugging information.
|
||||
运行 OpenHands 时,出现以下错误:
|
||||
```
|
||||
Launch docker client failed. Please make sure you have installed docker and started docker desktop/daemon.
|
||||
```
|
||||
|
||||
```bash
|
||||
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
|
||||
```
|
||||
|
||||
**详情**
|
||||
|
||||
OpenHands 使用 Docker 容器来安全地工作,而不会潜在地破坏您的机器。
|
||||
|
||||
**解决方法**
|
||||
|
||||
* 运行 `docker ps` 以确保 docker 正在运行
|
||||
* 确保您不需要 `sudo` 来运行 docker [参见此处](https://www.baeldung.com/linux/docker-run-without-sudo)
|
||||
* 如果您在 Mac 上,请检查 [权限要求](https://docs.docker.com/desktop/mac/permission-requirements/),特别是考虑在 Docker Desktop 的 `Settings > Advanced` 下启用 `Allow the default Docker socket to be used`。
|
||||
* 此外,在 `Check for Updates` 下将您的 Docker 升级到最新版本
|
||||
**解决方案**
|
||||
|
||||
请按顺序尝试以下步骤:
|
||||
* 确认 `docker` 正在您的系统上运行。您应该能够在终端中成功运行 `docker ps`。
|
||||
* 如果使用 Docker Desktop,请确保 `Settings > Advanced > Allow the default Docker socket to be used` 已启用。
|
||||
* 根据您的配置,您可能需要在 Docker Desktop 中启用 `Settings > Resources > Network > Enable host networking`。
|
||||
* 重新安装 Docker Desktop。
|
||||
---
|
||||
### `404 资源未找到`
|
||||
|
||||
**症状**
|
||||
# 开发工作流程特定问题
|
||||
### 构建运行时 Docker 镜像时出错
|
||||
|
||||
```python
|
||||
Traceback (most recent call last):
|
||||
File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai.py", line 414, in completion
|
||||
raise e
|
||||
File "/app/.venv/lib/python3.12/site-packages/litellm/llms/openai.py", line 373, in completion
|
||||
response = openai_client.chat.completions.create(**data, timeout=timeout) # type: ignore
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_utils/_utils.py", line 277, in wrapper
|
||||
return func(*args, **kwargs)
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/resources/chat/completions.py", line 579, in create
|
||||
return self._post(
|
||||
^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1232, in post
|
||||
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 921, in request
|
||||
return self._request(
|
||||
^^^^^^^^^^^^^^
|
||||
File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 1012, in _request
|
||||
raise self._make_status_error_from_response(err.response) from None
|
||||
openai.NotFoundError: Error code: 404 - {'error': {'code': '404', 'message': 'Resource not found'}}
|
||||
**描述**
|
||||
|
||||
尝试启动新会话失败,并且日志中出现以下术语的错误:
|
||||
```
|
||||
debian-security bookworm-security
|
||||
InRelease At least one invalid signature was encountered.
|
||||
```
|
||||
|
||||
**详情**
|
||||
当现有外部库的哈希值发生变化且本地 Docker 实例缓存了先前版本时,似乎会发生这种情况。要解决此问题,请尝试以下操作:
|
||||
|
||||
当 LiteLLM(我们用于连接不同 LLM 提供商的库)找不到您尝试连接的 API 端点时,就会发生这种情况。这种情况最常发生在 Azure 或 ollama 用户身上。
|
||||
|
||||
**解决方法**
|
||||
|
||||
* 检查您是否正确设置了 `LLM_BASE_URL`
|
||||
* 根据 [LiteLLM 文档](https://docs.litellm.ai/docs/providers) 检查模型是否设置正确
|
||||
* 如果您在 UI 内运行,请确保在设置模态框中设置 `model`
|
||||
* 如果您在无头模式下运行(通过 main.py),请确保在您的 env/config 中设置 `LLM_MODEL`
|
||||
* 确保您已遵循 LLM 提供商的任何特殊说明
|
||||
* [Azure](/modules/usage/llms/azure-llms)
|
||||
* [Google](/modules/usage/llms/google-llms)
|
||||
* 确保您的 API 密钥正确
|
||||
* 看看您是否可以使用 `curl` 连接到 LLM
|
||||
* 尝试 [直接通过 LiteLLM 连接](https://github.com/BerriAI/litellm) 以测试您的设置
|
||||
|
||||
---
|
||||
### `make build` 在安装包时卡住
|
||||
|
||||
**症状**
|
||||
|
||||
包安装在 `Pending...` 处卡住,没有任何错误信息:
|
||||
|
||||
```bash
|
||||
Package operations: 286 installs, 0 updates, 0 removals
|
||||
|
||||
- Installing certifi (2024.2.2): Pending...
|
||||
- Installing h11 (0.14.0): Pending...
|
||||
- Installing idna (3.7): Pending...
|
||||
- Installing sniffio (1.3.1): Pending...
|
||||
- Installing typing-extensions (4.11.0): Pending...
|
||||
```
|
||||
|
||||
**详情**
|
||||
|
||||
在极少数情况下,`make build` 可能会在安装包时看似卡住,没有任何错误信息。
|
||||
|
||||
**解决方法**
|
||||
|
||||
包安装程序 Poetry 可能缺少一个配置设置,用于查找凭据的位置(keyring)。
|
||||
|
||||
首先用 `env` 检查是否存在 `PYTHON_KEYRING_BACKEND` 的值。
|
||||
如果没有,运行下面的命令将其设置为一个已知值,然后重试构建:
|
||||
|
||||
```bash
|
||||
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
|
||||
```
|
||||
|
||||
---
|
||||
### 会话没有恢复
|
||||
|
||||
**症状**
|
||||
|
||||
OpenHands 通常在打开 UI 时询问是恢复还是开始新会话。
|
||||
但是点击"恢复"仍然会开始一个全新的聊天。
|
||||
|
||||
**详情**
|
||||
|
||||
截至目前,使用标准安装,会话数据存储在内存中。
|
||||
目前,如果 OpenHands 的服务重新启动,之前的会话会变得无效(生成一个新的密钥),因此无法恢复。
|
||||
|
||||
**解决方法**
|
||||
|
||||
* 通过编辑 `config.toml` 文件(在 OpenHands 的根文件夹中)来更改配置,使会话持久化,指定一个 `file_store` 和一个绝对的 `file_store_path`:
|
||||
|
||||
```toml
|
||||
file_store="local"
|
||||
file_store_path="/absolute/path/to/openhands/cache/directory"
|
||||
```
|
||||
|
||||
* 在您的 .bashrc 中添加一个固定的 jwt 密钥,如下所示,这样之前的会话 id 应该可以保持被接受。
|
||||
|
||||
```bash
|
||||
EXPORT JWT_SECRET=A_CONST_VALUE
|
||||
```
|
||||
* 停止名称以 `openhands-runtime-` 为前缀的任何容器:
|
||||
`docker ps --filter name=openhands-runtime- --filter status=running -aq | xargs docker stop`
|
||||
* 删除名称以 `openhands-runtime-` 为前缀的任何容器:
|
||||
`docker rmi $(docker images --filter name=openhands-runtime- -q --no-trunc)`
|
||||
* 停止并删除名称以 `openhands-runtime-` 为前缀的任何容器/镜像
|
||||
* 清理容器/镜像:`docker container prune -f && docker image prune -f`
|
||||
|
||||
@@ -4,10 +4,9 @@
|
||||
|
||||
Achieving full replication of production-grade applications with LLMs is a complex endeavor. Our strategy involves:
|
||||
|
||||
1. **Core Technical Research:** Focusing on foundational research to understand and improve the technical aspects of code generation and handling
|
||||
2. **Specialist Abilities:** Enhancing the effectiveness of core components through data curation, training methods, and more
|
||||
3. **Task Planning:** Developing capabilities for bug detection, codebase management, and optimization
|
||||
4. **Evaluation:** Establishing comprehensive evaluation metrics to better understand and improve our models
|
||||
- **Core Technical Research:** Focusing on foundational research to understand and improve the technical aspects of code generation and handling.
|
||||
- **Task Planning:** Developing capabilities for bug detection, codebase management, and optimization.
|
||||
- **Evaluation:** Establishing comprehensive evaluation metrics to better understand and improve our agents.
|
||||
|
||||
## Default Agent
|
||||
|
||||
@@ -15,11 +14,14 @@ Our default Agent is currently the [CodeActAgent](agents), which is capable of g
|
||||
|
||||
## Built With
|
||||
|
||||
OpenHands is built using a combination of powerful frameworks and libraries, providing a robust foundation for its development. Here are the key technologies used in the project:
|
||||
OpenHands is built using a combination of powerful frameworks and libraries, providing a robust foundation for its
|
||||
development. Here are the key technologies used in the project:
|
||||
|
||||
       
|
||||
|
||||
Please note that the selection of these technologies is in progress, and additional technologies may be added or existing ones may be removed as the project evolves. We strive to adopt the most suitable and efficient tools to enhance the capabilities of OpenHands.
|
||||
Please note that the selection of these technologies is in progress, and additional technologies may be added or
|
||||
existing ones may be removed as the project evolves. We strive to adopt the most suitable and efficient tools to
|
||||
enhance the capabilities of OpenHands.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -7,53 +7,11 @@ If you are running in [GUI Mode](https://docs.all-hands.dev/modules/usage/how-to
|
||||
take precedence.
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
# Table of Contents
|
||||
|
||||
1. [Core Configuration](#core-configuration)
|
||||
- [API Keys](#api-keys)
|
||||
- [Workspace](#workspace)
|
||||
- [Debugging and Logging](#debugging-and-logging)
|
||||
- [Session Management](#session-management)
|
||||
- [Trajectories](#trajectories)
|
||||
- [File Store](#file-store)
|
||||
- [Task Management](#task-management)
|
||||
- [Sandbox Configuration](#sandbox-configuration)
|
||||
- [Miscellaneous](#miscellaneous)
|
||||
2. [LLM Configuration](#llm-configuration)
|
||||
- [AWS Credentials](#aws-credentials)
|
||||
- [API Configuration](#api-configuration)
|
||||
- [Custom LLM Provider](#custom-llm-provider)
|
||||
- [Embeddings](#embeddings)
|
||||
- [Message Handling](#message-handling)
|
||||
- [Model Selection](#model-selection)
|
||||
- [Retrying](#retrying)
|
||||
- [Advanced Options](#advanced-options)
|
||||
3. [Agent Configuration](#agent-configuration)
|
||||
- [Microagent Configuration](#microagent-configuration)
|
||||
- [Memory Configuration](#memory-configuration)
|
||||
- [LLM Configuration](#llm-configuration-2)
|
||||
- [ActionSpace Configuration](#actionspace-configuration)
|
||||
- [Microagent Usage](#microagent-usage)
|
||||
4. [Sandbox Configuration](#sandbox-configuration-2)
|
||||
- [Execution](#execution)
|
||||
- [Container Image](#container-image)
|
||||
- [Networking](#networking)
|
||||
- [Linting and Plugins](#linting-and-plugins)
|
||||
- [Dependencies and Environment](#dependencies-and-environment)
|
||||
- [Evaluation](#evaluation)
|
||||
5. [Security Configuration](#security-configuration)
|
||||
- [Confirmation Mode](#confirmation-mode)
|
||||
- [Security Analyzer](#security-analyzer)
|
||||
|
||||
---
|
||||
|
||||
## Core Configuration
|
||||
|
||||
The core configuration options are defined in the `[core]` section of the `config.toml` file.
|
||||
|
||||
**API Keys**
|
||||
### API Keys
|
||||
- `e2b_api_key`
|
||||
- Type: `str`
|
||||
- Default: `""`
|
||||
@@ -69,7 +27,7 @@ The core configuration options are defined in the `[core]` section of the `confi
|
||||
- Default: `""`
|
||||
- Description: API token secret for Modal
|
||||
|
||||
**Workspace**
|
||||
### Workspace
|
||||
- `workspace_base`
|
||||
- Type: `str`
|
||||
- Default: `"./workspace"`
|
||||
@@ -80,7 +38,7 @@ The core configuration options are defined in the `[core]` section of the `confi
|
||||
- Default: `"/tmp/cache"`
|
||||
- Description: Cache directory path
|
||||
|
||||
**Debugging and Logging**
|
||||
### Debugging and Logging
|
||||
- `debug`
|
||||
- Type: `bool`
|
||||
- Default: `false`
|
||||
@@ -91,13 +49,18 @@ The core configuration options are defined in the `[core]` section of the `confi
|
||||
- Default: `false`
|
||||
- Description: Disable color in terminal output
|
||||
|
||||
**Trajectories**
|
||||
- `trajectories_path`
|
||||
### Trajectories
|
||||
- `save_trajectory_path`
|
||||
- Type: `str`
|
||||
- Default: `"./trajectories"`
|
||||
- Description: Path to store trajectories (can be a folder or a file). If it's a folder, the trajectories will be saved in a file named with the session id name and .json extension, in that folder.
|
||||
|
||||
**File Store**
|
||||
- `replay_trajectory_path`
|
||||
- Type: `str`
|
||||
- Default: `""`
|
||||
- Description: Path to load a trajectory and replay. If given, must be a path to the trajectory file in JSON format. The actions in the trajectory file would be replayed first before any user instruction is executed.
|
||||
|
||||
### File Store
|
||||
- `file_store_path`
|
||||
- Type: `str`
|
||||
- Default: `"/tmp/file_store"`
|
||||
@@ -128,7 +91,7 @@ The core configuration options are defined in the `[core]` section of the `confi
|
||||
- Default: `[".*"]`
|
||||
- Description: List of allowed file extensions for uploads
|
||||
|
||||
**Task Management**
|
||||
### Task Management
|
||||
- `max_budget_per_task`
|
||||
- Type: `float`
|
||||
- Default: `0.0`
|
||||
@@ -139,7 +102,7 @@ The core configuration options are defined in the `[core]` section of the `confi
|
||||
- Default: `100`
|
||||
- Description: Maximum number of iterations
|
||||
|
||||
**Sandbox Configuration**
|
||||
### Sandbox Configuration
|
||||
- `workspace_mount_path_in_sandbox`
|
||||
- Type: `str`
|
||||
- Default: `"/workspace"`
|
||||
@@ -155,7 +118,7 @@ The core configuration options are defined in the `[core]` section of the `confi
|
||||
- Default: `""`
|
||||
- Description: Path to rewrite the workspace mount path to. You can usually ignore this, it refers to special cases of running inside another container.
|
||||
|
||||
**Miscellaneous**
|
||||
### Miscellaneous
|
||||
- `run_as_openhands`
|
||||
- Type: `bool`
|
||||
- Default: `true`
|
||||
@@ -182,6 +145,10 @@ The LLM (Large Language Model) configuration options are defined in the `[llm]`
|
||||
|
||||
To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LLM_NUM_RETRIES`.
|
||||
|
||||
:::note
|
||||
For development setups, you can also define custom named LLM configurations. See [Custom LLM Configurations](./llms/custom-llm-configs) for details.
|
||||
:::
|
||||
|
||||
**AWS Credentials**
|
||||
- `aws_access_key_id`
|
||||
- Type: `str`
|
||||
@@ -198,7 +165,7 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL
|
||||
- Default: `""`
|
||||
- Description: AWS secret access key
|
||||
|
||||
**API Configuration**
|
||||
### API Configuration
|
||||
- `api_key`
|
||||
- Type: `str`
|
||||
- Default: `None`
|
||||
@@ -224,13 +191,13 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL
|
||||
- Default: `0.0`
|
||||
- Description: Cost per output token
|
||||
|
||||
**Custom LLM Provider**
|
||||
### Custom LLM Provider
|
||||
- `custom_llm_provider`
|
||||
- Type: `str`
|
||||
- Default: `""`
|
||||
- Description: Custom LLM provider
|
||||
|
||||
**Embeddings**
|
||||
### Embeddings
|
||||
- `embedding_base_url`
|
||||
- Type: `str`
|
||||
- Default: `""`
|
||||
@@ -246,7 +213,7 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL
|
||||
- Default: `"local"`
|
||||
- Description: Embedding model to use
|
||||
|
||||
**Message Handling**
|
||||
### Message Handling
|
||||
- `max_message_chars`
|
||||
- Type: `int`
|
||||
- Default: `30000`
|
||||
@@ -262,13 +229,13 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL
|
||||
- Default: `0`
|
||||
- Description: Maximum number of output tokens
|
||||
|
||||
**Model Selection**
|
||||
### Model Selection
|
||||
- `model`
|
||||
- Type: `str`
|
||||
- Default: `"claude-3-5-sonnet-20241022"`
|
||||
- Description: Model to use
|
||||
|
||||
**Retrying**
|
||||
### Retrying
|
||||
- `num_retries`
|
||||
- Type: `int`
|
||||
- Default: `8`
|
||||
@@ -289,7 +256,7 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL
|
||||
- Default: `2.0`
|
||||
- Description: Multiplier for exponential backoff calculation
|
||||
|
||||
**Advanced Options**
|
||||
### Advanced Options
|
||||
- `drop_params`
|
||||
- Type: `bool`
|
||||
- Default: `false`
|
||||
@@ -329,13 +296,13 @@ To use these with the docker command, pass in `-e LLM_<option>`. Example: `-e LL
|
||||
|
||||
The agent configuration options are defined in the `[agent]` and `[agent.<agent_name>]` sections of the `config.toml` file.
|
||||
|
||||
**Microagent Configuration**
|
||||
### Microagent Configuration
|
||||
- `micro_agent_name`
|
||||
- Type: `str`
|
||||
- Default: `""`
|
||||
- Description: Name of the micro agent to use for this agent
|
||||
|
||||
**Memory Configuration**
|
||||
### Memory Configuration
|
||||
- `memory_enabled`
|
||||
- Type: `bool`
|
||||
- Default: `false`
|
||||
@@ -346,13 +313,13 @@ The agent configuration options are defined in the `[agent]` and `[agent.<agent_
|
||||
- Default: `3`
|
||||
- Description: The maximum number of threads indexing at the same time for embeddings
|
||||
|
||||
**LLM Configuration**
|
||||
### LLM Configuration
|
||||
- `llm_config`
|
||||
- Type: `str`
|
||||
- Default: `'your-llm-config-group'`
|
||||
- Description: The name of the LLM config to use
|
||||
|
||||
**ActionSpace Configuration**
|
||||
### ActionSpace Configuration
|
||||
- `function_calling`
|
||||
- Type: `bool`
|
||||
- Default: `true`
|
||||
@@ -373,8 +340,8 @@ The agent configuration options are defined in the `[agent]` and `[agent.<agent_
|
||||
- Default: `false`
|
||||
- Description: Whether Jupyter is enabled in the action space
|
||||
|
||||
**Microagent Usage**
|
||||
- `use_microagents`
|
||||
### Microagent Usage
|
||||
- `enable_prompt_extensions`
|
||||
- Type: `bool`
|
||||
- Default: `true`
|
||||
- Description: Whether to use microagents at all
|
||||
@@ -390,7 +357,7 @@ The sandbox configuration options are defined in the `[sandbox]` section of the
|
||||
|
||||
To use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-e SANDBOX_TIMEOUT`.
|
||||
|
||||
**Execution**
|
||||
### Execution
|
||||
- `timeout`
|
||||
- Type: `int`
|
||||
- Default: `120`
|
||||
@@ -401,19 +368,19 @@ To use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-
|
||||
- Default: `1000`
|
||||
- Description: Sandbox user ID
|
||||
|
||||
**Container Image**
|
||||
### Container Image
|
||||
- `base_container_image`
|
||||
- Type: `str`
|
||||
- Default: `"nikolaik/python-nodejs:python3.12-nodejs22"`
|
||||
- Description: Container image to use for the sandbox
|
||||
|
||||
**Networking**
|
||||
### Networking
|
||||
- `use_host_network`
|
||||
- Type: `bool`
|
||||
- Default: `false`
|
||||
- Description: Use host network
|
||||
|
||||
**Linting and Plugins**
|
||||
### Linting and Plugins
|
||||
- `enable_auto_lint`
|
||||
- Type: `bool`
|
||||
- Default: `false`
|
||||
@@ -424,7 +391,7 @@ To use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-
|
||||
- Default: `true`
|
||||
- Description: Whether to initialize plugins
|
||||
|
||||
**Dependencies and Environment**
|
||||
### Dependencies and Environment
|
||||
- `runtime_extra_deps`
|
||||
- Type: `str`
|
||||
- Default: `""`
|
||||
@@ -435,7 +402,7 @@ To use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-
|
||||
- Default: `{}`
|
||||
- Description: Environment variables to set at the launch of the runtime
|
||||
|
||||
**Evaluation**
|
||||
### Evaluation
|
||||
- `browsergym_eval_env`
|
||||
- Type: `str`
|
||||
- Default: `""`
|
||||
@@ -447,13 +414,13 @@ The security configuration options are defined in the `[security]` section of th
|
||||
|
||||
To use these with the docker command, pass in `-e SECURITY_<option>`. Example: `-e SECURITY_CONFIRMATION_MODE`.
|
||||
|
||||
**Confirmation Mode**
|
||||
### Confirmation Mode
|
||||
- `confirmation_mode`
|
||||
- Type: `bool`
|
||||
- Default: `false`
|
||||
- Description: Enable confirmation mode
|
||||
|
||||
**Security Analyzer**
|
||||
### Security Analyzer
|
||||
- `security_analyzer`
|
||||
- Type: `str`
|
||||
- Default: `""`
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# ✅ Providing Feedback
|
||||
|
||||
When using OpenHands, you will encounter cases where things work well, and others where they don't. We encourage you to provide feedback when you use OpenHands to help give feedback to the development team, and perhaps more importantly, create an open corpus of coding agent training examples -- Share-OpenHands!
|
||||
When using OpenHands, you will encounter cases where things work well, and others where they don't. We encourage you to
|
||||
provide feedback when you use OpenHands to help give feedback to the development team, and perhaps more importantly,
|
||||
create an open corpus of coding agent training examples -- Share-OpenHands!
|
||||
|
||||
## 📝 How to Provide Feedback
|
||||
|
||||
Providing feedback is easy! When you are using OpenHands, you can press the thumbs-up or thumbs-down button at any point during your interaction. You will be prompted to provide your email address (e.g. so we can contact you if we want to ask any follow-up questions), and you can choose whether you want to provide feedback publicly or privately.
|
||||
Providing feedback is easy! When you are using OpenHands, you can press the thumbs-up or thumbs-down button at any point
|
||||
during your interaction. You will be prompted to provide your email address
|
||||
(e.g. so we can contact you if we want to ask any follow-up questions), and you can choose whether you want to provide feedback publicly or privately.
|
||||
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/5rFx-StMVV0?si=svo7xzp6LhGK_GXr" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
|
||||
|
||||
@@ -14,8 +18,11 @@ Providing feedback is easy! When you are using OpenHands, you can press the thum
|
||||
|
||||
When you submit data, you can submit it either publicly or privately.
|
||||
|
||||
* **Public** data will be distributed under the MIT License, like OpenHands itself, and can be used by the community to train and test models. Obviously, feedback that you can make public will be more valuable for the community as a whole, so when you are not dealing with sensitive information, we would encourage you to choose this option!
|
||||
* **Private** data will only be shared with the OpenHands team for the purpose of improving OpenHands.
|
||||
- **Public** data will be distributed under the MIT License, like OpenHands itself, and can be used by the community to
|
||||
train and test models. Obviously, feedback that you can make public will be more valuable for the community as a whole,
|
||||
so when you are not dealing with sensitive information, we would encourage you to choose this option!
|
||||
- **Private** data will be made available to the OpenHands team for the purpose of improving OpenHands.
|
||||
However, a link with a unique ID will still be created that you can share publicly with others.
|
||||
|
||||
### Who collects and stores the data?
|
||||
|
||||
@@ -27,13 +34,17 @@ The public data will be released when we hit fixed milestones, such as 1,000 pub
|
||||
At this time, we will follow the following release process:
|
||||
|
||||
1. All people who contributed public feedback will receive an email describing the data release and being given an opportunity to opt out.
|
||||
2. The person or people in charge of the data release will perform quality control of the data, removing low-quality feedback, removing email submitter email addresses, and attempting to remove any sensitive information.
|
||||
2. The person or people in charge of the data release will perform quality control of the data, removing low-quality feedback,
|
||||
removing email submitter email addresses, and attempting to remove any sensitive information.
|
||||
3. The data will be released publicly under the MIT license through commonly used sites such as github or Hugging Face.
|
||||
|
||||
### What if I want my data deleted?
|
||||
|
||||
For data on the All Hands AI servers, we are happy to delete it at request:
|
||||
|
||||
**One Piece of Data:** If you want one piece of data deleted, we will shortly be adding a mechanism to delete pieces of data using the link and password that is displayed on the interface when you submit data.
|
||||
**One Piece of Data:** If you want one piece of data deleted, we will shortly be adding a mechanism to delete pieces of
|
||||
data using the link and password that is displayed on the interface when you submit data.
|
||||
|
||||
**All Data:** If you would like all pieces of your data deleted, or you do not have the ID and password that you received when submitting the data, please contact `contact@all-hands.dev` from the email address that you registered when you originally submitted the data.
|
||||
**All Data:** If you would like all pieces of your data deleted, or you do not have the ID and password that you
|
||||
received when submitting the data, please contact `contact@all-hands.dev` from the email address that you registered
|
||||
when you originally submitted the data.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Getting Started with OpenHands
|
||||
|
||||
So you've [installed OpenHands](./installation) and have
|
||||
So you've [run OpenHands](./installation) and have
|
||||
[set up your LLM](./installation#setup). Now what?
|
||||
|
||||
OpenHands can help you tackle a wide variety of engineering tasks. But the technology
|
||||
@@ -44,7 +44,7 @@ For example, we might build a TODO app:
|
||||
|
||||
We can keep iterating on the app once the skeleton is there:
|
||||
|
||||
> Please allow adding an optional due date to every task
|
||||
> Please allow adding an optional due date to every task.
|
||||
|
||||
Just like with normal development, it's good to commit and push your code frequently.
|
||||
This way you can always revert back to an old state if the agent goes off track.
|
||||
@@ -59,15 +59,15 @@ OpenHands can also do a great job adding new code to an existing code base.
|
||||
|
||||
For example, you can ask OpenHands to add a new GitHub action to your project
|
||||
which lints your code. OpenHands may take a peek at your codebase to see what language
|
||||
it should use, but then it can just drop a new file into `./github/workflows/lint.yml`
|
||||
it should use and then drop a new file into `./github/workflows/lint.yml`.
|
||||
|
||||
> Please add a GitHub action that lints the code in this repository
|
||||
> Please add a GitHub action that lints the code in this repository.
|
||||
|
||||
Some tasks might require a bit more context. While OpenHands can use `ls` and `grep`
|
||||
to search through your codebase, providing context up front allows it to move faster,
|
||||
and more accurately. And it'll cost you fewer tokens!
|
||||
|
||||
> Please modify ./backend/api/routes.js to add a new route that returns a list of all tasks
|
||||
> Please modify ./backend/api/routes.js to add a new route that returns a list of all tasks.
|
||||
|
||||
> Please add a new React component that displays a list of Widgets to the ./frontend/components
|
||||
> directory. It should use the existing Widget component.
|
||||
@@ -78,15 +78,15 @@ OpenHands does great at refactoring existing code, especially in small chunks.
|
||||
You probably don't want to try rearchitecting your whole codebase, but breaking up
|
||||
long files and functions, renaming variables, etc. tend to work very well.
|
||||
|
||||
> Please rename all the single-letter variables in ./app.go
|
||||
> Please rename all the single-letter variables in ./app.go.
|
||||
|
||||
> Please break the function `build_and_deploy_widgets` into two functions, `build_widgets` and `deploy_widgets` in widget.php
|
||||
> Please break the function `build_and_deploy_widgets` into two functions, `build_widgets` and `deploy_widgets` in widget.php.
|
||||
|
||||
> Please break ./api/routes.js into separate files for each route
|
||||
> Please break ./api/routes.js into separate files for each route.
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
OpenHands can also help you track down and fix bugs in your code. But, as any
|
||||
OpenHands can also help you track down and fix bugs in your code. But as any
|
||||
developer knows, bug fixing can be extremely tricky, and often OpenHands will need more context.
|
||||
It helps if you've diagnosed the bug, but want OpenHands to figure out the logic.
|
||||
|
||||
@@ -94,18 +94,18 @@ It helps if you've diagnosed the bug, but want OpenHands to figure out the logic
|
||||
|
||||
> The `search_widgets` function in ./app.py is doing a case-sensitive search. Please make it case-insensitive.
|
||||
|
||||
It often helps to do test-driven development when bugfixing with an agent.
|
||||
It often helps to do test-driven development when bug fixing with an agent.
|
||||
You can ask the agent to write a new test, and then iterate until it fixes the bug:
|
||||
|
||||
> The `hello` function crashes on the empty string. Please write a test that reproduces this bug, then fix the code so it passes.
|
||||
|
||||
## More
|
||||
|
||||
OpenHands is capable of helping out on just about any coding task. But it takes some practice
|
||||
OpenHands is capable of helping out on just about any coding task but it takes some practice
|
||||
to get the most out of it. Remember to:
|
||||
* Keep your tasks small
|
||||
* Be as specific as possible
|
||||
* Provide as much context as possible
|
||||
* Commit and push frequently
|
||||
* Keep your tasks small.
|
||||
* Be as specific as possible.
|
||||
* Provide as much context as possible.
|
||||
* Commit and push frequently.
|
||||
|
||||
See [Prompting Best Practices](./prompting-best-practices) for more tips on how to get the most out of OpenHands.
|
||||
See [Prompting Best Practices](./prompting/prompting-best-practices) for more tips on how to get the most out of OpenHands.
|
||||
|
||||
@@ -6,10 +6,9 @@ This mode is different from the [headless mode](headless-mode), which is non-int
|
||||
|
||||
## With Python
|
||||
|
||||
To start an interactive OpenHands session via the command line, follow these steps:
|
||||
To start an interactive OpenHands session via the command line:
|
||||
|
||||
1. Ensure you have followed the [Development setup instructions](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md).
|
||||
|
||||
2. Run the following command:
|
||||
|
||||
```bash
|
||||
@@ -21,45 +20,32 @@ This command will start an interactive session where you can input tasks and rec
|
||||
You'll need to be sure to set your model, API key, and other settings via environment variables
|
||||
[or the `config.toml` file](https://github.com/All-Hands-AI/OpenHands/blob/main/config.template.toml).
|
||||
|
||||
|
||||
## With Docker
|
||||
|
||||
To run OpenHands in CLI mode with Docker, follow these steps:
|
||||
To run OpenHands in CLI mode with Docker:
|
||||
|
||||
1. Set `WORKSPACE_BASE` to the directory you want OpenHands to edit:
|
||||
1. Set the following environmental variables in your terminal:
|
||||
|
||||
```bash
|
||||
WORKSPACE_BASE=$(pwd)/workspace
|
||||
```
|
||||
- `WORKSPACE_BASE` to the directory you want OpenHands to edit (Ex: `export WORKSPACE_BASE=$(pwd)/workspace`).
|
||||
- `LLM_MODEL` to the model to use (Ex: `export LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"`).
|
||||
- `LLM_API_KEY` to the API key (Ex: `export LLM_API_KEY="sk_test_12345"`).
|
||||
|
||||
2. Set `LLM_MODEL` to the model you want to use:
|
||||
|
||||
```bash
|
||||
LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"
|
||||
|
||||
```
|
||||
|
||||
3. Set `LLM_API_KEY` to your API key:
|
||||
|
||||
```bash
|
||||
LLM_API_KEY="sk_test_12345"
|
||||
```
|
||||
|
||||
4. Run the following Docker command:
|
||||
2. Run the following Docker command:
|
||||
|
||||
```bash
|
||||
docker run -it \
|
||||
--pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.16-nikolaik \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-e LLM_API_KEY=$LLM_API_KEY \
|
||||
-e LLM_MODEL=$LLM_MODEL \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v ~/.openhands-state:/.openhands-state \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app-$(date +%Y%m%d%H%M%S) \
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.16 \
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.21 \
|
||||
python -m openhands.core.cli
|
||||
```
|
||||
|
||||
@@ -72,7 +58,7 @@ Here are some examples of CLI commands and their expected outputs:
|
||||
### Example 1: Simple Task
|
||||
|
||||
```bash
|
||||
How can I help? >> Write a Python script that prints "Hello, World!"
|
||||
>> Write a Python script that prints "Hello, World!"
|
||||
```
|
||||
|
||||
Expected Output:
|
||||
@@ -86,7 +72,7 @@ Expected Output:
|
||||
### Example 2: Bash Command
|
||||
|
||||
```bash
|
||||
How can I help? >> Create a directory named "test_dir"
|
||||
>> Create a directory named "test_dir"
|
||||
```
|
||||
|
||||
Expected Output:
|
||||
@@ -100,7 +86,7 @@ Expected Output:
|
||||
### Example 3: Error Handling
|
||||
|
||||
```bash
|
||||
How can I help? >> Delete a non-existent file
|
||||
>> Delete a non-existent file
|
||||
```
|
||||
|
||||
Expected Output:
|
||||
|
||||
@@ -9,8 +9,8 @@ as python and Node.js but may need other software installed by default.
|
||||
|
||||
You have two options for customization:
|
||||
|
||||
1. Use an existing image with the required software.
|
||||
2. Create your own custom Docker image.
|
||||
- Use an existing image with the required software.
|
||||
- Create your own custom Docker image.
|
||||
|
||||
If you choose the first option, you can skip the `Create Your Docker Image` section.
|
||||
|
||||
@@ -18,15 +18,21 @@ If you choose the first option, you can skip the `Create Your Docker Image` sect
|
||||
|
||||
To create a custom Docker image, it must be Debian based.
|
||||
|
||||
For example, if you want OpenHands to have `ruby` installed, create a `Dockerfile` with the following content:
|
||||
For example, if you want OpenHands to have `ruby` installed, you could create a `Dockerfile` with the following content:
|
||||
|
||||
```dockerfile
|
||||
FROM debian:latest
|
||||
FROM nikolaik/python-nodejs:python3.12-nodejs22
|
||||
|
||||
# Install required packages
|
||||
RUN apt-get update && apt-get install -y ruby
|
||||
```
|
||||
|
||||
Or you could use a Ruby-specific base image:
|
||||
|
||||
```dockerfile
|
||||
FROM ruby:latest
|
||||
```
|
||||
|
||||
Save this file in a folder. Then, build your Docker image (e.g., named custom-image) by navigating to the folder in
|
||||
the terminal and running::
|
||||
```bash
|
||||
@@ -55,10 +61,28 @@ This can be an image you’ve already pulled or one you’ve built:
|
||||
sandbox_base_container_image="custom-image"
|
||||
```
|
||||
|
||||
### Additional Configuration Options
|
||||
|
||||
The `config.toml` file supports several other options for customizing your sandbox:
|
||||
|
||||
```toml
|
||||
[core]
|
||||
# Install additional dependencies when the runtime is built
|
||||
# Can contain any valid shell commands
|
||||
# If you need the path to the Python interpreter in any of these commands, you can use the $OH_INTERPRETER_PATH variable
|
||||
runtime_extra_deps = """
|
||||
pip install numpy pandas
|
||||
apt-get update && apt-get install -y ffmpeg
|
||||
"""
|
||||
|
||||
# Set environment variables for the runtime
|
||||
# Useful for configuration that needs to be available at runtime
|
||||
runtime_startup_env_vars = { DATABASE_URL = "postgresql://user:pass@localhost/db" }
|
||||
|
||||
# Specify platform for multi-architecture builds (e.g., "linux/amd64" or "linux/arm64")
|
||||
platform = "linux/amd64"
|
||||
```
|
||||
|
||||
### Run
|
||||
|
||||
Run OpenHands by running ```make run``` in the top level directory.
|
||||
|
||||
## Technical Explanation
|
||||
|
||||
Please refer to [custom docker image section of the runtime documentation](https://docs.all-hands.dev/modules/usage/architecture/runtime#advanced-how-openhands-builds-and-maintains-od-runtime-images) for more details.
|
||||
|
||||
@@ -21,10 +21,10 @@ the [README for the OpenHands Resolver](https://github.com/All-Hands-AI/OpenHand
|
||||
### Iterative resolution
|
||||
|
||||
1. Create an issue in the repository.
|
||||
2. Add the `fix-me` label to the issue, or leave a comment starting with `@openhands-agent`
|
||||
3. Review the attempt to resolve the issue by checking the pull request
|
||||
4. Follow up with feedback through general comments, review comments, or inline thread comments
|
||||
5. Add the `fix-me` label to the pull request, or address a specific comment by starting with `@openhands-agent`
|
||||
2. Add the `fix-me` label to the issue, or leave a comment starting with `@openhands-agent`.
|
||||
3. Review the attempt to resolve the issue by checking the pull request.
|
||||
4. Follow up with feedback through general comments, review comments, or inline thread comments.
|
||||
5. Add the `fix-me` label to the pull request, or address a specific comment by starting with `@openhands-agent`.
|
||||
|
||||
### Label versus Macro
|
||||
|
||||
@@ -48,62 +48,3 @@ The customization options you can set are:
|
||||
| `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_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"` |
|
||||
|
||||
## Writing Effective .openhands_instructions Files
|
||||
|
||||
The `.openhands_instructions` file is a file that you can put in the root directory of your repository to guide OpenHands
|
||||
in understanding and working with your repository effectively. Here are key tips for writing high-quality instructions:
|
||||
|
||||
### Core Principles
|
||||
|
||||
1. **Concise but Informative**: Provide a clear, focused overview of the repository that emphasizes the most common
|
||||
actions OpenHands will need to perform.
|
||||
|
||||
2. **Repository Structure**: Explain the key directories and their purposes, especially highlighting where different
|
||||
types of code (e.g., frontend, backend) are located.
|
||||
|
||||
3. **Development Workflows**: Document the essential commands for:
|
||||
|
||||
- Building and setting up the project
|
||||
- Running tests
|
||||
- Linting and code quality checks
|
||||
- Any environment-specific requirements
|
||||
|
||||
4. **Testing Guidelines**: Specify:
|
||||
- Where tests are located
|
||||
- How to run specific test suites
|
||||
- Any testing conventions or requirements
|
||||
|
||||
### Example Structure
|
||||
|
||||
```markdown
|
||||
# Repository Overview
|
||||
|
||||
[Brief description of the project]
|
||||
|
||||
## General Setup
|
||||
|
||||
- Main build command
|
||||
- Development environment setup
|
||||
- Pre-commit checks
|
||||
|
||||
## Backend
|
||||
|
||||
- Location and structure
|
||||
- Testing instructions
|
||||
- Environment requirements
|
||||
|
||||
## Frontend
|
||||
|
||||
- Setup prerequisites
|
||||
- Build and test commands
|
||||
- Environment variables
|
||||
|
||||
## Additional Guidelines
|
||||
|
||||
- Code style requirements
|
||||
- Special considerations
|
||||
- Common workflows
|
||||
```
|
||||
|
||||
For a real-world example, refer to the [OpenHands repository's .openhands_instructions](https://github.com/All-Hands-AI/OpenHands/blob/main/.openhands_instructions).
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
## 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.
|
||||
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
|
||||
|
||||
1. Follow the instructions in the [Installation](../installation) guide to install OpenHands.
|
||||
|
||||
2. After running the command, access OpenHands at [http://localhost:3000](http://localhost:3000).
|
||||
|
||||
## Interacting with the GUI
|
||||
@@ -23,39 +23,39 @@ OpenHands provides a user-friendly Graphical User Interface (GUI) mode for inter
|
||||
|
||||
OpenHands automatically exports a `GITHUB_TOKEN` to the shell environment if it is available. This can happen in two ways:
|
||||
|
||||
1. **Locally (OSS)**: The user directly inputs their GitHub token
|
||||
2. **Online (SaaS)**: The token is obtained through GitHub OAuth authentication
|
||||
- **Locally (OSS)**: The user directly inputs their GitHub token.
|
||||
- **Online (SaaS)**: The token is obtained through GitHub OAuth authentication.
|
||||
|
||||
#### Setting Up a Local GitHub Token
|
||||
|
||||
1. **Generate a Personal Access Token (PAT)**:
|
||||
- Go to GitHub Settings > Developer Settings > Personal Access Tokens > Tokens (classic)
|
||||
- Click "Generate new token (classic)"
|
||||
- Go to GitHub Settings > Developer Settings > Personal Access Tokens > Tokens (classic).
|
||||
- Click "Generate new token (classic)".
|
||||
- Required scopes:
|
||||
- `repo` (Full control of private repositories)
|
||||
- `workflow` (Update GitHub Action workflows)
|
||||
- `read:org` (Read organization data)
|
||||
|
||||
2. **Enter Token in OpenHands**:
|
||||
- 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
|
||||
- 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.
|
||||
|
||||
#### Organizational Token Policies
|
||||
|
||||
If you're working with organizational repositories, additional setup may be required:
|
||||
|
||||
1. **Check Organization Requirements**:
|
||||
- Organization admins may enforce specific token policies
|
||||
- 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)
|
||||
- Organization admins may enforce specific token policies.
|
||||
- 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).
|
||||
|
||||
2. **Verify Organization Access**:
|
||||
- Go to your token settings on GitHub
|
||||
- Look for the organization under "Organization access"
|
||||
- If required, click "Enable SSO" next to your organization
|
||||
- Complete the SSO authorization process
|
||||
- Go to your token settings on GitHub.
|
||||
- Look for the organization under "Organization access".
|
||||
- If required, click "Enable SSO" next to your organization.
|
||||
- Complete the SSO authorization process.
|
||||
|
||||
#### OAuth Authentication (Online Mode)
|
||||
|
||||
@@ -67,31 +67,31 @@ When using OpenHands in online mode, the GitHub OAuth flow:
|
||||
- Organization read access
|
||||
|
||||
2. Authentication steps:
|
||||
- Click "Sign in with GitHub" when prompted
|
||||
- Review the requested permissions
|
||||
- Authorize OpenHands to access your GitHub account
|
||||
- If using an organization, authorize organization access if prompted
|
||||
- Click "Sign in with GitHub" when prompted.
|
||||
- Review the requested permissions.
|
||||
- Authorize OpenHands to access your GitHub account.
|
||||
- If using an organization, authorize organization access if prompted.
|
||||
|
||||
#### Troubleshooting
|
||||
|
||||
Common issues and solutions:
|
||||
|
||||
1. **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
|
||||
- **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.
|
||||
|
||||
2. **Organization Access Denied**:
|
||||
- Check if SSO is required but not enabled
|
||||
- Verify organization membership
|
||||
- Contact organization admin if token policies are blocking access
|
||||
- **Organization Access Denied**:
|
||||
- Check if SSO is required but not enabled.
|
||||
- Verify organization membership.
|
||||
- Contact organization admin if token policies are blocking access.
|
||||
|
||||
3. **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
|
||||
- **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
|
||||
|
||||
@@ -103,11 +103,11 @@ Common issues and solutions:
|
||||
|
||||
The main interface consists of several key components:
|
||||
|
||||
1. **Chat Window**: The central area where you can view the conversation history with the AI assistant.
|
||||
2. **Input Box**: Located at the bottom of the screen, use this to type your messages or commands to the AI.
|
||||
3. **Send Button**: Click this to send your message to the AI.
|
||||
4. **Settings Button**: A gear icon that opens the settings modal, allowing you to adjust your configuration at any time.
|
||||
5. **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.
|
||||
- **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
|
||||
|
||||
@@ -118,8 +118,9 @@ The main interface consists of several key components:
|
||||
|
||||
## Tips for Effective Use
|
||||
|
||||
1. Be specific in your requests to get the most accurate and helpful responses, as described in the [prompting best practices](../prompting-best-practices).
|
||||
2. Use the workspace panel to explore your project structure.
|
||||
3. Use one of the recommended models, as described in the [LLMs section](usage/llms/llms.md).
|
||||
- Be specific in your requests to get the most accurate and helpful responses, as described in the [prompting best practices](../prompting/prompting-best-practices).
|
||||
- Use the workspace panel to explore your project structure.
|
||||
- Use one of the recommended models, as described in the [LLMs section](usage/llms/llms.md).
|
||||
|
||||
Remember, the GUI mode of OpenHands is designed to make your interaction with the AI assistant as smooth and intuitive as possible. Don't hesitate to explore its features to maximize your productivity.
|
||||
Remember, the GUI mode of OpenHands is designed to make your interaction with the AI assistant as smooth and intuitive
|
||||
as possible. Don't hesitate to explore its features to maximize your productivity.
|
||||
|
||||
@@ -7,10 +7,9 @@ This is different from [CLI Mode](cli-mode), which is interactive, and better fo
|
||||
|
||||
## With Python
|
||||
|
||||
To run OpenHands in headless mode with Python,
|
||||
[follow the Development setup instructions](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md),
|
||||
and then run:
|
||||
|
||||
To run OpenHands in headless mode with Python:
|
||||
1. Ensure you have followed the [Development setup instructions](https://github.com/All-Hands-AI/OpenHands/blob/main/Development.md).
|
||||
2. Run the following command:
|
||||
```bash
|
||||
poetry run python -m openhands.core.main -t "write a bash script that prints hi"
|
||||
```
|
||||
@@ -20,31 +19,20 @@ You'll need to be sure to set your model, API key, and other settings via enviro
|
||||
|
||||
## With Docker
|
||||
|
||||
1. Set `WORKSPACE_BASE` to the directory you want OpenHands to edit:
|
||||
To run OpenHands in Headless mode with Docker:
|
||||
|
||||
```bash
|
||||
WORKSPACE_BASE=$(pwd)/workspace
|
||||
```
|
||||
1. Set the following environmental variables in your terminal:
|
||||
|
||||
2. Set `LLM_MODEL` to the model you want to use:
|
||||
- `WORKSPACE_BASE` to the directory you want OpenHands to edit (Ex: `export WORKSPACE_BASE=$(pwd)/workspace`).
|
||||
- `LLM_MODEL` to the model to use (Ex: `export LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"`).
|
||||
- `LLM_API_KEY` to the API key (Ex: `export LLM_API_KEY="sk_test_12345"`).
|
||||
|
||||
```bash
|
||||
LLM_MODEL="anthropic/claude-3-5-sonnet-20241022"
|
||||
|
||||
```
|
||||
|
||||
3. Set `LLM_API_KEY` to your API key:
|
||||
|
||||
```bash
|
||||
LLM_API_KEY="sk_test_12345"
|
||||
```
|
||||
|
||||
4. Run the following Docker command:
|
||||
2. Run the following Docker command:
|
||||
|
||||
```bash
|
||||
docker run -it \
|
||||
--pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.16-nikolaik \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-e LLM_API_KEY=$LLM_API_KEY \
|
||||
@@ -52,8 +40,17 @@ docker run -it \
|
||||
-e LOG_ALL_EVENTS=true \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v ~/.openhands-state:/.openhands-state \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app-$(date +%Y%m%d%H%M%S) \
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.16 \
|
||||
python -m openhands.core.main -t "write a bash script that prints hi" --no-auto-continue
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.21 \
|
||||
python -m openhands.core.main -t "write a bash script that prints hi"
|
||||
```
|
||||
|
||||
## Advanced Headless Configurations
|
||||
|
||||
To view all available configuration options for headless mode, run the Python command with the `--help` flag.
|
||||
|
||||
### Additional Logs
|
||||
|
||||
For the headless mode to log all the agent actions, in the terminal run: `export LOG_ALL_EVENTS=true`
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# Persisting Session Data
|
||||
|
||||
Using the standard installation, the session data is stored in memory. Currently, if OpenHands' service is restarted,
|
||||
previous sessions become invalid (a new secret is generated) and thus not recoverable.
|
||||
|
||||
## How to Persist Session Data
|
||||
|
||||
### Development Workflow
|
||||
In the `config.toml` file, specify the following:
|
||||
```
|
||||
[core]
|
||||
...
|
||||
file_store="local"
|
||||
file_store_path="/absolute/path/to/openhands/cache/directory"
|
||||
jwt_secret="secretpass"
|
||||
```
|
||||
@@ -1,34 +1,77 @@
|
||||
# Installation
|
||||
# Running OpenHands
|
||||
|
||||
## System Requirements
|
||||
|
||||
* Docker version 26.0.0+ or Docker Desktop 4.31.0+.
|
||||
* You must be using Linux or Mac OS.
|
||||
* If you are on Windows, you must use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
|
||||
- MacOS with [Docker Desktop support](https://docs.docker.com/desktop/setup/install/mac-install/#system-requirements)
|
||||
- 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)
|
||||
|
||||
## Start the app
|
||||
## Prerequisites
|
||||
|
||||
<details>
|
||||
<summary>MacOS</summary>
|
||||
### Docker Desktop
|
||||
|
||||
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.
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Linux</summary>
|
||||
|
||||
:::note
|
||||
Tested with Ubuntu 22.04.
|
||||
:::
|
||||
|
||||
### Docker Desktop
|
||||
|
||||
1. [Install Docker Desktop on Linux](https://docs.docker.com/desktop/setup/install/linux/).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Windows</summary>
|
||||
### WSL
|
||||
|
||||
1. [Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install).
|
||||
2. Run `wsl --version` in powershell and confirm `Default Version: 2`.
|
||||
|
||||
### Docker Desktop
|
||||
|
||||
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:
|
||||
- General: `Use the WSL 2 based engine` is enabled.
|
||||
- Resources > WSL Integration: `Enable integration with my default WSL distro` is enabled.
|
||||
|
||||
</details>
|
||||
|
||||
## Start the App
|
||||
|
||||
The easiest way to run OpenHands is in Docker.
|
||||
|
||||
```bash
|
||||
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.16-nikolaik
|
||||
docker pull docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik
|
||||
|
||||
docker run -it --rm --pull=always \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.16-nikolaik \
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.21-nikolaik \
|
||||
-e LOG_ALL_EVENTS=true \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v ~/.openhands-state:/.openhands-state \
|
||||
-p 3000:3000 \
|
||||
--add-host host.docker.internal:host-gateway \
|
||||
--name openhands-app \
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.16
|
||||
docker.all-hands.dev/all-hands-ai/openhands:0.21
|
||||
```
|
||||
|
||||
You can also run OpenHands in a scriptable [headless mode](https://docs.all-hands.dev/modules/usage/how-to/headless-mode), as an [interactive CLI](https://docs.all-hands.dev/modules/usage/how-to/cli-mode), or using the [OpenHands GitHub Action](https://docs.all-hands.dev/modules/usage/how-to/github-action).
|
||||
You'll find OpenHands running at http://localhost:3000!
|
||||
|
||||
You can also [connect OpenHands to your local filesystem](https://docs.all-hands.dev/modules/usage/runtimes#connecting-to-your-filesystem),
|
||||
run OpenHands in a scriptable [headless mode](https://docs.all-hands.dev/modules/usage/how-to/headless-mode),
|
||||
interact with it via a [friendly CLI](https://docs.all-hands.dev/modules/usage/how-to/cli-mode),
|
||||
or run it on tagged issues with [a github action](https://docs.all-hands.dev/modules/usage/how-to/github-action).
|
||||
|
||||
## Setup
|
||||
|
||||
After running the command above, you'll find OpenHands running at [http://localhost:3000](http://localhost:3000).
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -18,17 +18,18 @@ docker run -it --pull=always \
|
||||
...
|
||||
```
|
||||
|
||||
Then set the following in the OpenHands UI through the Settings:
|
||||
Then in the OpenHands UI Settings:
|
||||
|
||||
:::note
|
||||
You will need your ChatGPT deployment name which can be found on the deployments page in Azure. This is referenced as
|
||||
<deployment-name> below.
|
||||
:::
|
||||
|
||||
* Enable `Advanced Options`
|
||||
* `Custom Model` to azure/<deployment-name>
|
||||
* `Base URL` to your Azure API Base URL (e.g. `https://example-endpoint.openai.azure.com`)
|
||||
* `API Key` to your Azure API key
|
||||
1. Enable `Advanced Options`
|
||||
2. Set the following:
|
||||
- `Custom Model` to azure/<deployment-name>
|
||||
- `Base URL` to your Azure API Base URL (e.g. `https://example-endpoint.openai.azure.com`)
|
||||
- `API Key` to your Azure API key
|
||||
|
||||
## Embeddings
|
||||
|
||||
|
||||
136
docs/modules/usage/llms/custom-llm-configs.md
Normal file
136
docs/modules/usage/llms/custom-llm-configs.md
Normal file
@@ -0,0 +1,136 @@
|
||||
# Custom LLM Configurations
|
||||
|
||||
OpenHands supports defining multiple named LLM configurations in your `config.toml` file. This feature allows you to use different LLM configurations for different purposes, such as using a cheaper model for tasks that don't require high-quality responses, or using different models with different parameters for specific agents.
|
||||
|
||||
## How It Works
|
||||
|
||||
Named LLM configurations are defined in the `config.toml` file using sections that start with `llm.`. For example:
|
||||
|
||||
```toml
|
||||
# Default LLM configuration
|
||||
[llm]
|
||||
model = "gpt-4"
|
||||
api_key = "your-api-key"
|
||||
temperature = 0.0
|
||||
|
||||
# Custom LLM configuration for a cheaper model
|
||||
[llm.gpt3]
|
||||
model = "gpt-3.5-turbo"
|
||||
api_key = "your-api-key"
|
||||
temperature = 0.2
|
||||
|
||||
# Another custom configuration with different parameters
|
||||
[llm.high-creativity]
|
||||
model = "gpt-4"
|
||||
api_key = "your-api-key"
|
||||
temperature = 0.8
|
||||
top_p = 0.9
|
||||
```
|
||||
|
||||
Each named configuration inherits all settings from the default `[llm]` section and can override any of those settings. You can define as many custom configurations as needed.
|
||||
|
||||
## Using Custom Configurations
|
||||
|
||||
### With Agents
|
||||
|
||||
You can specify which LLM configuration an agent should use by setting the `llm_config` parameter in the agent's configuration section:
|
||||
|
||||
```toml
|
||||
[agent.RepoExplorerAgent]
|
||||
# Use the cheaper GPT-3 configuration for this agent
|
||||
llm_config = 'gpt3'
|
||||
|
||||
[agent.CodeWriterAgent]
|
||||
# Use the high creativity configuration for this agent
|
||||
llm_config = 'high-creativity'
|
||||
```
|
||||
|
||||
### Configuration Options
|
||||
|
||||
Each named LLM configuration supports all the same options as the default LLM configuration. These include:
|
||||
|
||||
- Model selection (`model`)
|
||||
- API configuration (`api_key`, `base_url`, etc.)
|
||||
- Model parameters (`temperature`, `top_p`, etc.)
|
||||
- Retry settings (`num_retries`, `retry_multiplier`, etc.)
|
||||
- Token limits (`max_input_tokens`, `max_output_tokens`)
|
||||
- And all other LLM configuration options
|
||||
|
||||
For a complete list of available options, see the LLM Configuration section in the [Configuration Options](../configuration-options) documentation.
|
||||
|
||||
## Use Cases
|
||||
|
||||
Custom LLM configurations are particularly useful in several scenarios:
|
||||
|
||||
- **Cost Optimization**: Use cheaper models for tasks that don't require high-quality responses, like repository exploration or simple file operations.
|
||||
- **Task-Specific Tuning**: Configure different temperature and top_p values for tasks that require different levels of creativity or determinism.
|
||||
- **Different Providers**: Use different LLM providers or API endpoints for different tasks.
|
||||
- **Testing and Development**: Easily switch between different model configurations during development and testing.
|
||||
|
||||
## Example: Cost Optimization
|
||||
|
||||
A practical example of using custom LLM configurations to optimize costs:
|
||||
|
||||
```toml
|
||||
# Default configuration using GPT-4 for high-quality responses
|
||||
[llm]
|
||||
model = "gpt-4"
|
||||
api_key = "your-api-key"
|
||||
temperature = 0.0
|
||||
|
||||
# Cheaper configuration for repository exploration
|
||||
[llm.repo-explorer]
|
||||
model = "gpt-3.5-turbo"
|
||||
temperature = 0.2
|
||||
|
||||
# Configuration for code generation
|
||||
[llm.code-gen]
|
||||
model = "gpt-4"
|
||||
temperature = 0.0
|
||||
max_output_tokens = 2000
|
||||
|
||||
[agent.RepoExplorerAgent]
|
||||
llm_config = 'repo-explorer'
|
||||
|
||||
[agent.CodeWriterAgent]
|
||||
llm_config = 'code-gen'
|
||||
```
|
||||
|
||||
In this example:
|
||||
- Repository exploration uses a cheaper model since it mainly involves understanding and navigating code
|
||||
- Code generation uses GPT-4 with a higher token limit for generating larger code blocks
|
||||
- The default configuration remains available for other tasks
|
||||
|
||||
# Custom Configurations with Reserved Names
|
||||
|
||||
OpenHands can use custom LLM configurations named with reserved names, for specific use cases. If you specify the model and other settings under the reserved names, then OpenHands will load and them for a specific purpose. As of now, one such configuration is implemented: draft editor.
|
||||
|
||||
## Draft Editor Configuration
|
||||
|
||||
The `draft_editor` configuration is a group of settings you can provide, to specify the model to use for preliminary drafting of code edits, for any tasks that involve editing and refining code. You need to provide it under the section `[llm.draft_editor]`.
|
||||
|
||||
For example, you can define in `config.toml` a draft editor like this:
|
||||
|
||||
```toml
|
||||
[llm.draft_editor]
|
||||
model = "gpt-4"
|
||||
temperature = 0.2
|
||||
top_p = 0.95
|
||||
presence_penalty = 0.0
|
||||
frequency_penalty = 0.0
|
||||
```
|
||||
|
||||
This configuration:
|
||||
- Uses GPT-4 for high-quality edits and suggestions
|
||||
- Sets a low temperature (0.2) to maintain consistency while allowing some flexibility
|
||||
- Uses a high top_p value (0.95) to consider a wide range of token options
|
||||
- Disables presence and frequency penalties to maintain focus on the specific edits needed
|
||||
|
||||
Use this configuration when you want to let an LLM draft edits before making them. In general, it may be useful to:
|
||||
- Review and suggest code improvements
|
||||
- Refine existing content while maintaining its core meaning
|
||||
- Make precise, focused changes to code or text
|
||||
|
||||
:::note
|
||||
Custom LLM configurations are only available when using OpenHands in development mode, via `main.py` or `cli.py`. When running via `docker run`, please use the standard configuration options.
|
||||
:::
|
||||
@@ -8,10 +8,10 @@ OpenHands uses LiteLLM to make calls to Google's chat models. You can find their
|
||||
## Gemini - Google AI Studio Configs
|
||||
|
||||
When running OpenHands, you'll need to set the following in the OpenHands UI through the Settings:
|
||||
* `LLM Provider` to `Gemini`
|
||||
* `LLM Model` to the model you will be using.
|
||||
- `LLM Provider` to `Gemini`
|
||||
- `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/<model-name> 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
|
||||
|
||||
@@ -25,6 +25,6 @@ VERTEXAI_LOCATION="<your-gcp-location>"
|
||||
```
|
||||
|
||||
Then set the following in the OpenHands UI through the Settings:
|
||||
* `LLM Provider` to `VertexAI`
|
||||
* `LLM Model` to the model you will be using.
|
||||
- `LLM Provider` to `VertexAI`
|
||||
- `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/<model-name>).
|
||||
|
||||
@@ -5,19 +5,20 @@ OpenHands uses LiteLLM to make calls to chat models on Groq. You can find their
|
||||
## Configuration
|
||||
|
||||
When running OpenHands, you'll need to set the following in the OpenHands UI through the Settings:
|
||||
* `LLM Provider` to `Groq`
|
||||
* `LLM Model` to the model you will be using. [Visit here to see the list of
|
||||
- `LLM Provider` to `Groq`
|
||||
- `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
|
||||
`Advanced Options`, and enter it in `Custom Model` (e.g. groq/<model-name> 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).
|
||||
|
||||
|
||||
|
||||
## Using Groq as an OpenAI-Compatible Endpoint
|
||||
|
||||
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. You can set the following in the OpenHands UI through the Settings:
|
||||
* Enable `Advanced Options`
|
||||
* `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`
|
||||
* `API Key` to your Groq API key
|
||||
would access any OpenAI-compatible endpoint. In the OpenHands UI through the Settings:
|
||||
1. Enable `Advanced Options`
|
||||
2. Set the following:
|
||||
- `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`
|
||||
- `API Key` to your Groq API key
|
||||
|
||||
@@ -4,22 +4,15 @@ OpenHands can connect to any LLM supported by LiteLLM. However, it requires a po
|
||||
|
||||
## Model Recommendations
|
||||
|
||||
Based on our evaluations of language models for coding tasks (using the SWE-bench dataset), we can provide some recommendations for model selection. Some analyses can be found in [this blog article comparing LLMs](https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed) and [this blog article with some more recent results](https://www.all-hands.dev/blog/openhands-codeact-21-an-open-state-of-the-art-software-development-agent).
|
||||
|
||||
When choosing a model, consider both the quality of outputs and the associated costs. Here's a summary of the findings:
|
||||
|
||||
- Claude 3.5 Sonnet is the best by a fair amount, achieving a 53% resolve rate on SWE-Bench Verified with the default agent in OpenHands.
|
||||
- GPT-4o lags behind, and o1-mini actually performed somewhat worse than GPT-4o. We went in and analyzed the results a little, and briefly it seemed like o1 was sometimes "overthinking" things, performing extra environment configuration tasks when it could just go ahead and finish the task.
|
||||
- Finally, the strongest open models were Llama 3.1 405 B and deepseek-v2.5, and they performed reasonably, even besting some of the closed models.
|
||||
|
||||
Please refer to the [full article](https://www.all-hands.dev/blog/evaluation-of-llms-as-coding-agents-on-swe-bench-at-30x-speed) for more details.
|
||||
Based on our evaluations of language models for coding tasks (using the SWE-bench dataset), we can provide some
|
||||
recommendations for model selection. Our latest benchmarking results can be found in [this spreadsheet](https://docs.google.com/spreadsheets/d/1wOUdFCMyY6Nt0AIqF705KN4JKOWgeI4wUGUP60krXXs/edit?gid=0).
|
||||
|
||||
Based on these findings and community feedback, the following models have been verified to work reasonably well with OpenHands:
|
||||
|
||||
- claude-3-5-sonnet (recommended)
|
||||
- gpt-4 / gpt-4o
|
||||
- llama-3.1-405b
|
||||
- deepseek-v2.5
|
||||
- anthropic/claude-3-5-sonnet-20241022 (recommended)
|
||||
- anthropic/claude-3-5-haiku-20241022
|
||||
- deepseek/deepseek-chat
|
||||
- gpt-4o
|
||||
|
||||
:::warning
|
||||
OpenHands will issue many prompts to the LLM you configure. Most of these LLMs cost money, so be sure to set spending
|
||||
@@ -69,9 +62,11 @@ We have a few guides for running OpenHands with specific model providers:
|
||||
|
||||
### API retries and rate limits
|
||||
|
||||
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), API connection error, or other transient errors.
|
||||
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), 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 following environment variables to control the number of retries and the time between retries:
|
||||
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:
|
||||
|
||||
- `LLM_NUM_RETRIES` (Default of 8)
|
||||
- `LLM_RETRY_MIN_WAIT` (Default of 15 seconds)
|
||||
|
||||
@@ -17,8 +17,9 @@ Just as for OpenAI Chat completions, we use LiteLLM for OpenAI-compatible endpoi
|
||||
|
||||
## Using an OpenAI Proxy
|
||||
|
||||
If you're using an OpenAI proxy, you'll need to set the following in the OpenHands UI through the Settings:
|
||||
* Enable `Advanced Options`
|
||||
* `Custom Model` to openai/<model-name> (e.g. `openai/gpt-4o` or openai/<proxy-prefix>/<model-name>)
|
||||
* `Base URL` to the URL of your OpenAI proxy
|
||||
* `API Key` to your OpenAI API key
|
||||
If you're using an OpenAI proxy, in the OpenHands UI through the Settings:
|
||||
1. Enable `Advanced Options`
|
||||
2. Set the following:
|
||||
- `Custom Model` to openai/<model-name> (e.g. `openai/gpt-4o` or openai/<proxy-prefix>/<model-name>)
|
||||
- `Base URL` to the URL of your OpenAI proxy
|
||||
- `API Key` to your OpenAI API key
|
||||
|
||||
@@ -1,213 +0,0 @@
|
||||
# Micro-Agents
|
||||
|
||||
OpenHands uses specialized micro-agents to handle specific tasks and contexts efficiently. These micro-agents are small, focused components that provide specialized behavior and knowledge for particular scenarios.
|
||||
|
||||
## Overview
|
||||
|
||||
Micro-agents are defined in markdown files under the `openhands/agenthub/codeact_agent/micro/` directory. Each micro-agent is configured with:
|
||||
|
||||
- A unique name
|
||||
- The agent type (typically CodeActAgent)
|
||||
- Trigger keywords that activate the agent
|
||||
- Specific instructions and capabilities
|
||||
|
||||
## Available Micro-Agents
|
||||
|
||||
### GitHub Agent
|
||||
**File**: `github.md`
|
||||
**Triggers**: `github`, `git`
|
||||
|
||||
The GitHub agent specializes in GitHub API interactions and repository management. It:
|
||||
- Has access to a `GITHUB_TOKEN` for API authentication
|
||||
- Follows strict guidelines for repository interactions
|
||||
- Handles branch management and pull requests
|
||||
- Uses the GitHub API instead of web browser interactions
|
||||
|
||||
Key features:
|
||||
- Branch protection (prevents direct pushes to main/master)
|
||||
- Automated PR creation
|
||||
- Git configuration management
|
||||
- API-first approach for GitHub operations
|
||||
|
||||
### NPM Agent
|
||||
**File**: `npm.md`
|
||||
**Triggers**: `npm`
|
||||
|
||||
Specializes in handling npm package management with specific focus on:
|
||||
- Non-interactive shell operations
|
||||
- Automated confirmation handling using Unix 'yes' command
|
||||
- Package installation automation
|
||||
|
||||
### Custom Micro-Agents
|
||||
|
||||
You can create your own micro-agents by adding new markdown files to the micro-agents directory. Each file should follow this structure:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: agent_name
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- trigger_word1
|
||||
- trigger_word2
|
||||
---
|
||||
|
||||
Instructions and capabilities for the micro-agent...
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
When working with micro-agents:
|
||||
|
||||
1. **Use Appropriate Triggers**: Ensure your commands include the relevant trigger words to activate the correct micro-agent
|
||||
2. **Follow Agent Guidelines**: Each agent has specific instructions and limitations - respect these for optimal results
|
||||
3. **API-First Approach**: When available, use API endpoints rather than web interfaces
|
||||
4. **Automation Friendly**: Design commands that work well in non-interactive environments
|
||||
|
||||
## Integration
|
||||
|
||||
Micro-agents are automatically integrated into OpenHands' workflow. They:
|
||||
- Monitor incoming commands for their trigger words
|
||||
- Activate when relevant triggers are detected
|
||||
- Apply their specialized knowledge and capabilities
|
||||
- Follow their specific guidelines and restrictions
|
||||
|
||||
## Example Usage
|
||||
|
||||
```bash
|
||||
# GitHub agent example
|
||||
git checkout -b feature-branch
|
||||
git commit -m "Add new feature"
|
||||
git push origin feature-branch
|
||||
|
||||
# NPM agent example
|
||||
yes | npm install package-name
|
||||
```
|
||||
|
||||
For more information about specific agents, refer to their individual documentation files in the micro-agents directory.
|
||||
|
||||
## Contributing a Micro-Agent
|
||||
|
||||
To contribute a new micro-agent to OpenHands, follow these guidelines:
|
||||
|
||||
### 1. Planning Your Micro-Agent
|
||||
|
||||
Before creating a micro-agent, consider:
|
||||
- What specific problem or use case will it address?
|
||||
- What unique capabilities or knowledge should it have?
|
||||
- What trigger words make sense for activating it?
|
||||
- What constraints or guidelines should it follow?
|
||||
|
||||
### 2. File Structure
|
||||
|
||||
Create a new markdown file in `openhands/agenthub/codeact_agent/micro/` with a descriptive name (e.g., `docker.md` for a Docker-focused agent).
|
||||
|
||||
### 3. Required Components
|
||||
|
||||
Your micro-agent file must include:
|
||||
|
||||
1. **Front Matter**: YAML metadata at the start of the file:
|
||||
```markdown
|
||||
---
|
||||
name: your_agent_name
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- trigger_word1
|
||||
- trigger_word2
|
||||
---
|
||||
```
|
||||
|
||||
2. **Instructions**: Clear, specific guidelines for the agent's behavior:
|
||||
```markdown
|
||||
You are responsible for [specific task/domain].
|
||||
|
||||
Key responsibilities:
|
||||
1. [Responsibility 1]
|
||||
2. [Responsibility 2]
|
||||
|
||||
Guidelines:
|
||||
- [Guideline 1]
|
||||
- [Guideline 2]
|
||||
|
||||
Examples of usage:
|
||||
[Example 1]
|
||||
[Example 2]
|
||||
```
|
||||
|
||||
### 4. Best Practices for Micro-Agent Development
|
||||
|
||||
1. **Clear Scope**: Keep the agent focused on a specific domain or task
|
||||
2. **Explicit Instructions**: Provide clear, unambiguous guidelines
|
||||
3. **Useful Examples**: Include practical examples of common use cases
|
||||
4. **Safety First**: Include necessary warnings and constraints
|
||||
5. **Integration Awareness**: Consider how the agent interacts with other components
|
||||
|
||||
### 5. Testing Your Micro-Agent
|
||||
|
||||
Before submitting:
|
||||
1. Test the agent with various prompts
|
||||
2. Verify trigger words activate the agent correctly
|
||||
3. Ensure instructions are clear and comprehensive
|
||||
4. Check for potential conflicts with existing agents
|
||||
|
||||
### 6. Example Implementation
|
||||
|
||||
Here's a template for a new micro-agent:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: docker
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- docker
|
||||
- container
|
||||
---
|
||||
|
||||
You are responsible for Docker container management and Dockerfile creation.
|
||||
|
||||
Key responsibilities:
|
||||
1. Create and modify Dockerfiles
|
||||
2. Manage container lifecycle
|
||||
3. Handle Docker Compose configurations
|
||||
|
||||
Guidelines:
|
||||
- Always use official base images when possible
|
||||
- Include necessary security considerations
|
||||
- Follow Docker best practices for layer optimization
|
||||
|
||||
Examples:
|
||||
1. Creating a Dockerfile:
|
||||
```dockerfile
|
||||
FROM node:18-alpine
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
CMD ["npm", "start"]
|
||||
```
|
||||
|
||||
2. Docker Compose usage:
|
||||
```yaml
|
||||
version: '3'
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000"
|
||||
```
|
||||
|
||||
Remember to:
|
||||
- Validate Dockerfile syntax
|
||||
- Check for security vulnerabilities
|
||||
- Optimize for build time and image size
|
||||
```
|
||||
|
||||
### 7. Submission Process
|
||||
|
||||
1. Create your micro-agent file in the correct directory
|
||||
2. Test thoroughly
|
||||
3. Submit a pull request with:
|
||||
- The new micro-agent file
|
||||
- Updated documentation if needed
|
||||
- Description of the agent's purpose and capabilities
|
||||
|
||||
Remember that micro-agents are a powerful way to extend OpenHands' capabilities in specific domains. Well-designed agents can significantly improve the system's ability to handle specialized tasks.
|
||||
@@ -1,106 +0,0 @@
|
||||
# Prompting Best Practices
|
||||
|
||||
When working with OpenHands AI software developer, it's crucial to provide clear and effective prompts. This guide outlines best practices for creating prompts that will yield the most accurate and useful responses.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Characteristics of Good Prompts](#characteristics-of-good-prompts)
|
||||
- [Customizing Prompts for your Project](#customizing-prompts-for-your-project)
|
||||
|
||||
## Characteristics of Good Prompts
|
||||
|
||||
Good prompts are:
|
||||
|
||||
1. **Concrete**: They explain exactly what functionality should be added or what error needs to be fixed.
|
||||
2. **Location-specific**: If known, they explain the locations in the code base that should be modified.
|
||||
3. **Appropriately scoped**: They should be the size of a single feature, typically not exceeding 100 lines of code.
|
||||
|
||||
## Examples
|
||||
|
||||
### Good Prompt Examples
|
||||
|
||||
1. "Add a function `calculate_average` in `utils/math_operations.py` that takes a list of numbers as input and returns their average."
|
||||
|
||||
2. "Fix the TypeError in `frontend/src/components/UserProfile.tsx` occurring on line 42. The error suggests we're trying to access a property of undefined."
|
||||
|
||||
3. "Implement input validation for the email field in the registration form. Update `frontend/src/components/RegistrationForm.tsx` to check if the email is in a valid format before submission."
|
||||
|
||||
### Bad Prompt Examples
|
||||
|
||||
1. "Make the code better." (Too vague, not concrete)
|
||||
|
||||
2. "Rewrite the entire backend to use a different framework." (Not appropriately scoped)
|
||||
|
||||
3. "There's a bug somewhere in the user authentication. Can you find and fix it?" (Lacks specificity and location information)
|
||||
|
||||
## Tips for Effective Prompting
|
||||
|
||||
1. Be as specific as possible about the desired outcome or the problem to be solved.
|
||||
2. Provide context, including relevant file paths and line numbers if available.
|
||||
3. Break down large tasks into smaller, manageable prompts.
|
||||
4. Include any relevant error messages or logs.
|
||||
5. Specify the programming language or framework if it's not obvious from the context.
|
||||
|
||||
Remember, the more precise and informative your prompt is, the better the AI can assist you in developing or modifying the OpenHands software.
|
||||
|
||||
See [Getting Started with OpenHands](./getting-started) for more examples of helpful prompts.
|
||||
|
||||
## Customizing Prompts for your Project
|
||||
|
||||
OpenHands can be customized to work more effectively with specific repositories by providing repository-specific context and guidelines. This section explains how to optimize OpenHands for your project.
|
||||
|
||||
### Repository Configuration
|
||||
|
||||
You can customize OpenHands' behavior for your repository by creating a `.openhands_instructions` file in your repository's root directory. This file should contain:
|
||||
|
||||
1. **Repository Overview**: A brief description of your project's purpose and architecture
|
||||
2. **Directory Structure**: Key directories and their purposes
|
||||
3. **Development Guidelines**: Project-specific coding standards and practices
|
||||
4. **Testing Requirements**: How to run tests and what types of tests are required
|
||||
5. **Setup Instructions**: Steps needed to build and run the project
|
||||
|
||||
Example `.openhands_instructions` file:
|
||||
```
|
||||
Repository: MyProject
|
||||
Description: A web application for task management
|
||||
|
||||
Directory Structure:
|
||||
- src/: Main application code
|
||||
- tests/: Test files
|
||||
- docs/: Documentation
|
||||
|
||||
Setup:
|
||||
- Run `npm install` to install dependencies
|
||||
- Use `npm run dev` for development
|
||||
- Run `npm test` for testing
|
||||
|
||||
Guidelines:
|
||||
- Follow ESLint configuration
|
||||
- Write tests for all new features
|
||||
- Use TypeScript for new code
|
||||
```
|
||||
|
||||
### Customizing Prompts
|
||||
|
||||
When working with a customized repository:
|
||||
|
||||
1. **Reference Project Standards**: Mention specific coding standards or patterns used in your project
|
||||
2. **Include Context**: Reference relevant documentation or existing implementations
|
||||
3. **Specify Testing Requirements**: Include project-specific testing requirements in your prompts
|
||||
|
||||
Example customized prompt:
|
||||
```
|
||||
Add a new task completion feature to src/components/TaskList.tsx following our existing component patterns.
|
||||
Include unit tests in tests/components/ and update the documentation in docs/features/.
|
||||
The component should use our shared styling from src/styles/components.
|
||||
```
|
||||
|
||||
### Best Practices for Repository Customization
|
||||
|
||||
1. **Keep Instructions Updated**: Regularly update your `.openhands_instructions` file as your project evolves
|
||||
2. **Be Specific**: Include specific paths, patterns, and requirements unique to your project
|
||||
3. **Document Dependencies**: List all tools and dependencies required for development
|
||||
4. **Include Examples**: Provide examples of good code patterns from your project
|
||||
5. **Specify Conventions**: Document naming conventions, file organization, and code style preferences
|
||||
|
||||
By customizing OpenHands for your repository, you'll get more accurate and consistent results that align with your project's standards and requirements.
|
||||
36
docs/modules/usage/prompting/microagents-overview.md
Normal file
36
docs/modules/usage/prompting/microagents-overview.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Microagents Overview
|
||||
|
||||
Microagents are specialized prompts that enhance OpenHands with domain-specific knowledge, repository-specific context
|
||||
and task-specific workflows. They help by providing expert guidance, automating common tasks, and ensuring
|
||||
consistent practices across projects.
|
||||
|
||||
## Microagent Types
|
||||
|
||||
Currently OpenHands supports the following types of microagents:
|
||||
|
||||
* [Repository Microagents](./microagents-repo): Repository-specific context and guidelines for OpenHands.
|
||||
* [Public Microagents](./microagents-public): General guidelines triggered by keywords for all OpenHands users.
|
||||
|
||||
When OpenHands works with a repository, it:
|
||||
|
||||
1. Loads repository-specific instructions from `.openhands/microagents/` if present in the repository.
|
||||
2. Loads general guidelines triggered by keywords in conversations.
|
||||
See current [Public Microagents](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge).
|
||||
|
||||
## Microagent Format
|
||||
|
||||
All microagents use markdown files with YAML frontmatter that have special instructions to help OpenHands accomplish
|
||||
tasks:
|
||||
```
|
||||
---
|
||||
name: <Name of the microagent>
|
||||
type: <MicroAgent type>
|
||||
version: <MicroAgent version>
|
||||
agent: <The agent type (Typically CodeActAgent)>
|
||||
triggers:
|
||||
- <Optional keywords triggering the microagent. If triggers are removed, it will always be included>
|
||||
---
|
||||
|
||||
<Markdown with any special guidelines, instructions, and prompts that OpenHands should follow.
|
||||
Check out the specific documentation for each microagent on best practices for more information.>
|
||||
```
|
||||
153
docs/modules/usage/prompting/microagents-public.md
Normal file
153
docs/modules/usage/prompting/microagents-public.md
Normal file
@@ -0,0 +1,153 @@
|
||||
# Public Microagents
|
||||
|
||||
## Overview
|
||||
|
||||
Public microagents are specialized guidelines triggered by keywords for all OpenHands users.
|
||||
They are defined in markdown files under the
|
||||
[`microagents/knowledge/`](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge) directory.
|
||||
|
||||
Public microagents:
|
||||
- Monitor incoming commands for their trigger words.
|
||||
- Activate when relevant triggers are detected.
|
||||
- Apply their specialized knowledge and capabilities.
|
||||
- Follow their specific guidelines and restrictions.
|
||||
|
||||
## Current Public Microagents
|
||||
|
||||
For more information about specific microagents, refer to their individual documentation files in
|
||||
the [`microagents/knowledge/`](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge/) directory.
|
||||
|
||||
### GitHub Agent
|
||||
**File**: `github.md`
|
||||
**Triggers**: `github`, `git`
|
||||
|
||||
The GitHub agent specializes in GitHub API interactions and repository management. It:
|
||||
- Has access to a `GITHUB_TOKEN` for API authentication.
|
||||
- Follows strict guidelines for repository interactions.
|
||||
- Handles branch management and pull requests.
|
||||
- Uses the GitHub API instead of web browser interactions.
|
||||
|
||||
Key features:
|
||||
- Branch protection (prevents direct pushes to main/master)
|
||||
- Automated PR creation
|
||||
- Git configuration management
|
||||
- API-first approach for GitHub operations
|
||||
|
||||
Usage Example:
|
||||
|
||||
```bash
|
||||
git checkout -b feature-branch
|
||||
git commit -m "Add new feature"
|
||||
git push origin feature-branch
|
||||
```
|
||||
|
||||
### NPM Agent
|
||||
**File**: `npm.md`
|
||||
**Triggers**: `npm`
|
||||
|
||||
Specializes in handling npm package management with specific focus on:
|
||||
- Non-interactive shell operations.
|
||||
- Automated confirmation handling using Unix 'yes' command.
|
||||
- Package installation automation.
|
||||
|
||||
Usage Example:
|
||||
|
||||
```bash
|
||||
yes | npm install package-name
|
||||
```
|
||||
|
||||
## Contributing a Public Microagent
|
||||
|
||||
You can create your own public microagents by adding new markdown files to the
|
||||
[`microagents/knowledge/`](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge/) directory.
|
||||
|
||||
### Public Microagents Best Practices
|
||||
|
||||
- **Clear Scope**: Keep the microagent focused on a specific domain or task.
|
||||
- **Explicit Instructions**: Provide clear, unambiguous guidelines.
|
||||
- **Useful Examples**: Include practical examples of common use cases.
|
||||
- **Safety First**: Include necessary warnings and constraints.
|
||||
- **Integration Awareness**: Consider how the microagent interacts with other components.
|
||||
|
||||
### Steps to Contribute a Public Microagent
|
||||
|
||||
#### 1. Plan the Public Microagent
|
||||
|
||||
Before creating a public microagent, consider:
|
||||
- What specific problem or use case will it address?
|
||||
- What unique capabilities or knowledge should it have?
|
||||
- What trigger words make sense for activating it?
|
||||
- What constraints or guidelines should it follow?
|
||||
|
||||
#### 2. Create File
|
||||
|
||||
Create a new markdown file in [`microagents/knowledge/`](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge/)
|
||||
with a descriptive name (e.g., `docker.md` for a Docker-focused agent).
|
||||
|
||||
Update the file with the required frontmatter [according to the required format](./microagents-overview#microagent-format)
|
||||
and the required specialized guidelines while following the [best practices above](#public-microagents-best-practices).
|
||||
|
||||
#### 3. Testing the Public Microagent
|
||||
|
||||
- Test the agent with various prompts.
|
||||
- Verify trigger words activate the agent correctly.
|
||||
- Ensure instructions are clear and comprehensive.
|
||||
- Check for potential conflicts with existing agents.
|
||||
|
||||
#### 4. Submission Process
|
||||
|
||||
Submit a pull request with:
|
||||
- The new microagent file.
|
||||
- Updated documentation if needed.
|
||||
- Description of the agent's purpose and capabilities.
|
||||
|
||||
### Example Public Microagent Implementation
|
||||
|
||||
Here's a template for a new microagent:
|
||||
|
||||
```markdown
|
||||
---
|
||||
name: docker
|
||||
agent: CodeActAgent
|
||||
triggers:
|
||||
- docker
|
||||
- container
|
||||
---
|
||||
|
||||
You are responsible for Docker container management and Dockerfile creation.
|
||||
|
||||
Key responsibilities:
|
||||
1. Create and modify Dockerfiles
|
||||
2. Manage container lifecycle
|
||||
3. Handle Docker Compose configurations
|
||||
|
||||
Guidelines:
|
||||
- Always use official base images when possible
|
||||
- Include necessary security considerations
|
||||
- Follow Docker best practices for layer optimization
|
||||
|
||||
Examples:
|
||||
1. Creating a Dockerfile:
|
||||
FROM node:18-alpine
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
CMD ["npm", "start"]
|
||||
|
||||
2. Docker Compose usage:
|
||||
version: '3'
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
ports:
|
||||
- "3000:3000"
|
||||
|
||||
Remember to:
|
||||
- Validate Dockerfile syntax
|
||||
- Check for security vulnerabilities
|
||||
- Optimize for build time and image size
|
||||
```
|
||||
|
||||
See the [current public micro-agents](https://github.com/All-Hands-AI/OpenHands/tree/main/microagents/knowledge) for
|
||||
more examples.
|
||||
68
docs/modules/usage/prompting/microagents-repo.md
Normal file
68
docs/modules/usage/prompting/microagents-repo.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# Repository Microagents
|
||||
|
||||
## Overview
|
||||
|
||||
OpenHands can be customized to work more effectively with specific repositories by providing repository-specific context
|
||||
and guidelines. This section explains how to optimize OpenHands for your project.
|
||||
|
||||
## Creating a Repository Micro-Agent
|
||||
|
||||
You can customize OpenHands' behavior for your repository by creating a `.openhands/microagents/` directory in your repository's root.
|
||||
At minimum it should contain the file
|
||||
`.openhands/microagents/repo.md`, which includes instructions that will
|
||||
be given to the agent every time it works with this repository.
|
||||
|
||||
### Repository Microagents Best Practices
|
||||
|
||||
- **Keep Instructions Updated**: Regularly update your `.openhands/microagents/` directory as your project evolves.
|
||||
- **Be Specific**: Include specific paths, patterns, and requirements unique to your project.
|
||||
- **Document Dependencies**: List all tools and dependencies required for development.
|
||||
- **Include Examples**: Provide examples of good code patterns from your project.
|
||||
- **Specify Conventions**: Document naming conventions, file organization, and code style preferences.
|
||||
|
||||
### Steps to Create a Repository Microagent
|
||||
|
||||
#### 1. Plan the Repository Microagent
|
||||
When creating a repository-specific micro-agent, we suggest including the following information:
|
||||
- **Repository Overview**: A brief description of your project's purpose and architecture.
|
||||
- **Directory Structure**: Key directories and their purposes.
|
||||
- **Development Guidelines**: Project-specific coding standards and practices.
|
||||
- **Testing Requirements**: How to run tests and what types of tests are required.
|
||||
- **Setup Instructions**: Steps needed to build and run the project.
|
||||
|
||||
#### 2. Create File
|
||||
|
||||
Create a file in your repository under `.openhands/microagents/` (Example: `.openhands/microagents/repo.md`)
|
||||
|
||||
Update the file with the required frontmatter [according to the required format](./microagents-overview#microagent-format)
|
||||
and the required specialized guidelines for your repository.
|
||||
|
||||
### Example Repository Microagent
|
||||
|
||||
```
|
||||
---
|
||||
name: repo
|
||||
type: repo
|
||||
agent: CodeActAgent
|
||||
---
|
||||
|
||||
Repository: MyProject
|
||||
Description: A web application for task management
|
||||
|
||||
Directory Structure:
|
||||
- src/: Main application code
|
||||
- tests/: Test files
|
||||
- docs/: Documentation
|
||||
|
||||
Setup:
|
||||
- Run `npm install` to install dependencies
|
||||
- Use `npm run dev` for development
|
||||
- Run `npm test` for testing
|
||||
|
||||
Guidelines:
|
||||
- Follow ESLint configuration
|
||||
- Write tests for all new features
|
||||
- Use TypeScript for new code
|
||||
|
||||
If adding a new component in src/components, always add appropriate unit tests in tests/components/.
|
||||
```
|
||||
37
docs/modules/usage/prompting/prompting-best-practices.md
Normal file
37
docs/modules/usage/prompting/prompting-best-practices.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Prompting Best Practices
|
||||
|
||||
When working with OpenHands AI software developer, it's crucial to provide clear and effective prompts. This guide outlines best practices for creating prompts that will yield the most accurate and useful responses.
|
||||
|
||||
## Characteristics of Good Prompts
|
||||
|
||||
Good prompts are:
|
||||
|
||||
- **Concrete**: They explain exactly what functionality should be added or what error needs to be fixed.
|
||||
- **Location-specific**: If known, they explain the locations in the code base that should be modified.
|
||||
- **Appropriately scoped**: They should be the size of a single feature, typically not exceeding 100 lines of code.
|
||||
|
||||
## Examples
|
||||
|
||||
### Good Prompt Examples
|
||||
|
||||
- "Add a function `calculate_average` in `utils/math_operations.py` that takes a list of numbers as input and returns their average."
|
||||
- "Fix the TypeError in `frontend/src/components/UserProfile.tsx` occurring on line 42. The error suggests we're trying to access a property of undefined."
|
||||
- "Implement input validation for the email field in the registration form. Update `frontend/src/components/RegistrationForm.tsx` to check if the email is in a valid format before submission."
|
||||
|
||||
### Bad Prompt Examples
|
||||
|
||||
- "Make the code better." (Too vague, not concrete)
|
||||
- "Rewrite the entire backend to use a different framework." (Not appropriately scoped)
|
||||
- "There's a bug somewhere in the user authentication. Can you find and fix it?" (Lacks specificity and location information)
|
||||
|
||||
## Tips for Effective Prompting
|
||||
|
||||
- Be as specific as possible about the desired outcome or the problem to be solved.
|
||||
- Provide context, including relevant file paths and line numbers if available.
|
||||
- Break down large tasks into smaller, manageable prompts.
|
||||
- Include any relevant error messages or logs.
|
||||
- Specify the programming language or framework if it's not obvious from the context.
|
||||
|
||||
Remember, the more precise and informative your prompt is, the better the AI can assist you in developing or modifying the OpenHands software.
|
||||
|
||||
See [Getting Started with OpenHands](../getting-started) for more examples of helpful prompts.
|
||||
@@ -16,7 +16,7 @@ some flags being passed to `docker run` that make this possible:
|
||||
|
||||
```
|
||||
docker run # ...
|
||||
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.16-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 \
|
||||
# ...
|
||||
```
|
||||
@@ -26,30 +26,29 @@ that contains our Runtime server, as well as some basic utilities for Python and
|
||||
You can also [build your own runtime image](how-to/custom-sandbox-guide).
|
||||
|
||||
### Connecting to Your filesystem
|
||||
One useful feature here is the ability to connect to your local filesystem.
|
||||
One useful feature here is the ability to connect to your local filesystem. To mount your filesystem into the runtime:
|
||||
1. Set `WORKSPACE_BASE`:
|
||||
|
||||
To mount your filesystem into the runtime, first set WORKSPACE_BASE:
|
||||
```bash
|
||||
export WORKSPACE_BASE=/path/to/your/code
|
||||
```bash
|
||||
export WORKSPACE_BASE=/path/to/your/code
|
||||
|
||||
# Linux and Mac Example
|
||||
# export WORKSPACE_BASE=$HOME/OpenHands
|
||||
# Will set $WORKSPACE_BASE to /home/<username>/OpenHands
|
||||
#
|
||||
# WSL on Windows Example
|
||||
# export WORKSPACE_BASE=/mnt/c/dev/OpenHands
|
||||
# Will set $WORKSPACE_BASE to C:\dev\OpenHands
|
||||
```
|
||||
# Linux and Mac Example
|
||||
# export WORKSPACE_BASE=$HOME/OpenHands
|
||||
# Will set $WORKSPACE_BASE to /home/<username>/OpenHands
|
||||
#
|
||||
# WSL on Windows Example
|
||||
# export WORKSPACE_BASE=/mnt/c/dev/OpenHands
|
||||
# Will set $WORKSPACE_BASE to C:\dev\OpenHands
|
||||
```
|
||||
2. Add the following options to the `docker run` command:
|
||||
|
||||
then add the following options to the `docker run` command:
|
||||
|
||||
```bash
|
||||
docker run # ...
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
# ...
|
||||
```
|
||||
```bash
|
||||
docker run # ...
|
||||
-e SANDBOX_USER_ID=$(id -u) \
|
||||
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
|
||||
-v $WORKSPACE_BASE:/opt/workspace_base \
|
||||
# ...
|
||||
```
|
||||
|
||||
Be careful! There's nothing stopping the OpenHands agent from deleting or modifying
|
||||
any files that are mounted into its workspace.
|
||||
@@ -59,7 +58,7 @@ but seems to work well on most systems.
|
||||
|
||||
## All Hands Runtime
|
||||
The All Hands Runtime is currently in beta. You can request access by joining
|
||||
the #remote-runtime-limited-beta channel on Slack ([see the README](https://github.com/All-Hands-AI/OpenHands?tab=readme-ov-file#-join-our-community) for an invite).
|
||||
the #remote-runtime-limited-beta channel on Slack ([see the README](https://github.com/All-Hands-AI/OpenHands?tab=readme-ov-file#-how-to-join-the-community) for an invite).
|
||||
|
||||
To use the All Hands Runtime, set the following environment variables when
|
||||
starting OpenHands:
|
||||
|
||||
1322
docs/package-lock.json
generated
1322
docs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -15,10 +15,10 @@
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "^3.6.3",
|
||||
"@docusaurus/plugin-content-pages": "^3.6.3",
|
||||
"@docusaurus/preset-classic": "^3.6.3",
|
||||
"@docusaurus/theme-mermaid": "^3.6.3",
|
||||
"@docusaurus/core": "^3.7.0",
|
||||
"@docusaurus/plugin-content-pages": "^3.7.0",
|
||||
"@docusaurus/preset-classic": "^3.7.0",
|
||||
"@docusaurus/theme-mermaid": "^3.7.0",
|
||||
"@mdx-js/react": "^3.1.0",
|
||||
"clsx": "^2.0.0",
|
||||
"prism-react-renderer": "^2.4.1",
|
||||
@@ -29,7 +29,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "^3.5.1",
|
||||
"@docusaurus/tsconfig": "^3.6.3",
|
||||
"@docusaurus/tsconfig": "^3.7.0",
|
||||
"@docusaurus/types": "^3.5.1",
|
||||
"typescript": "~5.7.2"
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@ const sidebars: SidebarsConfig = {
|
||||
docsSidebar: [
|
||||
{
|
||||
type: 'doc',
|
||||
label: 'Installation',
|
||||
label: 'Running OpenHands',
|
||||
id: 'usage/installation',
|
||||
},
|
||||
{
|
||||
@@ -20,13 +20,29 @@ const sidebars: SidebarsConfig = {
|
||||
{
|
||||
type: 'doc',
|
||||
label: 'Best Practices',
|
||||
id: 'usage/prompting-best-practices',
|
||||
id: 'usage/prompting/prompting-best-practices',
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
label: 'Micro-Agents',
|
||||
id: 'usage/micro-agents',
|
||||
},
|
||||
type: 'category',
|
||||
label: 'Microagents',
|
||||
items: [
|
||||
{
|
||||
type: 'doc',
|
||||
label: 'Overview',
|
||||
id: 'usage/prompting/microagents-overview',
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
label: 'Repository',
|
||||
id: 'usage/prompting/microagents-repo',
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
label: 'Public',
|
||||
id: 'usage/prompting/microagents-public',
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -121,11 +137,6 @@ const sidebars: SidebarsConfig = {
|
||||
label: 'Custom Sandbox',
|
||||
id: 'usage/how-to/custom-sandbox-guide',
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
label: 'Persist Session Data',
|
||||
id: 'usage/how-to/persist-session-data',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
||||
import Layout from "@theme/Layout";
|
||||
import { HomepageHeader } from "../components/HomepageHeader/HomepageHeader";
|
||||
import { Welcome } from "../components/Welcome/Welcome";
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import Layout from '@theme/Layout';
|
||||
import { HomepageHeader } from '../components/HomepageHeader/HomepageHeader';
|
||||
import { translate } from '@docusaurus/Translate';
|
||||
|
||||
export function Header({ title, summary }): JSX.Element {
|
||||
return (
|
||||
<div>
|
||||
<h1>{title}</h1>
|
||||
<h2 style={{ fontSize: "3rem" }}>{summary}</h2>
|
||||
<h2 style={{ fontSize: '3rem' }}>{summary}</h2>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -23,7 +22,7 @@ export default function Home(): JSX.Element {
|
||||
message: 'Code Less, Make More',
|
||||
})}
|
||||
>
|
||||
<HomepageHeader />
|
||||
<HomepageHeader />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
1
docs/static/img/backend_architecture.puml
vendored
1
docs/static/img/backend_architecture.puml
vendored
@@ -123,7 +123,6 @@ class openhands.state.State {
|
||||
updated_info: List[Tuple[Action, Observation]]
|
||||
}
|
||||
class openhands.observation.CmdOutputObservation {
|
||||
command_id: int
|
||||
command: str
|
||||
exit_code: int
|
||||
observation: str
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"docs/modules/python/python.md": "da5d692f477f4a213d77474f02850026", "docs/modules/usage/upgrade-guide.md": "57546e6cb2298a222826647369cd1288", "docs/modules/usage/getting-started.mdx": "489292034da18f637c73dcf6aa999156", "docs/modules/usage/prompting-best-practices.md": "58bc461630f595135ec20cc7fc00b6d2", "docs/modules/usage/agents.md": "9227679a22d810d6aab574a295bd273e", "docs/modules/usage/about.md": "22d3e9bfeb1aa57a73053ef18c5eb2dd", "docs/modules/usage/feedback.md": "c2d135cb1368f39a4d34d7ad0e3eeafd", "docs/modules/usage/installation.mdx": "c3a1892b5803d78b1d9095c482b267d7", "docs/modules/usage/troubleshooting/troubleshooting.md": "3d3a18c3c17e02598de2e9730e5d6523", "docs/modules/usage/troubleshooting/windows.md": "b88f2b5ad5285dd134352843ab0e16f8", "docs/modules/usage/how-to/gui-mode.md": "095031d6bc1654beebde595df6f61bf9", "docs/modules/usage/how-to/evaluation-harness.md": "e290a5cc9962249d2240528d0ff8fcd0", "docs/modules/usage/how-to/openshift-example.md": "2d361207da9df53a87497f074cc262f3", "docs/modules/usage/how-to/github-action.md": "cb3dead288df263cae3e9deb2f31dfc5", "docs/modules/usage/how-to/headless-mode.md": "ef39f9b03194940ea5a218ff4a15d5bb", "docs/modules/usage/how-to/custom-sandbox-guide.md": "859b3a39592d6b210e09fb8b9841dda3", "docs/modules/usage/how-to/debugging.md": "d846a3eb9384ab24f3e1b3e8161b5f1a", "docs/modules/usage/how-to/cli-mode.md": "5f09243a9bf9f812cab2dd4f713158b1", "docs/modules/usage/architecture/backend.mdx": "3aa3d71833438063a344453e64e7029b", "docs/modules/usage/architecture/runtime.md": "83b213c35bd3b0d284dd236ce0a7c2d2", "docs/modules/usage/llms/llms.md": "a5484759945c18ebd827438dec3ad864", "docs/modules/usage/llms/local-llms.md": "e7ff078b10cad5abe69653aa352f6d14", "docs/modules/usage/llms/groq.md": "b0c6c5fc0955afa46628b1cf3bb8a363", "docs/modules/usage/llms/google-llms.md": "0ff0f62503db41f2a3329db218c86b3f", "docs/modules/usage/llms/openai-llms.md": "46c05cd1f12db498d352e23d7b06beba", "docs/modules/usage/llms/azure-llms.md": "af4b524a90a0c29e1e0981a1a4234fe8", "docs/modules/usage/llms/openrouter.md": "5027074af745c63491edf7fe3f5a242d"}
|
||||
{"docs/modules/python/python.md": "da5d692f477f4a213d77474f02850026", "docs/modules/usage/getting-started.mdx": "a01bc308197184468acf45e105e80651", "docs/modules/usage/agents.md": "9227679a22d810d6aab574a295bd273e", "docs/modules/usage/about.md": "5e7509aadb213a1c1a48e0de1858e55f", "docs/modules/usage/feedback.md": "c2d135cb1368f39a4d34d7ad0e3eeafd", "docs/modules/usage/runtimes.md": "4b5927f2654b328e1f94ab9098ab4441", "docs/modules/usage/installation.mdx": "a552e56d6af1af0893568a1bd396f692", "docs/modules/usage/configuration-options.md": "9907ec2c99dd084cb4e8acb03d6000e5", "docs/modules/usage/prompting/microagents.md": "fb278bcb98f6e049e7deb512b1288ebf", "docs/modules/usage/prompting/customization.md": "935b2cbeef113e043219c312b77803ed", "docs/modules/usage/prompting/prompting-best-practices.md": "2dc7a8130973e246d559e4222ad5f2e7", "docs/modules/usage/troubleshooting/troubleshooting.md": "a882fb995a404d1b4988a5d878d9285f", "docs/modules/usage/how-to/gui-mode.md": "54afe83d5d8e13395add7bf64205d589", "docs/modules/usage/how-to/evaluation-harness.md": "c28a79ecac02933c463197e33c3034e3", "docs/modules/usage/how-to/github-action.md": "a2ba43f6592453925038b1a14038a882", "docs/modules/usage/how-to/headless-mode.md": "27d251e230f2027d64d2be9cfc7e3301", "docs/modules/usage/how-to/custom-sandbox-guide.md": "f8478796084b118e990182204610e1b4", "docs/modules/usage/how-to/debugging.md": "d846a3eb9384ab24f3e1b3e8161b5f1a", "docs/modules/usage/how-to/persist-session-data.md": "5733d67f15ed2eb4212c0e7457d4c253", "docs/modules/usage/how-to/cli-mode.md": "476d62f7c38ae74da8e519769132d077", "docs/modules/usage/architecture/backend.mdx": "3aa3d71833438063a344453e64e7029b", "docs/modules/usage/architecture/runtime.md": "83b213c35bd3b0d284dd236ce0a7c2d2", "docs/modules/usage/llms/llms.md": "5db0a92e832c57ca6e2b70459df40096", "docs/modules/usage/llms/local-llms.md": "63b6966e52ab9f3f6818f0c1108d5061", "docs/modules/usage/llms/groq.md": "b0c6c5fc0955afa46628b1cf3bb8a363", "docs/modules/usage/llms/google-llms.md": "0ff0f62503db41f2a3329db218c86b3f", "docs/modules/usage/llms/openai-llms.md": "46c05cd1f12db498d352e23d7b06beba", "docs/modules/usage/llms/azure-llms.md": "af4b524a90a0c29e1e0981a1a4234fe8", "docs/modules/usage/llms/litellm-proxy.md": "0a3a5f75488d78bfaf9ad299e66c8af3", "docs/modules/usage/llms/openrouter.md": "5027074af745c63491edf7fe3f5a242d"}
|
||||
|
||||
@@ -63,7 +63,7 @@ def get_config(
|
||||
config = AppConfig(
|
||||
default_agent=metadata.agent_class,
|
||||
run_as_openhands=False,
|
||||
runtime='eventstream',
|
||||
runtime='docker',
|
||||
max_iterations=metadata.max_iterations,
|
||||
sandbox=SandboxConfig(
|
||||
base_container_image='python:3.12-bookworm',
|
||||
@@ -75,6 +75,8 @@ def get_config(
|
||||
workspace_mount_path=None,
|
||||
)
|
||||
config.set_llm_config(metadata.llm_config)
|
||||
agent_config = config.get_agent_config(metadata.agent_class)
|
||||
agent_config.enable_prompt_extensions = False
|
||||
return config
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ def get_config(
|
||||
config = AppConfig(
|
||||
default_agent=metadata.agent_class,
|
||||
run_as_openhands=False,
|
||||
runtime=os.environ.get('RUNTIME', 'eventstream'),
|
||||
runtime=os.environ.get('RUNTIME', 'docker'),
|
||||
max_iterations=metadata.max_iterations,
|
||||
sandbox=SandboxConfig(
|
||||
base_container_image='python:3.12-slim',
|
||||
@@ -59,6 +59,8 @@ def get_config(
|
||||
workspace_mount_path=None,
|
||||
)
|
||||
config.set_llm_config(metadata.llm_config)
|
||||
agent_config = config.get_agent_config(metadata.agent_class)
|
||||
agent_config.enable_prompt_extensions = False
|
||||
return config
|
||||
|
||||
|
||||
@@ -135,7 +137,6 @@ def complete_runtime(
|
||||
|
||||
action = CmdRunAction(
|
||||
command=f'chmod +x ./{script_name} && ./{script_name}',
|
||||
keep_prompt=False,
|
||||
)
|
||||
logger.info(action, extra={'msg_type': 'ACTION'})
|
||||
obs = runtime.run_action(action)
|
||||
@@ -162,8 +163,7 @@ def complete_runtime(
|
||||
logger.info(f'Running get ground truth cmd: {script_name}')
|
||||
|
||||
action = CmdRunAction(
|
||||
command=f'chmod +x ./{script_name} && ./{script_name}',
|
||||
keep_prompt=False,
|
||||
command=f'chmod +x ./{script_name} && ./{script_name}'
|
||||
)
|
||||
logger.info(action, extra={'msg_type': 'ACTION'})
|
||||
obs = runtime.run_action(action)
|
||||
|
||||
@@ -50,7 +50,7 @@ def get_config(
|
||||
config = AppConfig(
|
||||
default_agent=metadata.agent_class,
|
||||
run_as_openhands=False,
|
||||
runtime=os.environ.get('RUNTIME', 'eventstream'),
|
||||
runtime=os.environ.get('RUNTIME', 'docker'),
|
||||
max_iterations=metadata.max_iterations,
|
||||
sandbox=SandboxConfig(
|
||||
base_container_image='python:3.11-bookworm',
|
||||
@@ -67,6 +67,8 @@ def get_config(
|
||||
workspace_mount_path=None,
|
||||
)
|
||||
config.set_llm_config(metadata.llm_config)
|
||||
agent_config = config.get_agent_config(metadata.agent_class)
|
||||
agent_config.enable_prompt_extensions = False
|
||||
|
||||
# copy 'draft_editor' config if exists
|
||||
config_copy = copy.deepcopy(config)
|
||||
@@ -143,10 +145,7 @@ def complete_runtime(
|
||||
)
|
||||
logger.info(f'Running test file: {script_name}')
|
||||
|
||||
action = CmdRunAction(
|
||||
command=f'python3 -m unittest {script_name}',
|
||||
keep_prompt=False,
|
||||
)
|
||||
action = CmdRunAction(command=f'python3 -m unittest {script_name}')
|
||||
logger.info(action, extra={'msg_type': 'ACTION'})
|
||||
obs = runtime.run_action(action)
|
||||
logger.info(obs, extra={'msg_type': 'OBSERVATION'})
|
||||
|
||||
@@ -61,7 +61,7 @@ def get_config(
|
||||
config = AppConfig(
|
||||
default_agent=metadata.agent_class,
|
||||
run_as_openhands=False,
|
||||
runtime='eventstream',
|
||||
runtime='docker',
|
||||
max_iterations=metadata.max_iterations,
|
||||
sandbox=SandboxConfig(
|
||||
base_container_image=BIOCODER_BENCH_CONTAINER_IMAGE,
|
||||
@@ -73,6 +73,8 @@ def get_config(
|
||||
workspace_mount_path=None,
|
||||
)
|
||||
config.set_llm_config(metadata.llm_config)
|
||||
agent_config = config.get_agent_config(metadata.agent_class)
|
||||
agent_config.enable_prompt_extensions = False
|
||||
return config
|
||||
|
||||
|
||||
@@ -197,7 +199,7 @@ def complete_runtime(
|
||||
if obs.exit_code == 0:
|
||||
test_result['metadata']['1_copy_change_success'] = True
|
||||
|
||||
action = CmdRunAction(command=f'cat {generated_path}', keep_prompt=False)
|
||||
action = CmdRunAction(command=f'cat {generated_path}')
|
||||
logger.info(action, extra={'msg_type': 'ACTION'})
|
||||
obs = runtime.run_action(action)
|
||||
assert obs.exit_code == 0
|
||||
@@ -221,9 +223,7 @@ def complete_runtime(
|
||||
logger.info(obs, extra={'msg_type': 'OBSERVATION'})
|
||||
assert obs.exit_code == 0
|
||||
|
||||
action = CmdRunAction(
|
||||
command='cat /testing_files/results_biocoder.json', keep_prompt=False
|
||||
)
|
||||
action = CmdRunAction(command='cat /testing_files/results_biocoder.json')
|
||||
logger.info(action, extra={'msg_type': 'ACTION'})
|
||||
obs = runtime.run_action(action)
|
||||
if obs.exit_code == 0:
|
||||
|
||||
@@ -127,7 +127,6 @@ For each problem, OpenHands is given a set number of iterations to fix the faili
|
||||
"observation": "run",
|
||||
"content": "california_schools/california_schools.sqlite\r\n[(1.0,)]",
|
||||
"extras": {
|
||||
"command_id": -1,
|
||||
"command": "python3 0.py",
|
||||
"exit_code": 0
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user