Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Move agenthub within openhands (#4130)

Engel Nyste6847e9e61bf
diff --git a/.github/workflows/ghcr-build.yml b/.github/workflows/ghcr-build.yml
index 81060a7c1a..6b1f353ad1 100644
--- a/.github/workflows/ghcr-build.yml
+++ b/.github/workflows/ghcr-build.yml
@@ -294,7 +294,7 @@ jobs:
SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \
TEST_IN_CI=true \
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
uses: codecov/codecov-action@v4
env:
@@ -372,7 +372,7 @@ jobs:
SANDBOX_RUNTIME_CONTAINER_IMAGE=$image_name \
TEST_IN_CI=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
uses: codecov/codecov-action@v4
env:
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 13608c9120..1061a8fd95 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -46,4 +46,4 @@ jobs:
- name: Install pre-commit
run: pip install pre-commit==3.7.0
- 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
diff --git a/.github/workflows/py-unit-tests.yml b/.github/workflows/py-unit-tests.yml
index dee4a649e0..8acb5cee71 100644
--- a/.github/workflows/py-unit-tests.yml
+++ b/.github/workflows/py-unit-tests.yml
@@ -93,7 +93,7 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v3
- 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
uses: codecov/codecov-action@v4
env:
@@ -125,7 +125,7 @@ jobs:
- name: Build Environment
run: make build
- 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
uses: codecov/codecov-action@v4
env:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1424f4bba2..4549944e3f 100644
--- a/CONTRIBUTING.md
+++ b/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:
- [frontend](./frontend/README.md)
-- [agenthub](./agenthub/README.md)
- [evaluation](./evaluation/README.md)
- [openhands](./openhands/README.md)
+ - [agenthub](./openhands/agenthub/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.
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.
diff --git a/containers/app/Dockerfile b/containers/app/Dockerfile
index 8a983e5972..6df4fda5a3 100644
--- a/containers/app/Dockerfile
+++ b/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=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 ./poetry.lock ./poetry.lock
COPY --chown=openhands:app ./README.md ./README.md
diff --git a/dev_config/python/.pre-commit-config.yaml b/dev_config/python/.pre-commit-config.yaml
index eca8706b51..0ae868fe70 100644
--- a/dev_config/python/.pre-commit-config.yaml
+++ b/dev_config/python/.pre-commit-config.yaml
@@ -38,6 +38,6 @@ repos:
- id: mypy
additional_dependencies:
[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
pass_filenames: false
diff --git a/docs/modules/usage/how-to/evaluation-harness.md b/docs/modules/usage/how-to/evaluation-harness.md
index cb9b64754e..7209e9a567 100644
--- a/docs/modules/usage/how-to/evaluation-harness.md
+++ b/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:
```python
- import agenthub
+ import openhands.agenthub
from evaluation.utils.shared import (
EvalMetadata,
EvalOutput,
diff --git a/evaluation/EDA/scripts/run_infer.sh b/evaluation/EDA/scripts/run_infer.sh
index bd52c613ff..1b72d48ebc 100755
--- a/evaluation/EDA/scripts/run_infer.sh
+++ b/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
# 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_VERSION: $AGENT_VERSION"
diff --git a/evaluation/regression/conftest.py b/evaluation/regression/conftest.py
index d514622d51..d9ec620d80 100644
--- a/evaluation/regression/conftest.py
+++ b/evaluation/regression/conftest.py
@@ -8,7 +8,7 @@ import pytest
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
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():
diff --git a/evaluation/swe_bench/run_infer.py b/evaluation/swe_bench/run_infer.py
index b28fb33cf6..4d65500cb4 100644
--- a/evaluation/swe_bench/run_infer.py
+++ b/evaluation/swe_bench/run_infer.py
@@ -8,7 +8,7 @@ import pandas as pd
import toml
from datasets import load_dataset
-import agenthub
+import openhands.agenthub
from evaluation.swe_bench.prompt import CODEACT_SWE_PROMPT
from evaluation.utils.shared import (
EvalMetadata,
@@ -470,7 +470,7 @@ if __name__ == '__main__':
raise ValueError(f'Could not find LLM config: --llm_config {args.llm_config}')
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'):
details['system_message'] = _agent_cls.system_message
if hasattr(_agent_cls, 'in_context_example'):
diff --git a/evaluation/utils/version_control.sh b/evaluation/utils/version_control.sh
index 1fc59250cb..11b366d4b8 100644
--- a/evaluation/utils/version_control.sh
+++ b/evaluation/utils/version_control.sh
@@ -42,5 +42,5 @@ checkout_original_branch() {
get_agent_version() {
# 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
- 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)")
}
diff --git a/agenthub/README.md b/openhands/agenthub/README.md
similarity index 99%
rename from agenthub/README.md
rename to openhands/agenthub/README.md
index 46e8fa9664..05de596f1f 100644
--- a/agenthub/README.md
+++ b/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.
-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.
## Constructing an Agent
diff --git a/agenthub/__init__.py b/openhands/agenthub/__init__.py
similarity index 79%
rename from agenthub/__init__.py
rename to openhands/agenthub/__init__.py
index d91f2d3ec2..0076976c27 100644
--- a/agenthub/__init__.py
+++ b/openhands/agenthub/__init__.py
@@ -1,13 +1,13 @@
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
load_dotenv()
-from agenthub import ( # noqa: E402
+from openhands.agenthub import ( # noqa: E402
browsing_agent,
codeact_agent,
codeact_swe_agent,
diff --git a/agenthub/browsing_agent/README.md b/openhands/agenthub/browsing_agent/README.md
similarity index 100%
rename from agenthub/browsing_agent/README.md
rename to openhands/agenthub/browsing_agent/README.md
diff --git a/agenthub/browsing_agent/__init__.py b/openhands/agenthub/browsing_agent/__init__.py
similarity index 55%
rename from agenthub/browsing_agent/__init__.py
rename to openhands/agenthub/browsing_agent/__init__.py
index 5b32e8c826..436d69d135 100644
--- a/agenthub/browsing_agent/__init__.py
+++ b/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
Agent.register('BrowsingAgent', BrowsingAgent)
diff --git a/agenthub/browsing_agent/browsing_agent.py b/openhands/agenthub/browsing_agent/browsing_agent.py
similarity index 98%
rename from agenthub/browsing_agent/browsing_agent.py
rename to openhands/agenthub/browsing_agent/browsing_agent.py
index bf1e01336d..0460506d04 100644
--- a/agenthub/browsing_agent/browsing_agent.py
+++ b/openhands/agenthub/browsing_agent/browsing_agent.py
@@ -3,7 +3,7 @@ import os
from browsergym.core.action.highlevel import HighLevelActionSet
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.state.state import State
from openhands.core.config import AgentConfig
diff --git a/agenthub/browsing_agent/prompt.py b/openhands/agenthub/browsing_agent/prompt.py
similarity index 99%
rename from agenthub/browsing_agent/prompt.py
rename to openhands/agenthub/browsing_agent/prompt.py
index ab7df24c5c..3541568419 100644
--- a/agenthub/browsing_agent/prompt.py
+++ b/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.python import PythonActionSet
-from agenthub.browsing_agent.utils import (
+from openhands.agenthub.browsing_agent.utils import (
ParseError,
parse_html_tags_raise,
)
diff --git a/agenthub/browsing_agent/response_parser.py b/openhands/agenthub/browsing_agent/response_parser.py
similarity index 100%
rename from agenthub/browsing_agent/response_parser.py
rename to openhands/agenthub/browsing_agent/response_parser.py
diff --git a/agenthub/browsing_agent/utils.py b/openhands/agenthub/browsing_agent/utils.py
similarity index 100%
rename from agenthub/browsing_agent/utils.py
rename to openhands/agenthub/browsing_agent/utils.py
diff --git a/agenthub/codeact_agent/README.md b/openhands/agenthub/codeact_agent/README.md
similarity index 100%
rename from agenthub/codeact_agent/README.md
rename to openhands/agenthub/codeact_agent/README.md
diff --git a/agenthub/codeact_agent/__init__.py b/openhands/agenthub/codeact_agent/__init__.py
similarity index 55%
rename from agenthub/codeact_agent/__init__.py
rename to openhands/agenthub/codeact_agent/__init__.py
index db780e24d0..63f1fdb820 100644
--- a/agenthub/codeact_agent/__init__.py
+++ b/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
Agent.register('CodeActAgent', CodeActAgent)
diff --git a/agenthub/codeact_agent/action_parser.py b/openhands/agenthub/codeact_agent/action_parser.py
similarity index 100%
rename from agenthub/codeact_agent/action_parser.py
rename to openhands/agenthub/codeact_agent/action_parser.py
diff --git a/agenthub/codeact_agent/codeact_agent.py b/openhands/agenthub/codeact_agent/codeact_agent.py
similarity index 99%
rename from agenthub/codeact_agent/codeact_agent.py
rename to openhands/agenthub/codeact_agent/codeact_agent.py
index d384ae5682..4db072395a 100644
--- a/agenthub/codeact_agent/codeact_agent.py
+++ b/openhands/agenthub/codeact_agent/codeact_agent.py
@@ -1,7 +1,7 @@
import os
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.state.state import State
from openhands.core.config import AgentConfig
diff --git a/agenthub/codeact_agent/micro/github.md b/openhands/agenthub/codeact_agent/micro/github.md
similarity index 100%
rename from agenthub/codeact_agent/micro/github.md
rename to openhands/agenthub/codeact_agent/micro/github.md
diff --git a/agenthub/codeact_agent/system_prompt.j2 b/openhands/agenthub/codeact_agent/system_prompt.j2
similarity index 100%
rename from agenthub/codeact_agent/system_prompt.j2
rename to openhands/agenthub/codeact_agent/system_prompt.j2
diff --git a/agenthub/codeact_agent/user_prompt.j2 b/openhands/agenthub/codeact_agent/user_prompt.j2
similarity index 100%
rename from agenthub/codeact_agent/user_prompt.j2
rename to openhands/agenthub/codeact_agent/user_prompt.j2
diff --git a/agenthub/codeact_swe_agent/README.md b/openhands/agenthub/codeact_swe_agent/README.md
similarity index 100%
rename from agenthub/codeact_swe_agent/README.md
rename to openhands/agenthub/codeact_swe_agent/README.md
diff --git a/agenthub/codeact_swe_agent/__init__.py b/openhands/agenthub/codeact_swe_agent/__init__.py
similarity index 53%
rename from agenthub/codeact_swe_agent/__init__.py
rename to openhands/agenthub/codeact_swe_agent/__init__.py
index b0b3d3aae9..ef52337861 100644
--- a/agenthub/codeact_swe_agent/__init__.py
+++ b/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
Agent.register('CodeActSWEAgent', CodeActSWEAgent)
diff --git a/agenthub/codeact_swe_agent/action_parser.py b/openhands/agenthub/codeact_swe_agent/action_parser.py
similarity index 100%
rename from agenthub/codeact_swe_agent/action_parser.py
rename to openhands/agenthub/codeact_swe_agent/action_parser.py
diff --git a/agenthub/codeact_swe_agent/codeact_swe_agent.py b/openhands/agenthub/codeact_swe_agent/codeact_swe_agent.py
similarity index 98%
rename from agenthub/codeact_swe_agent/codeact_swe_agent.py
rename to openhands/agenthub/codeact_swe_agent/codeact_swe_agent.py
index ac3efbe535..d35acb63c8 100644
--- a/agenthub/codeact_swe_agent/codeact_swe_agent.py
+++ b/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,
SWE_EXAMPLE,
SYSTEM_PREFIX,
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.state.state import State
from openhands.core.config import AgentConfig
diff --git a/agenthub/codeact_swe_agent/prompt.py b/openhands/agenthub/codeact_swe_agent/prompt.py
similarity index 100%
rename from agenthub/codeact_swe_agent/prompt.py
rename to openhands/agenthub/codeact_swe_agent/prompt.py
diff --git a/agenthub/codeact_swe_agent/response_parser.py b/openhands/agenthub/codeact_swe_agent/response_parser.py
similarity index 96%
rename from agenthub/codeact_swe_agent/response_parser.py
rename to openhands/agenthub/codeact_swe_agent/response_parser.py
index e96b4494a2..147b8655f8 100644
--- a/agenthub/codeact_swe_agent/response_parser.py
+++ b/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,
CodeActSWEActionParserFinish,
CodeActSWEActionParserIPythonRunCell,
diff --git a/agenthub/delegator_agent/__init__.py b/openhands/agenthub/delegator_agent/__init__.py
similarity index 58%
rename from agenthub/delegator_agent/__init__.py
rename to openhands/agenthub/delegator_agent/__init__.py
index 4c420816fd..68e20efa30 100644
--- a/agenthub/delegator_agent/__init__.py
+++ b/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
Agent.register('DelegatorAgent', DelegatorAgent)
diff --git a/agenthub/delegator_agent/agent.py b/openhands/agenthub/delegator_agent/agent.py
similarity index 100%
rename from agenthub/delegator_agent/agent.py
rename to openhands/agenthub/delegator_agent/agent.py
diff --git a/agenthub/dummy_agent/__init__.py b/openhands/agenthub/dummy_agent/__init__.py
similarity index 59%
rename from agenthub/dummy_agent/__init__.py
rename to openhands/agenthub/dummy_agent/__init__.py
index 5e7c39b7f5..d0db8e26c9 100644
--- a/agenthub/dummy_agent/__init__.py
+++ b/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
Agent.register('DummyAgent', DummyAgent)
diff --git a/agenthub/dummy_agent/agent.py b/openhands/agenthub/dummy_agent/agent.py
similarity index 100%
rename from agenthub/dummy_agent/agent.py
rename to openhands/agenthub/dummy_agent/agent.py
diff --git a/agenthub/micro/README.md b/openhands/agenthub/micro/README.md
similarity index 100%
rename from agenthub/micro/README.md
rename to openhands/agenthub/micro/README.md
diff --git a/agenthub/micro/_instructions/actions/browse.md b/openhands/agenthub/micro/_instructions/actions/browse.md
similarity index 100%
rename from agenthub/micro/_instructions/actions/browse.md
rename to openhands/agenthub/micro/_instructions/actions/browse.md
diff --git a/agenthub/micro/_instructions/actions/delegate.md b/openhands/agenthub/micro/_instructions/actions/delegate.md
similarity index 100%
rename from agenthub/micro/_instructions/actions/delegate.md
rename to openhands/agenthub/micro/_instructions/actions/delegate.md
diff --git a/agenthub/micro/_instructions/actions/finish.md b/openhands/agenthub/micro/_instructions/actions/finish.md
similarity index 100%
rename from agenthub/micro/_instructions/actions/finish.md
rename to openhands/agenthub/micro/_instructions/actions/finish.md
diff --git a/agenthub/micro/_instructions/actions/kill.md b/openhands/agenthub/micro/_instructions/actions/kill.md
similarity index 100%
rename from agenthub/micro/_instructions/actions/kill.md
rename to openhands/agenthub/micro/_instructions/actions/kill.md
diff --git a/agenthub/micro/_instructions/actions/message.md b/openhands/agenthub/micro/_instructions/actions/message.md
similarity index 100%
rename from agenthub/micro/_instructions/actions/message.md
rename to openhands/agenthub/micro/_instructions/actions/message.md
diff --git a/agenthub/micro/_instructions/actions/read.md b/openhands/agenthub/micro/_instructions/actions/read.md
similarity index 100%
rename from agenthub/micro/_instructions/actions/read.md
rename to openhands/agenthub/micro/_instructions/actions/read.md
diff --git a/agenthub/micro/_instructions/actions/reject.md b/openhands/agenthub/micro/_instructions/actions/reject.md
similarity index 100%
rename from agenthub/micro/_instructions/actions/reject.md
rename to openhands/agenthub/micro/_instructions/actions/reject.md
diff --git a/agenthub/micro/_instructions/actions/run.md b/openhands/agenthub/micro/_instructions/actions/run.md
similarity index 100%
rename from agenthub/micro/_instructions/actions/run.md
rename to openhands/agenthub/micro/_instructions/actions/run.md
diff --git a/agenthub/micro/_instructions/actions/write.md b/openhands/agenthub/micro/_instructions/actions/write.md
similarity index 100%
rename from agenthub/micro/_instructions/actions/write.md
rename to openhands/agenthub/micro/_instructions/actions/write.md
diff --git a/agenthub/micro/_instructions/format/action.md b/openhands/agenthub/micro/_instructions/format/action.md
similarity index 100%
rename from agenthub/micro/_instructions/format/action.md
rename to openhands/agenthub/micro/_instructions/format/action.md
diff --git a/agenthub/micro/_instructions/history_truncated.md b/openhands/agenthub/micro/_instructions/history_truncated.md
similarity index 100%
rename from agenthub/micro/_instructions/history_truncated.md
rename to openhands/agenthub/micro/_instructions/history_truncated.md
diff --git a/agenthub/micro/agent.py b/openhands/agenthub/micro/agent.py
similarity index 95%
rename from agenthub/micro/agent.py
rename to openhands/agenthub/micro/agent.py
index cac4ed78da..83225a3245 100644
--- a/agenthub/micro/agent.py
+++ b/openhands/agenthub/micro/agent.py
@@ -1,7 +1,7 @@
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.state.state import State
from openhands.core.config import AgentConfig
diff --git a/agenthub/micro/coder/agent.yaml b/openhands/agenthub/micro/coder/agent.yaml
similarity index 100%
rename from agenthub/micro/coder/agent.yaml
rename to openhands/agenthub/micro/coder/agent.yaml
diff --git a/agenthub/micro/coder/prompt.md b/openhands/agenthub/micro/coder/prompt.md
similarity index 100%
rename from agenthub/micro/coder/prompt.md
rename to openhands/agenthub/micro/coder/prompt.md
diff --git a/agenthub/micro/commit_writer/README.md b/openhands/agenthub/micro/commit_writer/README.md
similarity index 100%
rename from agenthub/micro/commit_writer/README.md
rename to openhands/agenthub/micro/commit_writer/README.md
diff --git a/agenthub/micro/commit_writer/agent.yaml b/openhands/agenthub/micro/commit_writer/agent.yaml
similarity index 100%
rename from agenthub/micro/commit_writer/agent.yaml
rename to openhands/agenthub/micro/commit_writer/agent.yaml
diff --git a/agenthub/micro/commit_writer/prompt.md b/openhands/agenthub/micro/commit_writer/prompt.md
similarity index 100%
rename from agenthub/micro/commit_writer/prompt.md
rename to openhands/agenthub/micro/commit_writer/prompt.md
diff --git a/agenthub/micro/instructions.py b/openhands/agenthub/micro/instructions.py
similarity index 100%
rename from agenthub/micro/instructions.py
rename to openhands/agenthub/micro/instructions.py
diff --git a/agenthub/micro/manager/agent.yaml b/openhands/agenthub/micro/manager/agent.yaml
similarity index 100%
rename from agenthub/micro/manager/agent.yaml
rename to openhands/agenthub/micro/manager/agent.yaml
diff --git a/agenthub/micro/manager/prompt.md b/openhands/agenthub/micro/manager/prompt.md
similarity index 100%
rename from agenthub/micro/manager/prompt.md
rename to openhands/agenthub/micro/manager/prompt.md
diff --git a/agenthub/micro/math_agent/agent.yaml b/openhands/agenthub/micro/math_agent/agent.yaml
similarity index 100%
rename from agenthub/micro/math_agent/agent.yaml
rename to openhands/agenthub/micro/math_agent/agent.yaml
diff --git a/agenthub/micro/math_agent/prompt.md b/openhands/agenthub/micro/math_agent/prompt.md
similarity index 100%
rename from agenthub/micro/math_agent/prompt.md
rename to openhands/agenthub/micro/math_agent/prompt.md
diff --git a/agenthub/micro/postgres_agent/agent.yaml b/openhands/agenthub/micro/postgres_agent/agent.yaml
similarity index 100%
rename from agenthub/micro/postgres_agent/agent.yaml
rename to openhands/agenthub/micro/postgres_agent/agent.yaml
diff --git a/agenthub/micro/postgres_agent/prompt.md b/openhands/agenthub/micro/postgres_agent/prompt.md
similarity index 100%
rename from agenthub/micro/postgres_agent/prompt.md
rename to openhands/agenthub/micro/postgres_agent/prompt.md
diff --git a/agenthub/micro/registry.py b/openhands/agenthub/micro/registry.py
similarity index 100%
rename from agenthub/micro/registry.py
rename to openhands/agenthub/micro/registry.py
diff --git a/agenthub/micro/repo_explorer/agent.yaml b/openhands/agenthub/micro/repo_explorer/agent.yaml
similarity index 100%
rename from agenthub/micro/repo_explorer/agent.yaml
rename to openhands/agenthub/micro/repo_explorer/agent.yaml
diff --git a/agenthub/micro/repo_explorer/prompt.md b/openhands/agenthub/micro/repo_explorer/prompt.md
similarity index 100%
rename from agenthub/micro/repo_explorer/prompt.md
rename to openhands/agenthub/micro/repo_explorer/prompt.md
diff --git a/agenthub/micro/study_repo_for_task/agent.yaml b/openhands/agenthub/micro/study_repo_for_task/agent.yaml
similarity index 100%
rename from agenthub/micro/study_repo_for_task/agent.yaml
rename to openhands/agenthub/micro/study_repo_for_task/agent.yaml
diff --git a/agenthub/micro/study_repo_for_task/prompt.md b/openhands/agenthub/micro/study_repo_for_task/prompt.md
similarity index 100%
rename from agenthub/micro/study_repo_for_task/prompt.md
rename to openhands/agenthub/micro/study_repo_for_task/prompt.md
diff --git a/agenthub/micro/typo_fixer_agent/agent.yaml b/openhands/agenthub/micro/typo_fixer_agent/agent.yaml
similarity index 100%
rename from agenthub/micro/typo_fixer_agent/agent.yaml
rename to openhands/agenthub/micro/typo_fixer_agent/agent.yaml
diff --git a/agenthub/micro/typo_fixer_agent/prompt.md b/openhands/agenthub/micro/typo_fixer_agent/prompt.md
similarity index 100%
rename from agenthub/micro/typo_fixer_agent/prompt.md
rename to openhands/agenthub/micro/typo_fixer_agent/prompt.md
diff --git a/agenthub/micro/verifier/agent.yaml b/openhands/agenthub/micro/verifier/agent.yaml
similarity index 100%
rename from agenthub/micro/verifier/agent.yaml
rename to openhands/agenthub/micro/verifier/agent.yaml
diff --git a/agenthub/micro/verifier/prompt.md b/openhands/agenthub/micro/verifier/prompt.md
similarity index 100%
rename from agenthub/micro/verifier/prompt.md
rename to openhands/agenthub/micro/verifier/prompt.md
diff --git a/agenthub/planner_agent/__init__.py b/openhands/agenthub/planner_agent/__init__.py
similarity index 58%
rename from agenthub/planner_agent/__init__.py
rename to openhands/agenthub/planner_agent/__init__.py
index 3b97ae3b3c..e8c030e84c 100644
--- a/agenthub/planner_agent/__init__.py
+++ b/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
Agent.register('PlannerAgent', PlannerAgent)
diff --git a/agenthub/planner_agent/agent.py b/openhands/agenthub/planner_agent/agent.py
similarity index 92%
rename from agenthub/planner_agent/agent.py
rename to openhands/agenthub/planner_agent/agent.py
index a640ea354b..f5aef523d9 100644
--- a/agenthub/planner_agent/agent.py
+++ b/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.state.state import State
from openhands.core.config import AgentConfig
diff --git a/agenthub/planner_agent/prompt.py b/openhands/agenthub/planner_agent/prompt.py
similarity index 100%
rename from agenthub/planner_agent/prompt.py
rename to openhands/agenthub/planner_agent/prompt.py
diff --git a/agenthub/planner_agent/response_parser.py b/openhands/agenthub/planner_agent/response_parser.py
similarity index 100%
rename from agenthub/planner_agent/response_parser.py
rename to openhands/agenthub/planner_agent/response_parser.py
diff --git a/openhands/core/cli.py b/openhands/core/cli.py
index 9f978c26c9..5bdd976858 100644
--- a/openhands/core/cli.py
+++ b/openhands/core/cli.py
@@ -4,7 +4,7 @@ from typing import Type
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.controller import AgentController
from openhands.controller.agent import Agent
diff --git a/openhands/core/download.py b/openhands/core/download.py
index 32ed85e665..7d2392a63a 100644
--- a/openhands/core/download.py
+++ b/openhands/core/download.py
@@ -1,2 +1,2 @@
# 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)
diff --git a/openhands/core/main.py b/openhands/core/main.py
index b99dd0350a..adda15aeab 100644
--- a/openhands/core/main.py
+++ b/openhands/core/main.py
@@ -4,7 +4,7 @@ import sys
import uuid
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.agent import Agent
from openhands.controller.state.state import State
@@ -66,7 +66,7 @@ def create_runtime(
event_stream = EventStream(session_id, file_store)
# 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_cls = get_runtime_cls(config.runtime)
diff --git a/openhands/server/listen.py b/openhands/server/listen.py
index 8587722f93..2b1144128a 100644
--- a/openhands/server/listen.py
+++ b/openhands/server/listen.py
@@ -34,7 +34,7 @@ from fastapi.security import HTTPBearer
from fastapi.staticfiles import StaticFiles
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.core.config import LLMConfig, load_app_config
from openhands.core.logger import openhands_logger as logger
diff --git a/pyproject.toml b/pyproject.toml
index de9d09d0bc..a965a634d6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,7 +8,6 @@ readme = "README.md"
repository = "https://github.com/All-Hands-AI/OpenHands"
include = ["poetry.lock"]
packages = [
- { include = "agenthub/**/*" },
{ include = "openhands/**/*" }
]
@@ -86,6 +85,7 @@ reportlab = "*"
[tool.coverage.run]
concurrency = ["gevent"]
+
[tool.poetry.group.runtime.dependencies]
jupyterlab = "*"
notebook = "*"
@@ -116,6 +116,7 @@ ignore = ["D1"]
[tool.ruff.lint.pydocstyle]
convention = "google"
+
[tool.poetry.group.evaluation.dependencies]
streamlit = "*"
whatthepatch = "*"
diff --git a/tests/integration/regenerate.sh b/tests/integration/regenerate.sh
index 916038640b..5e5253de40 100755
--- a/tests/integration/regenerate.sh
+++ b/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"
# Check if TEST_IN_CI is defined
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
env SCRIPT_DIR="$SCRIPT_DIR" \
diff --git a/tests/unit/test_browsing_agent_parser.py b/tests/unit/test_browsing_agent_parser.py
index bc1372611c..011ebb6b32 100644
--- a/tests/unit/test_browsing_agent_parser.py
+++ b/tests/unit/test_browsing_agent_parser.py
@@ -1,6 +1,6 @@
import pytest
-from agenthub.browsing_agent.response_parser import (
+from openhands.agenthub.browsing_agent.response_parser import (
BrowseInteractiveAction,
BrowsingResponseParser,
)
diff --git a/tests/unit/test_codeact_agent.py b/tests/unit/test_codeact_agent.py
index a5a6f9d022..55dfa3feb7 100644
--- a/tests/unit/test_codeact_agent.py
+++ b/tests/unit/test_codeact_agent.py
@@ -2,7 +2,7 @@ from unittest.mock import Mock
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.message import TextContent
from openhands.events.observation.commands import (
diff --git a/tests/unit/test_micro_agents.py b/tests/unit/test_micro_agents.py
index 7eb87babd3..70553d8511 100644
--- a/tests/unit/test_micro_agents.py
+++ b/tests/unit/test_micro_agents.py
@@ -6,7 +6,7 @@ import pytest
import yaml
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.state.state import State
from openhands.core.config import AgentConfig
@@ -44,7 +44,7 @@ def test_all_agents_are_loaded():
assert all_microagents is not None
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
agent_names = set()
for root, _, files in os.walk(full_path):
diff --git a/tests/unit/test_microagent_utils.py b/tests/unit/test_microagent_utils.py
index 27319e9d9f..26f6523c0b 100644
--- a/tests/unit/test_microagent_utils.py
+++ b/tests/unit/test_microagent_utils.py
@@ -3,7 +3,7 @@ import os
import pytest
from pytest import MonkeyPatch
-import agenthub # noqa: F401
+import openhands.agenthub # noqa: F401
from openhands.core.exceptions import (
AgentNotRegisteredError,
MicroAgentValidationError,
diff --git a/tests/unit/test_prompt_caching.py b/tests/unit/test_prompt_caching.py
index 7acf014130..41dc756187 100644
--- a/tests/unit/test_prompt_caching.py
+++ b/tests/unit/test_prompt_caching.py
@@ -2,7 +2,7 @@ from unittest.mock import MagicMock, Mock, patch
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.events import EventSource, EventStream
from openhands.events.action import CmdRunAction, MessageAction
diff --git a/tests/unit/test_prompt_manager.py b/tests/unit/test_prompt_manager.py
index 8eda03b77c..2534f73d3a 100644
--- a/tests/unit/test_prompt_manager.py
+++ b/tests/unit/test_prompt_manager.py
@@ -10,8 +10,8 @@ from openhands.utils.prompt import PromptManager
@pytest.fixture
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 tmp_path
diff --git a/tests/unit/test_response_parsing.py b/tests/unit/test_response_parsing.py
index 673caab079..02710f4898 100644
--- a/tests/unit/test_response_parsing.py
+++ b/tests/unit/test_response_parsing.py
@@ -1,7 +1,9 @@
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.utils.json import loads as custom_loads
from openhands.events.action import (
diff --git a/tests/unit/test_runtime_build.py b/tests/unit/test_runtime_build.py
index 48619942d2..867305fd59 100644
--- a/tests/unit/test_runtime_build.py
+++ b/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
assert set(os.listdir(code_dir)) == {
- 'agenthub',
'openhands',
'pyproject.toml',
'poetry.lock',