Przeglądaj źródła

Move agenthub within openhands (#4130)

Engel Nyst 1 rok temu
rodzic
commit
e6847e9e61
88 zmienionych plików z 57 dodań i 52 usunięć
  1. 2 2
      .github/workflows/ghcr-build.yml
  2. 1 1
      .github/workflows/lint.yml
  3. 2 2
      .github/workflows/py-unit-tests.yml
  4. 2 1
      CONTRIBUTING.md
  5. 1 1
      containers/app/Dockerfile
  6. 1 1
      dev_config/python/.pre-commit-config.yaml
  7. 1 1
      docs/modules/usage/how-to/evaluation-harness.md
  8. 1 1
      evaluation/EDA/scripts/run_infer.sh
  9. 1 1
      evaluation/regression/conftest.py
  10. 2 2
      evaluation/swe_bench/run_infer.py
  11. 1 1
      evaluation/utils/version_control.sh
  12. 1 1
      openhands/agenthub/README.md
  13. 3 3
      openhands/agenthub/__init__.py
  14. 0 0
      openhands/agenthub/browsing_agent/README.md
  15. 1 1
      openhands/agenthub/browsing_agent/__init__.py
  16. 1 1
      openhands/agenthub/browsing_agent/browsing_agent.py
  17. 1 1
      openhands/agenthub/browsing_agent/prompt.py
  18. 0 0
      openhands/agenthub/browsing_agent/response_parser.py
  19. 0 0
      openhands/agenthub/browsing_agent/utils.py
  20. 0 0
      openhands/agenthub/codeact_agent/README.md
  21. 1 1
      openhands/agenthub/codeact_agent/__init__.py
  22. 0 0
      openhands/agenthub/codeact_agent/action_parser.py
  23. 1 1
      openhands/agenthub/codeact_agent/codeact_agent.py
  24. 0 0
      openhands/agenthub/codeact_agent/micro/github.md
  25. 0 0
      openhands/agenthub/codeact_agent/system_prompt.j2
  26. 0 0
      openhands/agenthub/codeact_agent/user_prompt.j2
  27. 0 0
      openhands/agenthub/codeact_swe_agent/README.md
  28. 1 1
      openhands/agenthub/codeact_swe_agent/__init__.py
  29. 0 0
      openhands/agenthub/codeact_swe_agent/action_parser.py
  30. 4 2
      openhands/agenthub/codeact_swe_agent/codeact_swe_agent.py
  31. 0 0
      openhands/agenthub/codeact_swe_agent/prompt.py
  32. 1 1
      openhands/agenthub/codeact_swe_agent/response_parser.py
  33. 1 1
      openhands/agenthub/delegator_agent/__init__.py
  34. 0 0
      openhands/agenthub/delegator_agent/agent.py
  35. 1 1
      openhands/agenthub/dummy_agent/__init__.py
  36. 0 0
      openhands/agenthub/dummy_agent/agent.py
  37. 0 0
      openhands/agenthub/micro/README.md
  38. 0 0
      openhands/agenthub/micro/_instructions/actions/browse.md
  39. 0 0
      openhands/agenthub/micro/_instructions/actions/delegate.md
  40. 0 0
      openhands/agenthub/micro/_instructions/actions/finish.md
  41. 0 0
      openhands/agenthub/micro/_instructions/actions/kill.md
  42. 0 0
      openhands/agenthub/micro/_instructions/actions/message.md
  43. 0 0
      openhands/agenthub/micro/_instructions/actions/read.md
  44. 0 0
      openhands/agenthub/micro/_instructions/actions/reject.md
  45. 0 0
      openhands/agenthub/micro/_instructions/actions/run.md
  46. 0 0
      openhands/agenthub/micro/_instructions/actions/write.md
  47. 0 0
      openhands/agenthub/micro/_instructions/format/action.md
  48. 0 0
      openhands/agenthub/micro/_instructions/history_truncated.md
  49. 2 2
      openhands/agenthub/micro/agent.py
  50. 0 0
      openhands/agenthub/micro/coder/agent.yaml
  51. 0 0
      openhands/agenthub/micro/coder/prompt.md
  52. 0 0
      openhands/agenthub/micro/commit_writer/README.md
  53. 0 0
      openhands/agenthub/micro/commit_writer/agent.yaml
  54. 0 0
      openhands/agenthub/micro/commit_writer/prompt.md
  55. 0 0
      openhands/agenthub/micro/instructions.py
  56. 0 0
      openhands/agenthub/micro/manager/agent.yaml
  57. 0 0
      openhands/agenthub/micro/manager/prompt.md
  58. 0 0
      openhands/agenthub/micro/math_agent/agent.yaml
  59. 0 0
      openhands/agenthub/micro/math_agent/prompt.md
  60. 0 0
      openhands/agenthub/micro/postgres_agent/agent.yaml
  61. 0 0
      openhands/agenthub/micro/postgres_agent/prompt.md
  62. 0 0
      openhands/agenthub/micro/registry.py
  63. 0 0
      openhands/agenthub/micro/repo_explorer/agent.yaml
  64. 0 0
      openhands/agenthub/micro/repo_explorer/prompt.md
  65. 0 0
      openhands/agenthub/micro/study_repo_for_task/agent.yaml
  66. 0 0
      openhands/agenthub/micro/study_repo_for_task/prompt.md
  67. 0 0
      openhands/agenthub/micro/typo_fixer_agent/agent.yaml
  68. 0 0
      openhands/agenthub/micro/typo_fixer_agent/prompt.md
  69. 0 0
      openhands/agenthub/micro/verifier/agent.yaml
  70. 0 0
      openhands/agenthub/micro/verifier/prompt.md
  71. 1 1
      openhands/agenthub/planner_agent/__init__.py
  72. 2 2
      openhands/agenthub/planner_agent/agent.py
  73. 0 0
      openhands/agenthub/planner_agent/prompt.py
  74. 0 0
      openhands/agenthub/planner_agent/response_parser.py
  75. 1 1
      openhands/core/cli.py
  76. 1 1
      openhands/core/download.py
  77. 2 2
      openhands/core/main.py
  78. 1 1
      openhands/server/listen.py
  79. 2 1
      pyproject.toml
  80. 1 1
      tests/integration/regenerate.sh
  81. 1 1
      tests/unit/test_browsing_agent_parser.py
  82. 1 1
      tests/unit/test_codeact_agent.py
  83. 2 2
      tests/unit/test_micro_agents.py
  84. 1 1
      tests/unit/test_microagent_utils.py
  85. 1 1
      tests/unit/test_prompt_caching.py
  86. 2 2
      tests/unit/test_prompt_manager.py
  87. 4 2
      tests/unit/test_response_parsing.py
  88. 0 1
      tests/unit/test_runtime_build.py

+ 2 - 2
.github/workflows/ghcr-build.yml

@@ -294,7 +294,7 @@ jobs:
           SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \
           SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \
           TEST_IN_CI=true \
           TEST_IN_CI=true \
           RUN_AS_OPENHANDS=false \
           RUN_AS_OPENHANDS=false \
-          poetry run pytest -n 3 -raRs --reruns 2 --reruns-delay 5 --cov=agenthub --cov=openhands --cov-report=xml -s ./tests/runtime
+          poetry run pytest -n 3 -raRs --reruns 2 --reruns-delay 5 --cov=openhands --cov-report=xml -s ./tests/runtime
       - name: Upload coverage to Codecov
       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v4
         uses: codecov/codecov-action@v4
         env:
         env:
@@ -372,7 +372,7 @@ jobs:
           SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \
           SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \
           TEST_IN_CI=true \
           TEST_IN_CI=true \
           RUN_AS_OPENHANDS=true \
           RUN_AS_OPENHANDS=true \
-          poetry run pytest -n 3 -raRs --reruns 2 --reruns-delay 5 --cov=agenthub --cov=openhands --cov-report=xml -s ./tests/runtime
+          poetry run pytest -n 3 -raRs --reruns 2 --reruns-delay 5 --cov=openhands --cov-report=xml -s ./tests/runtime
       - name: Upload coverage to Codecov
       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v4
         uses: codecov/codecov-action@v4
         env:
         env:

+ 1 - 1
.github/workflows/lint.yml

@@ -46,4 +46,4 @@ jobs:
       - name: Install pre-commit
       - name: Install pre-commit
         run: pip install pre-commit==3.7.0
         run: pip install pre-commit==3.7.0
       - name: Run pre-commit hooks
       - name: Run pre-commit hooks
-        run: pre-commit run --files openhands/**/* agenthub/**/* evaluation/**/* tests/**/* --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yaml
+        run: pre-commit run --files openhands/**/* evaluation/**/* tests/**/* --show-diff-on-failure --config ./dev_config/python/.pre-commit-config.yaml

+ 2 - 2
.github/workflows/py-unit-tests.yml

@@ -93,7 +93,7 @@ jobs:
         id: buildx
         id: buildx
         uses: docker/setup-buildx-action@v3
         uses: docker/setup-buildx-action@v3
       - name: Run Tests
       - name: Run Tests
-        run: poetry run pytest --forked --cov=agenthub --cov=openhands --cov-report=xml ./tests/unit --ignore=tests/unit/test_memory.py
+        run: poetry run pytest --forked --cov=openhands --cov-report=xml ./tests/unit --ignore=tests/unit/test_memory.py
       - name: Upload coverage to Codecov
       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v4
         uses: codecov/codecov-action@v4
         env:
         env:
@@ -125,7 +125,7 @@ jobs:
       - name: Build Environment
       - name: Build Environment
         run: make build
         run: make build
       - name: Run Tests
       - name: Run Tests
-        run: poetry run pytest --forked --cov=agenthub --cov=openhands --cov-report=xml -svv ./tests/unit --ignore=tests/unit/test_memory.py
+        run: poetry run pytest --forked --cov=openhands --cov-report=xml -svv ./tests/unit --ignore=tests/unit/test_memory.py
       - name: Upload coverage to Codecov
       - name: Upload coverage to Codecov
         uses: codecov/codecov-action@v4
         uses: codecov/codecov-action@v4
         env:
         env:

+ 2 - 1
CONTRIBUTING.md

@@ -14,11 +14,12 @@ There are many ways that you can contribute:
 
 
 To understand the codebase, please refer to the README in each module:
 To understand the codebase, please refer to the README in each module:
 - [frontend](./frontend/README.md)
 - [frontend](./frontend/README.md)
-- [agenthub](./agenthub/README.md)
 - [evaluation](./evaluation/README.md)
 - [evaluation](./evaluation/README.md)
 - [openhands](./openhands/README.md)
 - [openhands](./openhands/README.md)
+    - [agenthub](./openhands/agenthub/README.md)
     - [server](./openhands/server/README.md)
     - [server](./openhands/server/README.md)
 
 
+
 When you write code, it is also good to write tests. Please navigate to the `tests` folder to see existing test suites.
 When you write code, it is also good to write tests. Please navigate to the `tests` folder to see existing test suites.
 At the moment, we have two kinds of tests: `unit` and `integration`. Please refer to the README for each test suite. These tests also run on GitHub's continuous integration to ensure quality of the project.
 At the moment, we have two kinds of tests: `unit` and `integration`. Please refer to the README for each test suite. These tests also run on GitHub's continuous integration to ensure quality of the project.
 
 

+ 1 - 1
containers/app/Dockerfile

@@ -69,7 +69,7 @@ RUN playwright install --with-deps chromium
 
 
 COPY --chown=openhands:app --chmod=770 ./openhands ./openhands
 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=777 ./openhands/runtime/plugins ./openhands/runtime/plugins
-COPY --chown=openhands:app --chmod=770 ./agenthub ./agenthub
+COPY --chown=openhands:app --chmod=770 ./openhands/agenthub ./openhands/agenthub
 COPY --chown=openhands:app ./pyproject.toml ./pyproject.toml
 COPY --chown=openhands:app ./pyproject.toml ./pyproject.toml
 COPY --chown=openhands:app ./poetry.lock ./poetry.lock
 COPY --chown=openhands:app ./poetry.lock ./poetry.lock
 COPY --chown=openhands:app ./README.md ./README.md
 COPY --chown=openhands:app ./README.md ./README.md

+ 1 - 1
dev_config/python/.pre-commit-config.yaml

@@ -38,6 +38,6 @@ repos:
       - id: mypy
       - id: mypy
         additional_dependencies:
         additional_dependencies:
           [types-requests, types-setuptools, types-pyyaml, types-toml]
           [types-requests, types-setuptools, types-pyyaml, types-toml]
-        entry: mypy --config-file dev_config/python/mypy.ini openhands/ agenthub/
+        entry: mypy --config-file dev_config/python/mypy.ini openhands/
         always_run: true
         always_run: true
         pass_filenames: false
         pass_filenames: false

+ 1 - 1
docs/modules/usage/how-to/evaluation-harness.md

@@ -84,7 +84,7 @@ To create an evaluation workflow for your benchmark, follow these steps:
 
 
 1. Import relevant OpenHands utilities:
 1. Import relevant OpenHands utilities:
    ```python
    ```python
-    import agenthub
+    import openhands.agenthub
     from evaluation.utils.shared import (
     from evaluation.utils.shared import (
         EvalMetadata,
         EvalMetadata,
         EvalOutput,
         EvalOutput,

+ 1 - 1
evaluation/EDA/scripts/run_infer.sh

@@ -36,7 +36,7 @@ fi
 
 
 # IMPORTANT: Because Agent's prompt changes fairly often in the rapidly evolving codebase of OpenHands
 # IMPORTANT: Because Agent's prompt changes fairly often in the rapidly evolving codebase of OpenHands
 # We need to track the version of Agent in the evaluation to make sure results are comparable
 # We need to track the version of Agent in the evaluation to make sure results are comparable
-AGENT_VERSION=v$(poetry run python -c "import agenthub; from openhands.controller.agent import Agent; print(Agent.get_cls('$AGENT').VERSION)")
+AGENT_VERSION=v$(poetry run python -c "import openhands.agenthub; from openhands.controller.agent import Agent; print(Agent.get_cls('$AGENT').VERSION)")
 
 
 echo "AGENT: $AGENT"
 echo "AGENT: $AGENT"
 echo "AGENT_VERSION: $AGENT_VERSION"
 echo "AGENT_VERSION: $AGENT_VERSION"

+ 1 - 1
evaluation/regression/conftest.py

@@ -8,7 +8,7 @@ import pytest
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
 CASES_DIR = os.path.join(SCRIPT_DIR, 'cases')
 CASES_DIR = os.path.join(SCRIPT_DIR, 'cases')
-AGENTHUB_DIR = os.path.join(SCRIPT_DIR, '../../', 'agenthub')
+AGENTHUB_DIR = os.path.join(SCRIPT_DIR, '../', 'agenthub')
 
 
 
 
 def agents():
 def agents():

+ 2 - 2
evaluation/swe_bench/run_infer.py

@@ -8,7 +8,7 @@ import pandas as pd
 import toml
 import toml
 from datasets import load_dataset
 from datasets import load_dataset
 
 
-import agenthub
+import openhands.agenthub
 from evaluation.swe_bench.prompt import CODEACT_SWE_PROMPT
 from evaluation.swe_bench.prompt import CODEACT_SWE_PROMPT
 from evaluation.utils.shared import (
 from evaluation.utils.shared import (
     EvalMetadata,
     EvalMetadata,
@@ -470,7 +470,7 @@ if __name__ == '__main__':
         raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')
         raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')
 
 
     details = {}
     details = {}
-    _agent_cls = agenthub.Agent.get_cls(args.agent_cls)
+    _agent_cls = openhands.agenthub.Agent.get_cls(args.agent_cls)
     if hasattr(_agent_cls, 'system_message'):
     if hasattr(_agent_cls, 'system_message'):
         details['system_message'] = _agent_cls.system_message
         details['system_message'] = _agent_cls.system_message
     if hasattr(_agent_cls, 'in_context_example'):
     if hasattr(_agent_cls, 'in_context_example'):

+ 1 - 1
evaluation/utils/version_control.sh

@@ -42,5 +42,5 @@ checkout_original_branch() {
 get_agent_version() {
 get_agent_version() {
     # IMPORTANT: Because Agent's prompt changes fairly often in the rapidly evolving codebase of OpenHands
     # IMPORTANT: Because Agent's prompt changes fairly often in the rapidly evolving codebase of OpenHands
     # We need to track the version of Agent in the evaluation to make sure results are comparable
     # We need to track the version of Agent in the evaluation to make sure results are comparable
-    AGENT_VERSION=v$(poetry run python -c "import agenthub; from openhands.controller.agent import Agent; print(Agent.get_cls('$AGENT').VERSION)")
+    AGENT_VERSION=v$(poetry run python -c "import openhands.agenthub; from openhands.controller.agent import Agent; print(Agent.get_cls('$AGENT').VERSION)")
 }
 }

+ 1 - 1
agenthub/README.md → openhands/agenthub/README.md

@@ -2,7 +2,7 @@
 
 
 In this folder, there may exist multiple implementations of `Agent` that will be used by the framework.
 In this folder, there may exist multiple implementations of `Agent` that will be used by the framework.
 
 
-For example, `agenthub/codeact_agent`, etc.
+For example, `openhands/agenthub/codeact_agent`, etc.
 Contributors from different backgrounds and interests can choose to contribute to any (or all!) of these directions.
 Contributors from different backgrounds and interests can choose to contribute to any (or all!) of these directions.
 
 
 ## Constructing an Agent
 ## Constructing an Agent

+ 3 - 3
agenthub/__init__.py → openhands/agenthub/__init__.py

@@ -1,13 +1,13 @@
 from dotenv import load_dotenv
 from dotenv import load_dotenv
 
 
-from agenthub.micro.agent import MicroAgent
-from agenthub.micro.registry import all_microagents
+from openhands.agenthub.micro.agent import MicroAgent
+from openhands.agenthub.micro.registry import all_microagents
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 
 
 load_dotenv()
 load_dotenv()
 
 
 
 
-from agenthub import (  # noqa: E402
+from openhands.agenthub import (  # noqa: E402
     browsing_agent,
     browsing_agent,
     codeact_agent,
     codeact_agent,
     codeact_swe_agent,
     codeact_swe_agent,

+ 0 - 0
agenthub/browsing_agent/README.md → openhands/agenthub/browsing_agent/README.md


+ 1 - 1
agenthub/browsing_agent/__init__.py → openhands/agenthub/browsing_agent/__init__.py

@@ -1,4 +1,4 @@
-from agenthub.browsing_agent.browsing_agent import BrowsingAgent
+from openhands.agenthub.browsing_agent.browsing_agent import BrowsingAgent
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 
 
 Agent.register('BrowsingAgent', BrowsingAgent)
 Agent.register('BrowsingAgent', BrowsingAgent)

+ 1 - 1
agenthub/browsing_agent/browsing_agent.py → openhands/agenthub/browsing_agent/browsing_agent.py

@@ -3,7 +3,7 @@ import os
 from browsergym.core.action.highlevel import HighLevelActionSet
 from browsergym.core.action.highlevel import HighLevelActionSet
 from browsergym.utils.obs import flatten_axtree_to_str
 from browsergym.utils.obs import flatten_axtree_to_str
 
 
-from agenthub.browsing_agent.response_parser import BrowsingResponseParser
+from openhands.agenthub.browsing_agent.response_parser import BrowsingResponseParser
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 from openhands.controller.state.state import State
 from openhands.controller.state.state import State
 from openhands.core.config import AgentConfig
 from openhands.core.config import AgentConfig

+ 1 - 1
agenthub/browsing_agent/prompt.py → openhands/agenthub/browsing_agent/prompt.py

@@ -12,7 +12,7 @@ from browsergym.core.action.base import AbstractActionSet
 from browsergym.core.action.highlevel import HighLevelActionSet
 from browsergym.core.action.highlevel import HighLevelActionSet
 from browsergym.core.action.python import PythonActionSet
 from browsergym.core.action.python import PythonActionSet
 
 
-from agenthub.browsing_agent.utils import (
+from openhands.agenthub.browsing_agent.utils import (
     ParseError,
     ParseError,
     parse_html_tags_raise,
     parse_html_tags_raise,
 )
 )

+ 0 - 0
agenthub/browsing_agent/response_parser.py → openhands/agenthub/browsing_agent/response_parser.py


+ 0 - 0
agenthub/browsing_agent/utils.py → openhands/agenthub/browsing_agent/utils.py


+ 0 - 0
agenthub/codeact_agent/README.md → openhands/agenthub/codeact_agent/README.md


+ 1 - 1
agenthub/codeact_agent/__init__.py → openhands/agenthub/codeact_agent/__init__.py

@@ -1,4 +1,4 @@
-from agenthub.codeact_agent.codeact_agent import CodeActAgent
+from openhands.agenthub.codeact_agent.codeact_agent import CodeActAgent
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 
 
 Agent.register('CodeActAgent', CodeActAgent)
 Agent.register('CodeActAgent', CodeActAgent)

+ 0 - 0
agenthub/codeact_agent/action_parser.py → openhands/agenthub/codeact_agent/action_parser.py


+ 1 - 1
agenthub/codeact_agent/codeact_agent.py → openhands/agenthub/codeact_agent/codeact_agent.py

@@ -1,7 +1,7 @@
 import os
 import os
 from itertools import islice
 from itertools import islice
 
 
-from agenthub.codeact_agent.action_parser import CodeActResponseParser
+from openhands.agenthub.codeact_agent.action_parser import CodeActResponseParser
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 from openhands.controller.state.state import State
 from openhands.controller.state.state import State
 from openhands.core.config import AgentConfig
 from openhands.core.config import AgentConfig

+ 0 - 0
agenthub/codeact_agent/micro/github.md → openhands/agenthub/codeact_agent/micro/github.md


+ 0 - 0
agenthub/codeact_agent/system_prompt.j2 → openhands/agenthub/codeact_agent/system_prompt.j2


+ 0 - 0
agenthub/codeact_agent/user_prompt.j2 → openhands/agenthub/codeact_agent/user_prompt.j2


+ 0 - 0
agenthub/codeact_swe_agent/README.md → openhands/agenthub/codeact_swe_agent/README.md


+ 1 - 1
agenthub/codeact_swe_agent/__init__.py → openhands/agenthub/codeact_swe_agent/__init__.py

@@ -1,4 +1,4 @@
-from agenthub.codeact_swe_agent.codeact_swe_agent import CodeActSWEAgent
+from openhands.agenthub.codeact_swe_agent.codeact_swe_agent import CodeActSWEAgent
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 
 
 Agent.register('CodeActSWEAgent', CodeActSWEAgent)
 Agent.register('CodeActSWEAgent', CodeActSWEAgent)

+ 0 - 0
agenthub/codeact_swe_agent/action_parser.py → openhands/agenthub/codeact_swe_agent/action_parser.py


+ 4 - 2
agenthub/codeact_swe_agent/codeact_swe_agent.py → openhands/agenthub/codeact_swe_agent/codeact_swe_agent.py

@@ -1,10 +1,12 @@
-from agenthub.codeact_swe_agent.prompt import (
+from openhands.agenthub.codeact_swe_agent.prompt import (
     COMMAND_DOCS,
     COMMAND_DOCS,
     SWE_EXAMPLE,
     SWE_EXAMPLE,
     SYSTEM_PREFIX,
     SYSTEM_PREFIX,
     SYSTEM_SUFFIX,
     SYSTEM_SUFFIX,
 )
 )
-from agenthub.codeact_swe_agent.response_parser import CodeActSWEResponseParser
+from openhands.agenthub.codeact_swe_agent.response_parser import (
+    CodeActSWEResponseParser,
+)
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 from openhands.controller.state.state import State
 from openhands.controller.state.state import State
 from openhands.core.config import AgentConfig
 from openhands.core.config import AgentConfig

+ 0 - 0
agenthub/codeact_swe_agent/prompt.py → openhands/agenthub/codeact_swe_agent/prompt.py


+ 1 - 1
agenthub/codeact_swe_agent/response_parser.py → openhands/agenthub/codeact_swe_agent/response_parser.py

@@ -1,4 +1,4 @@
-from agenthub.codeact_swe_agent.action_parser import (
+from openhands.agenthub.codeact_swe_agent.action_parser import (
     CodeActSWEActionParserCmdRun,
     CodeActSWEActionParserCmdRun,
     CodeActSWEActionParserFinish,
     CodeActSWEActionParserFinish,
     CodeActSWEActionParserIPythonRunCell,
     CodeActSWEActionParserIPythonRunCell,

+ 1 - 1
agenthub/delegator_agent/__init__.py → openhands/agenthub/delegator_agent/__init__.py

@@ -1,4 +1,4 @@
-from agenthub.delegator_agent.agent import DelegatorAgent
+from openhands.agenthub.delegator_agent.agent import DelegatorAgent
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 
 
 Agent.register('DelegatorAgent', DelegatorAgent)
 Agent.register('DelegatorAgent', DelegatorAgent)

+ 0 - 0
agenthub/delegator_agent/agent.py → openhands/agenthub/delegator_agent/agent.py


+ 1 - 1
agenthub/dummy_agent/__init__.py → openhands/agenthub/dummy_agent/__init__.py

@@ -1,4 +1,4 @@
-from agenthub.dummy_agent.agent import DummyAgent
+from openhands.agenthub.dummy_agent.agent import DummyAgent
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 
 
 Agent.register('DummyAgent', DummyAgent)
 Agent.register('DummyAgent', DummyAgent)

+ 0 - 0
agenthub/dummy_agent/agent.py → openhands/agenthub/dummy_agent/agent.py


+ 0 - 0
agenthub/micro/README.md → openhands/agenthub/micro/README.md


+ 0 - 0
agenthub/micro/_instructions/actions/browse.md → openhands/agenthub/micro/_instructions/actions/browse.md


+ 0 - 0
agenthub/micro/_instructions/actions/delegate.md → openhands/agenthub/micro/_instructions/actions/delegate.md


+ 0 - 0
agenthub/micro/_instructions/actions/finish.md → openhands/agenthub/micro/_instructions/actions/finish.md


+ 0 - 0
agenthub/micro/_instructions/actions/kill.md → openhands/agenthub/micro/_instructions/actions/kill.md


+ 0 - 0
agenthub/micro/_instructions/actions/message.md → openhands/agenthub/micro/_instructions/actions/message.md


+ 0 - 0
agenthub/micro/_instructions/actions/read.md → openhands/agenthub/micro/_instructions/actions/read.md


+ 0 - 0
agenthub/micro/_instructions/actions/reject.md → openhands/agenthub/micro/_instructions/actions/reject.md


+ 0 - 0
agenthub/micro/_instructions/actions/run.md → openhands/agenthub/micro/_instructions/actions/run.md


+ 0 - 0
agenthub/micro/_instructions/actions/write.md → openhands/agenthub/micro/_instructions/actions/write.md


+ 0 - 0
agenthub/micro/_instructions/format/action.md → openhands/agenthub/micro/_instructions/format/action.md


+ 0 - 0
agenthub/micro/_instructions/history_truncated.md → openhands/agenthub/micro/_instructions/history_truncated.md


+ 2 - 2
agenthub/micro/agent.py → openhands/agenthub/micro/agent.py

@@ -1,7 +1,7 @@
 from jinja2 import BaseLoader, Environment
 from jinja2 import BaseLoader, Environment
 
 
-from agenthub.micro.instructions import instructions
-from agenthub.micro.registry import all_microagents
+from openhands.agenthub.micro.instructions import instructions
+from openhands.agenthub.micro.registry import all_microagents
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 from openhands.controller.state.state import State
 from openhands.controller.state.state import State
 from openhands.core.config import AgentConfig
 from openhands.core.config import AgentConfig

+ 0 - 0
agenthub/micro/coder/agent.yaml → openhands/agenthub/micro/coder/agent.yaml


+ 0 - 0
agenthub/micro/coder/prompt.md → openhands/agenthub/micro/coder/prompt.md


+ 0 - 0
agenthub/micro/commit_writer/README.md → openhands/agenthub/micro/commit_writer/README.md


+ 0 - 0
agenthub/micro/commit_writer/agent.yaml → openhands/agenthub/micro/commit_writer/agent.yaml


+ 0 - 0
agenthub/micro/commit_writer/prompt.md → openhands/agenthub/micro/commit_writer/prompt.md


+ 0 - 0
agenthub/micro/instructions.py → openhands/agenthub/micro/instructions.py


+ 0 - 0
agenthub/micro/manager/agent.yaml → openhands/agenthub/micro/manager/agent.yaml


+ 0 - 0
agenthub/micro/manager/prompt.md → openhands/agenthub/micro/manager/prompt.md


+ 0 - 0
agenthub/micro/math_agent/agent.yaml → openhands/agenthub/micro/math_agent/agent.yaml


+ 0 - 0
agenthub/micro/math_agent/prompt.md → openhands/agenthub/micro/math_agent/prompt.md


+ 0 - 0
agenthub/micro/postgres_agent/agent.yaml → openhands/agenthub/micro/postgres_agent/agent.yaml


+ 0 - 0
agenthub/micro/postgres_agent/prompt.md → openhands/agenthub/micro/postgres_agent/prompt.md


+ 0 - 0
agenthub/micro/registry.py → openhands/agenthub/micro/registry.py


+ 0 - 0
agenthub/micro/repo_explorer/agent.yaml → openhands/agenthub/micro/repo_explorer/agent.yaml


+ 0 - 0
agenthub/micro/repo_explorer/prompt.md → openhands/agenthub/micro/repo_explorer/prompt.md


+ 0 - 0
agenthub/micro/study_repo_for_task/agent.yaml → openhands/agenthub/micro/study_repo_for_task/agent.yaml


+ 0 - 0
agenthub/micro/study_repo_for_task/prompt.md → openhands/agenthub/micro/study_repo_for_task/prompt.md


+ 0 - 0
agenthub/micro/typo_fixer_agent/agent.yaml → openhands/agenthub/micro/typo_fixer_agent/agent.yaml


+ 0 - 0
agenthub/micro/typo_fixer_agent/prompt.md → openhands/agenthub/micro/typo_fixer_agent/prompt.md


+ 0 - 0
agenthub/micro/verifier/agent.yaml → openhands/agenthub/micro/verifier/agent.yaml


+ 0 - 0
agenthub/micro/verifier/prompt.md → openhands/agenthub/micro/verifier/prompt.md


+ 1 - 1
agenthub/planner_agent/__init__.py → openhands/agenthub/planner_agent/__init__.py

@@ -1,4 +1,4 @@
-from agenthub.planner_agent.agent import PlannerAgent
+from openhands.agenthub.planner_agent.agent import PlannerAgent
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 
 
 Agent.register('PlannerAgent', PlannerAgent)
 Agent.register('PlannerAgent', PlannerAgent)

+ 2 - 2
agenthub/planner_agent/agent.py → openhands/agenthub/planner_agent/agent.py

@@ -1,5 +1,5 @@
-from agenthub.planner_agent.prompt import get_prompt_and_images
-from agenthub.planner_agent.response_parser import PlannerResponseParser
+from openhands.agenthub.planner_agent.prompt import get_prompt_and_images
+from openhands.agenthub.planner_agent.response_parser import PlannerResponseParser
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 from openhands.controller.state.state import State
 from openhands.controller.state.state import State
 from openhands.core.config import AgentConfig
 from openhands.core.config import AgentConfig

+ 0 - 0
agenthub/planner_agent/prompt.py → openhands/agenthub/planner_agent/prompt.py


+ 0 - 0
agenthub/planner_agent/response_parser.py → openhands/agenthub/planner_agent/response_parser.py


+ 1 - 1
openhands/core/cli.py

@@ -4,7 +4,7 @@ from typing import Type
 
 
 from termcolor import colored
 from termcolor import colored
 
 
-import agenthub  # noqa F401 (we import this to get the agents registered)
+import openhands.agenthub  # noqa F401 (we import this to get the agents registered)
 from openhands import __version__
 from openhands import __version__
 from openhands.controller import AgentController
 from openhands.controller import AgentController
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent

+ 1 - 1
openhands/core/download.py

@@ -1,2 +1,2 @@
 # Run this file to trigger a model download
 # Run this file to trigger a model download
-import agenthub  # noqa F401 (we import this to get the agents registered)
+import openhands.agenthub  # noqa F401 (we import this to get the agents registered)

+ 2 - 2
openhands/core/main.py

@@ -4,7 +4,7 @@ import sys
 import uuid
 import uuid
 from typing import Callable, Protocol, Type
 from typing import Callable, Protocol, Type
 
 
-import agenthub  # noqa F401 (we import this to get the agents registered)
+import openhands.agenthub  # noqa F401 (we import this to get the agents registered)
 from openhands.controller import AgentController
 from openhands.controller import AgentController
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 from openhands.controller.state.state import State
 from openhands.controller.state.state import State
@@ -66,7 +66,7 @@ def create_runtime(
     event_stream = EventStream(session_id, file_store)
     event_stream = EventStream(session_id, file_store)
 
 
     # agent class
     # agent class
-    agent_cls = agenthub.Agent.get_cls(config.default_agent)
+    agent_cls = openhands.agenthub.Agent.get_cls(config.default_agent)
 
 
     # runtime and tools
     # runtime and tools
     runtime_cls = get_runtime_cls(config.runtime)
     runtime_cls = get_runtime_cls(config.runtime)

+ 1 - 1
openhands/server/listen.py

@@ -34,7 +34,7 @@ from fastapi.security import HTTPBearer
 from fastapi.staticfiles import StaticFiles
 from fastapi.staticfiles import StaticFiles
 from pydantic import BaseModel
 from pydantic import BaseModel
 
 
-import agenthub  # noqa F401 (we import this to get the agents registered)
+import openhands.agenthub  # noqa F401 (we import this to get the agents registered)
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 from openhands.core.config import LLMConfig, load_app_config
 from openhands.core.config import LLMConfig, load_app_config
 from openhands.core.logger import openhands_logger as logger
 from openhands.core.logger import openhands_logger as logger

+ 2 - 1
pyproject.toml

@@ -8,7 +8,6 @@ readme = "README.md"
 repository = "https://github.com/All-Hands-AI/OpenHands"
 repository = "https://github.com/All-Hands-AI/OpenHands"
 include = ["poetry.lock"]
 include = ["poetry.lock"]
 packages = [
 packages = [
-  { include = "agenthub/**/*" },
   { include = "openhands/**/*" }
   { include = "openhands/**/*" }
 ]
 ]
 
 
@@ -86,6 +85,7 @@ reportlab = "*"
 [tool.coverage.run]
 [tool.coverage.run]
 concurrency = ["gevent"]
 concurrency = ["gevent"]
 
 
+
 [tool.poetry.group.runtime.dependencies]
 [tool.poetry.group.runtime.dependencies]
 jupyterlab = "*"
 jupyterlab = "*"
 notebook = "*"
 notebook = "*"
@@ -116,6 +116,7 @@ ignore = ["D1"]
 [tool.ruff.lint.pydocstyle]
 [tool.ruff.lint.pydocstyle]
 convention = "google"
 convention = "google"
 
 
+
 [tool.poetry.group.evaluation.dependencies]
 [tool.poetry.group.evaluation.dependencies]
 streamlit = "*"
 streamlit = "*"
 whatthepatch = "*"
 whatthepatch = "*"

+ 1 - 1
tests/integration/regenerate.sh

@@ -119,7 +119,7 @@ run_test() {
   local pytest_cmd="poetry run pytest --cache-clear -vvsxx $SCRIPT_DIR/test_agent.py::$test_name"
   local pytest_cmd="poetry run pytest --cache-clear -vvsxx $SCRIPT_DIR/test_agent.py::$test_name"
   # Check if TEST_IN_CI is defined
   # Check if TEST_IN_CI is defined
   if [ -n "$TEST_IN_CI" ]; then
   if [ -n "$TEST_IN_CI" ]; then
-    pytest_cmd+=" --cov=agenthub --cov=openhands --cov-report=xml --cov-append"
+    pytest_cmd+=" --cov=openhands --cov-report=xml --cov-append"
   fi
   fi
 
 
   env SCRIPT_DIR="$SCRIPT_DIR" \
   env SCRIPT_DIR="$SCRIPT_DIR" \

+ 1 - 1
tests/unit/test_browsing_agent_parser.py

@@ -1,6 +1,6 @@
 import pytest
 import pytest
 
 
-from agenthub.browsing_agent.response_parser import (
+from openhands.agenthub.browsing_agent.response_parser import (
     BrowseInteractiveAction,
     BrowseInteractiveAction,
     BrowsingResponseParser,
     BrowsingResponseParser,
 )
 )

+ 1 - 1
tests/unit/test_codeact_agent.py

@@ -2,7 +2,7 @@ from unittest.mock import Mock
 
 
 import pytest
 import pytest
 
 
-from agenthub.codeact_agent.codeact_agent import CodeActAgent
+from openhands.agenthub.codeact_agent.codeact_agent import CodeActAgent
 from openhands.core.config import AgentConfig, LLMConfig
 from openhands.core.config import AgentConfig, LLMConfig
 from openhands.core.message import TextContent
 from openhands.core.message import TextContent
 from openhands.events.observation.commands import (
 from openhands.events.observation.commands import (

+ 2 - 2
tests/unit/test_micro_agents.py

@@ -6,7 +6,7 @@ import pytest
 import yaml
 import yaml
 from pytest import TempPathFactory
 from pytest import TempPathFactory
 
 
-from agenthub.micro.registry import all_microagents
+from openhands.agenthub.micro.registry import all_microagents
 from openhands.controller.agent import Agent
 from openhands.controller.agent import Agent
 from openhands.controller.state.state import State
 from openhands.controller.state.state import State
 from openhands.core.config import AgentConfig
 from openhands.core.config import AgentConfig
@@ -44,7 +44,7 @@ def test_all_agents_are_loaded():
     assert all_microagents is not None
     assert all_microagents is not None
     assert len(all_microagents) > 1
     assert len(all_microagents) > 1
 
 
-    base = os.path.join('agenthub', 'micro')
+    base = os.path.join('openhands', 'agenthub', 'micro')
     full_path = os.path.dirname(__file__) + '/../../' + base
     full_path = os.path.dirname(__file__) + '/../../' + base
     agent_names = set()
     agent_names = set()
     for root, _, files in os.walk(full_path):
     for root, _, files in os.walk(full_path):

+ 1 - 1
tests/unit/test_microagent_utils.py

@@ -3,7 +3,7 @@ import os
 import pytest
 import pytest
 from pytest import MonkeyPatch
 from pytest import MonkeyPatch
 
 
-import agenthub  # noqa: F401
+import openhands.agenthub  # noqa: F401
 from openhands.core.exceptions import (
 from openhands.core.exceptions import (
     AgentNotRegisteredError,
     AgentNotRegisteredError,
     MicroAgentValidationError,
     MicroAgentValidationError,

+ 1 - 1
tests/unit/test_prompt_caching.py

@@ -2,7 +2,7 @@ from unittest.mock import MagicMock, Mock, patch
 
 
 import pytest
 import pytest
 
 
-from agenthub.codeact_agent.codeact_agent import CodeActAgent
+from openhands.agenthub.codeact_agent.codeact_agent import CodeActAgent
 from openhands.core.config import AgentConfig, LLMConfig
 from openhands.core.config import AgentConfig, LLMConfig
 from openhands.events import EventSource, EventStream
 from openhands.events import EventSource, EventStream
 from openhands.events.action import CmdRunAction, MessageAction
 from openhands.events.action import CmdRunAction, MessageAction

+ 2 - 2
tests/unit/test_prompt_manager.py

@@ -10,8 +10,8 @@ from openhands.utils.prompt import PromptManager
 
 
 @pytest.fixture
 @pytest.fixture
 def prompt_dir(tmp_path):
 def prompt_dir(tmp_path):
-    # Copy contents from "agenthub/codeact_agent" to the temp directory
-    shutil.copytree('agenthub/codeact_agent', tmp_path, dirs_exist_ok=True)
+    # Copy contents from "openhands/agenthub/codeact_agent" to the temp directory
+    shutil.copytree('openhands/agenthub/codeact_agent', tmp_path, dirs_exist_ok=True)
 
 
     # Return the temporary directory path
     # Return the temporary directory path
     return tmp_path
     return tmp_path

+ 4 - 2
tests/unit/test_response_parsing.py

@@ -1,7 +1,9 @@
 import pytest
 import pytest
 
 
-from agenthub.micro.agent import parse_response as parse_response_micro
-from agenthub.planner_agent.prompt import parse_response as parse_response_planner
+from openhands.agenthub.micro.agent import parse_response as parse_response_micro
+from openhands.agenthub.planner_agent.prompt import (
+    parse_response as parse_response_planner,
+)
 from openhands.core.exceptions import LLMResponseError
 from openhands.core.exceptions import LLMResponseError
 from openhands.core.utils.json import loads as custom_loads
 from openhands.core.utils.json import loads as custom_loads
 from openhands.events.action import (
 from openhands.events.action import (

+ 0 - 1
tests/unit/test_runtime_build.py

@@ -56,7 +56,6 @@ def _check_source_code_in_dir(temp_dir):
 
 
     # The source code should only include the `openhands` folder, but not the other folders
     # The source code should only include the `openhands` folder, but not the other folders
     assert set(os.listdir(code_dir)) == {
     assert set(os.listdir(code_dir)) == {
-        'agenthub',
         'openhands',
         'openhands',
         'pyproject.toml',
         'pyproject.toml',
         'poetry.lock',
         'poetry.lock',