hud-python 0.1.4__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hud-python might be problematic. Click here for more details.

Files changed (126) hide show
  1. {hud_python-0.1.4 → hud_python-0.2.0}/.github/workflows/ci.yml +1 -1
  2. {hud_python-0.1.4 → hud_python-0.2.0}/.gitignore +1 -1
  3. {hud_python-0.1.4 → hud_python-0.2.0}/LICENSE +1 -1
  4. hud_python-0.2.0/PKG-INFO +188 -0
  5. hud_python-0.2.0/README.md +129 -0
  6. hud_python-0.2.0/docs/advanced/cla-details.mdx +92 -0
  7. hud_python-0.2.0/docs/advanced/custom-environments.mdx +96 -0
  8. hud_python-0.2.0/docs/advanced/environment-control.mdx +100 -0
  9. hud_python-0.2.0/docs/api/reference/adapters.mdx +201 -0
  10. hud_python-0.2.0/docs/api-reference/adapters.mdx +109 -0
  11. hud_python-0.2.0/docs/api-reference/env.mdx +97 -0
  12. hud_python-0.2.0/docs/api-reference/gym.mdx +36 -0
  13. hud_python-0.2.0/docs/api-reference/job.mdx +107 -0
  14. hud_python-0.2.0/docs/api-reference/task.mdx +43 -0
  15. hud_python-0.2.0/docs/api-reference/taskset.mdx +76 -0
  16. hud_python-0.2.0/docs/api-reference/trajectory.mdx +58 -0
  17. hud_python-0.2.0/docs/concepts/adapter.mdx +62 -0
  18. hud_python-0.2.0/docs/concepts/agent.mdx +62 -0
  19. hud_python-0.2.0/docs/concepts/environment.mdx +99 -0
  20. hud_python-0.2.0/docs/concepts/job.mdx +100 -0
  21. hud_python-0.2.0/docs/concepts/task.mdx +102 -0
  22. hud_python-0.2.0/docs/concepts/trajectory.mdx +73 -0
  23. hud_python-0.2.0/docs/docs.json +72 -0
  24. hud_python-0.2.0/docs/examples/basic.mdx +140 -0
  25. hud_python-0.2.0/docs/examples/claude-agent.mdx +98 -0
  26. {hud_python-0.1.4 → hud_python-0.2.0}/docs/examples/custom-agent.mdx +28 -48
  27. hud_python-0.2.0/docs/favicon.png +0 -0
  28. hud_python-0.2.0/docs/installation.mdx +59 -0
  29. hud_python-0.2.0/docs/logo/HUD-light-optimized.svg +5 -0
  30. hud_python-0.2.0/docs/quickstart.mdx +130 -0
  31. hud_python-0.2.0/environments/novnc_ubuntu/Dockerfile +1 -0
  32. hud_python-0.2.0/environments/novnc_ubuntu/pyproject.toml +17 -0
  33. hud_python-0.2.0/environments/novnc_ubuntu/src/novnc_ubuntu/__init__.py +6 -0
  34. hud_python-0.2.0/environments/novnc_ubuntu/src/novnc_ubuntu/pyautogui_rosetta.py +365 -0
  35. hud_python-0.2.0/environments/novnc_ubuntu/src/novnc_ubuntu/step.py +35 -0
  36. hud_python-0.2.0/environments/qa_controller/Dockerfile +16 -0
  37. hud_python-0.2.0/environments/qa_controller/pyproject.toml +15 -0
  38. hud_python-0.2.0/environments/qa_controller/src/qa_controller/__init__.py +3 -0
  39. hud_python-0.2.0/environments/qa_controller/src/qa_controller/evaluate/__init__.py +6 -0
  40. hud_python-0.2.0/environments/qa_controller/src/qa_controller/evaluate/matchers.py +135 -0
  41. hud_python-0.2.0/environments/qa_controller/src/qa_controller/info.py +76 -0
  42. hud_python-0.2.0/environments/qa_controller/src/qa_controller/setup/__init__.py +8 -0
  43. hud_python-0.2.0/environments/qa_controller/src/qa_controller/setup/question.py +43 -0
  44. hud_python-0.2.0/environments/qa_controller/src/qa_controller/step.py +46 -0
  45. hud_python-0.2.0/environments/qa_controller/src/qa_controller/utils/__init__.py +1 -0
  46. hud_python-0.2.0/environments/qa_controller/src/qa_controller/utils/state.py +43 -0
  47. hud_python-0.2.0/examples/README.md +32 -0
  48. hud_python-0.2.0/examples/browser_use.ipynb +324 -0
  49. hud_python-0.2.0/examples/jobs.ipynb +74 -0
  50. hud_python-0.2.0/examples/local.ipynb +73 -0
  51. hud_python-0.2.0/examples/osworld.ipynb +238 -0
  52. hud_python-0.2.0/examples/tasks.ipynb +117 -0
  53. hud_python-0.2.0/hud/__init__.py +26 -0
  54. hud_python-0.2.0/hud/adapters/__init__.py +7 -0
  55. {hud_python-0.1.4 → hud_python-0.2.0}/hud/adapters/claude/adapter.py +0 -1
  56. {hud_python-0.1.4 → hud_python-0.2.0}/hud/adapters/common/adapter.py +11 -10
  57. {hud_python-0.1.4 → hud_python-0.2.0}/hud/adapters/common/types.py +27 -13
  58. hud_python-0.2.0/hud/adapters/operator/__init__.py +5 -0
  59. hud_python-0.2.0/hud/adapters/operator/adapter.py +93 -0
  60. hud_python-0.2.0/hud/agent/__init__.py +7 -0
  61. hud_python-0.2.0/hud/agent/base.py +109 -0
  62. hud_python-0.2.0/hud/agent/claude.py +187 -0
  63. hud_python-0.2.0/hud/agent/operator.py +190 -0
  64. hud_python-0.2.0/hud/env/__init__.py +11 -0
  65. hud_python-0.2.0/hud/env/client.py +35 -0
  66. hud_python-0.2.0/hud/env/docker_client.py +306 -0
  67. hud_python-0.2.0/hud/env/environment.py +181 -0
  68. hud_python-0.2.0/hud/env/local_docker_client.py +249 -0
  69. hud_python-0.2.0/hud/env/remote_client.py +185 -0
  70. hud_python-0.2.0/hud/env/remote_docker_client.py +221 -0
  71. hud_python-0.2.0/hud/evaluators/__init__.py +10 -0
  72. hud_python-0.2.0/hud/evaluators/base.py +31 -0
  73. hud_python-0.2.0/hud/evaluators/inspect.py +29 -0
  74. hud_python-0.2.0/hud/evaluators/judge.py +213 -0
  75. hud_python-0.2.0/hud/evaluators/match.py +163 -0
  76. hud_python-0.2.0/hud/evaluators/remote.py +78 -0
  77. hud_python-0.2.0/hud/gym.py +108 -0
  78. hud_python-0.2.0/hud/job.py +185 -0
  79. hud_python-0.2.0/hud/server/__init__.py +5 -0
  80. {hud_python-0.1.4 → hud_python-0.2.0}/hud/server/requests.py +87 -0
  81. {hud_python-0.1.4 → hud_python-0.2.0}/hud/settings.py +13 -2
  82. hud_python-0.2.0/hud/task.py +133 -0
  83. hud_python-0.2.0/hud/taskset.py +95 -0
  84. hud_python-0.2.0/hud/trajectory.py +90 -0
  85. hud_python-0.2.0/hud/types.py +65 -0
  86. hud_python-0.2.0/hud/utils/__init__.py +7 -0
  87. hud_python-0.2.0/hud/utils/common.py +69 -0
  88. hud_python-0.2.0/hud/utils/config.py +185 -0
  89. hud_python-0.2.0/hud/utils/telemetry.py +67 -0
  90. {hud_python-0.1.4 → hud_python-0.2.0}/pyproject.toml +15 -7
  91. {hud_python-0.1.4 → hud_python-0.2.0}/tests/test_import.py +1 -1
  92. hud_python-0.1.4/PKG-INFO +0 -125
  93. hud_python-0.1.4/README.md +0 -68
  94. hud_python-0.1.4/agent/base.py +0 -10
  95. hud_python-0.1.4/agent/claude.py +0 -152
  96. hud_python-0.1.4/agent/response_agent.py +0 -53
  97. hud_python-0.1.4/docs/api-reference/adapters.mdx +0 -178
  98. hud_python-0.1.4/docs/api-reference/client.mdx +0 -183
  99. hud_python-0.1.4/docs/api-reference/env.mdx +0 -159
  100. hud_python-0.1.4/docs/concepts/adapter.mdx +0 -69
  101. hud_python-0.1.4/docs/concepts/client.mdx +0 -32
  102. hud_python-0.1.4/docs/concepts/environment.mdx +0 -93
  103. hud_python-0.1.4/docs/concepts/gym.mdx +0 -48
  104. hud_python-0.1.4/docs/installation.mdx +0 -63
  105. hud_python-0.1.4/docs/introduction.mdx +0 -24
  106. hud_python-0.1.4/docs/mint.json +0 -85
  107. hud_python-0.1.4/docs/quickstart.mdx +0 -150
  108. hud_python-0.1.4/examples/README.md +0 -44
  109. hud_python-0.1.4/examples/claude_osworld.ipynb +0 -202
  110. hud_python-0.1.4/hud/__init__.py +0 -22
  111. hud_python-0.1.4/hud/adapters/__init__.py +0 -5
  112. hud_python-0.1.4/hud/client.py +0 -200
  113. hud_python-0.1.4/hud/environment.py +0 -317
  114. hud_python-0.1.4/hud/gym.py +0 -22
  115. hud_python-0.1.4/hud/run.py +0 -208
  116. hud_python-0.1.4/hud/server/__init__.py +0 -5
  117. hud_python-0.1.4/hud/utils/__init__.py +0 -5
  118. hud_python-0.1.4/hud/utils/config.py +0 -7
  119. {hud_python-0.1.4 → hud_python-0.2.0}/.env.example +0 -0
  120. {hud_python-0.1.4 → hud_python-0.2.0}/.github/workflows/release.yml +0 -0
  121. {hud_python-0.1.4 → hud_python-0.2.0}/MANIFEST.in +0 -0
  122. {hud_python-0.1.4 → hud_python-0.2.0}/docs/logo/HUD.svg +0 -0
  123. {hud_python-0.1.4 → hud_python-0.2.0}/hud/adapters/claude/__init__.py +0 -0
  124. {hud_python-0.1.4 → hud_python-0.2.0}/hud/adapters/common/__init__.py +0 -0
  125. {hud_python-0.1.4 → hud_python-0.2.0}/hud/py.typed +0 -0
  126. {hud_python-0.1.4 → hud_python-0.2.0}/tests/__init__.py +0 -0
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
14
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
15
15
 
16
16
  steps:
17
17
  - name: Check out code
@@ -1,4 +1,5 @@
1
1
  .venv
2
+ .vscode
2
3
  venv
3
4
  .env
4
5
  __pycache__
@@ -10,7 +11,6 @@ build/
10
11
  uv.lock
11
12
 
12
13
  # Media files
13
- *.png
14
14
  *.jpg
15
15
  *.jpeg
16
16
  *.gif
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Human Data Company
3
+ Copyright (c) 2025 Human Union Data, Inc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,188 @@
1
+ Metadata-Version: 2.4
2
+ Name: hud-python
3
+ Version: 0.2.0
4
+ Summary: SDK for the HUD evaluation platform.
5
+ Project-URL: Homepage, https://github.com/Human-Data/hud-sdk
6
+ Project-URL: Bug Tracker, https://github.com/Human-Data/hud-sdk/issues
7
+ Project-URL: Documentation, https://hud.so
8
+ Author-email: Human Union Data SDK <founders@hud.so>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2025 Human Union Data, Inc
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Classifier: Development Status :: 4 - Beta
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Programming Language :: Python :: 3.13
38
+ Requires-Python: <3.14,>=3.10
39
+ Requires-Dist: aiodocker>=0.24.0
40
+ Requires-Dist: httpx<1,>=0.23.0
41
+ Requires-Dist: inspect-ai>=0.3.80
42
+ Requires-Dist: pillow>=11.1.0
43
+ Requires-Dist: pydantic-settings<3,>=2
44
+ Requires-Dist: pydantic<3,>=2
45
+ Requires-Dist: textdistance<5,>=4.5.0
46
+ Requires-Dist: toml>=0.10.2
47
+ Provides-Extra: dev
48
+ Requires-Dist: anthropic; extra == 'dev'
49
+ Requires-Dist: dotenv; extra == 'dev'
50
+ Requires-Dist: ipykernel; extra == 'dev'
51
+ Requires-Dist: ipython<9; extra == 'dev'
52
+ Requires-Dist: jupyter-client; extra == 'dev'
53
+ Requires-Dist: jupyter-core; extra == 'dev'
54
+ Requires-Dist: openai; extra == 'dev'
55
+ Requires-Dist: pyright==1.1.364; extra == 'dev'
56
+ Requires-Dist: pytest<9,>=8.1.1; extra == 'dev'
57
+ Requires-Dist: ruff==0.9.8; extra == 'dev'
58
+ Description-Content-Type: text/markdown
59
+
60
+ # HUD SDK - Human-Agent Interaction Toolkit
61
+
62
+ A Python SDK for creating, evaluating, and benchmarking agent interactions with web browsers and OS environments.
63
+
64
+ > **Early Release Notice**: This SDK is currently in early release status. The API is evolving and may change in future releases as we gather feedback and improve functionality.
65
+
66
+ [![PyPI version](https://img.shields.io/pypi/v/hud-python)](https://pypi.org/project/hud-python/)
67
+
68
+ [📚 Documentation](https://documentation.hud.so) | [🏠 Homepage](https://hud.so)
69
+
70
+ ## API Key Setup
71
+
72
+ Before getting started, you'll need to obtain an API key:
73
+
74
+ 1. Visit [app.hud.so](https://app.hud.so) to create a free account and generate your API key
75
+ 2. Set it in your environment or .env file:
76
+
77
+ ```bash
78
+ export HUD_API_KEY=your_api_key_here
79
+ ```
80
+
81
+ ## Quick Start
82
+
83
+ ### Installation
84
+
85
+ ```bash
86
+ pip install hud-python
87
+ ```
88
+
89
+ ### Simple Browser Example with Operator
90
+
91
+ > This example uses the `@job("test-run")` decorator, so the results of this run will appear under the job named "test-run" on the your [HUD Jobs page](https://app.hud.so/jobs).
92
+
93
+ ```python
94
+ import os
95
+ import asyncio
96
+ from hud import gym, job
97
+ from hud.task import Task
98
+ from hud.utils import stream
99
+ from hud.agent import OperatorAgent
100
+
101
+ @job("test-run")
102
+ async def main():
103
+ # Define a simple task
104
+ task = Task(
105
+ prompt="Insert the text 'capybara' into the search bar",
106
+ gym="hud-browser",
107
+ setup=("goto", "google.com"),
108
+ evaluate=("contains_text", "capybara")
109
+ )
110
+
111
+ # Create environment
112
+ env = await gym.make(task)
113
+
114
+ # Get URLs and display live view (optional)
115
+ # urls = await env.get_urls()
116
+ # stream(urls["live_url"])
117
+
118
+ # Initialize Operator agent (API key is loaded automatically)
119
+ agent = OperatorAgent()
120
+
121
+ # Agent loop
122
+ obs, _ = env.reset()
123
+ for i in range(5):
124
+ actions, done = await agent.predict(obs)
125
+ if done:
126
+ break
127
+
128
+ obs, reward, terminated, info = await env.step(actions)
129
+ if terminated:
130
+ break
131
+
132
+ # Evaluate and close
133
+ result = await env.evaluate()
134
+ print(f"Evaluation result: {result}")
135
+ await env.close()
136
+
137
+ if __name__ == "__main__":
138
+ asyncio.run(main())
139
+
140
+ ```
141
+
142
+ ## Documentation Sections
143
+
144
+ Explore the core concepts and features of the SDK:
145
+
146
+ * **[Tasks and TaskSets](/concepts/task)**: Define goals, context, setup, and evaluation criteria for agent scenarios.
147
+ * **[Environments](/concepts/environment)**: Understand the browser and OS runtimes where agents interact.
148
+ * **[Agents](/concepts/agent)**: Learn about the agent architecture (Claude, Operator) and how they process observations and predict actions.
149
+ * **[Adapters](/concepts/adapter)**: See how actions and observations are translated between agents and environments.
150
+ * **[Jobs](/concepts/job)**: Group related runs for analysis and viewing on the HUD platform.
151
+ * **[Trajectories](/concepts/trajectory)**: Understand the recorded data from each agent run.
152
+ * **Advanced Topics**:
153
+ * **[Custom Environments](/advanced/custom-environments)**: Build your own Docker-based local or remote environments.
154
+ * **[Advanced Environment Control](/advanced/environment-control)**: Use `invoke`, `execute`, and `_setup` for finer control.
155
+ * **[CLA Action Details](/advanced/cla-details)**: Dive deeper into the standardized action format.
156
+
157
+ * **[Full API Reference](/api-reference/gym)**: Detailed specifications for all modules and classes.
158
+
159
+ ## [Examples](examples/)
160
+
161
+ We provide several example notebooks showing how to use the HUD SDK:
162
+
163
+ 1. [Browser Basics](examples/browser_use.ipynb) - Simple browser interaction with live view
164
+ 2. [Task Design](examples/tasks.ipynb) - Creating and customizing tasks
165
+ 3. [OSWorld](examples/osworld.ipynb) - Working with OS environments
166
+ 4. [Local Development](examples/local.ipynb) - Setting up local custom environments
167
+
168
+ ## Documentation
169
+
170
+ For comprehensive guides, examples, and API reference, visit [our docs](https://docs.hud.so/introduction)
171
+
172
+ ## License
173
+
174
+ [MIT License](LICENSE)
175
+
176
+ ## Citation
177
+
178
+ If you use this SDK in your research, please cite it as follows:
179
+
180
+ ```bibtex
181
+ @software{hud2025agentevalplatform,
182
+ author = {HUD and Jay Ram and Lorenss Martinsons and Parth Patel and Max Muoto and Oskars Putans and Govind Pimpale and Mayank Singamreddy and Nguyen Nhat Minh},
183
+ title = {{HUD: An Evaluation Platform for Computer Use Agents}},
184
+ date = {2025-03},
185
+ url = {https://github.com/Human-Data/hud-sdk},
186
+ langid = {en}
187
+ }
188
+ ```
@@ -0,0 +1,129 @@
1
+ # HUD SDK - Human-Agent Interaction Toolkit
2
+
3
+ A Python SDK for creating, evaluating, and benchmarking agent interactions with web browsers and OS environments.
4
+
5
+ > **Early Release Notice**: This SDK is currently in early release status. The API is evolving and may change in future releases as we gather feedback and improve functionality.
6
+
7
+ [![PyPI version](https://img.shields.io/pypi/v/hud-python)](https://pypi.org/project/hud-python/)
8
+
9
+ [📚 Documentation](https://documentation.hud.so) | [🏠 Homepage](https://hud.so)
10
+
11
+ ## API Key Setup
12
+
13
+ Before getting started, you'll need to obtain an API key:
14
+
15
+ 1. Visit [app.hud.so](https://app.hud.so) to create a free account and generate your API key
16
+ 2. Set it in your environment or .env file:
17
+
18
+ ```bash
19
+ export HUD_API_KEY=your_api_key_here
20
+ ```
21
+
22
+ ## Quick Start
23
+
24
+ ### Installation
25
+
26
+ ```bash
27
+ pip install hud-python
28
+ ```
29
+
30
+ ### Simple Browser Example with Operator
31
+
32
+ > This example uses the `@job("test-run")` decorator, so the results of this run will appear under the job named "test-run" on the your [HUD Jobs page](https://app.hud.so/jobs).
33
+
34
+ ```python
35
+ import os
36
+ import asyncio
37
+ from hud import gym, job
38
+ from hud.task import Task
39
+ from hud.utils import stream
40
+ from hud.agent import OperatorAgent
41
+
42
+ @job("test-run")
43
+ async def main():
44
+ # Define a simple task
45
+ task = Task(
46
+ prompt="Insert the text 'capybara' into the search bar",
47
+ gym="hud-browser",
48
+ setup=("goto", "google.com"),
49
+ evaluate=("contains_text", "capybara")
50
+ )
51
+
52
+ # Create environment
53
+ env = await gym.make(task)
54
+
55
+ # Get URLs and display live view (optional)
56
+ # urls = await env.get_urls()
57
+ # stream(urls["live_url"])
58
+
59
+ # Initialize Operator agent (API key is loaded automatically)
60
+ agent = OperatorAgent()
61
+
62
+ # Agent loop
63
+ obs, _ = env.reset()
64
+ for i in range(5):
65
+ actions, done = await agent.predict(obs)
66
+ if done:
67
+ break
68
+
69
+ obs, reward, terminated, info = await env.step(actions)
70
+ if terminated:
71
+ break
72
+
73
+ # Evaluate and close
74
+ result = await env.evaluate()
75
+ print(f"Evaluation result: {result}")
76
+ await env.close()
77
+
78
+ if __name__ == "__main__":
79
+ asyncio.run(main())
80
+
81
+ ```
82
+
83
+ ## Documentation Sections
84
+
85
+ Explore the core concepts and features of the SDK:
86
+
87
+ * **[Tasks and TaskSets](/concepts/task)**: Define goals, context, setup, and evaluation criteria for agent scenarios.
88
+ * **[Environments](/concepts/environment)**: Understand the browser and OS runtimes where agents interact.
89
+ * **[Agents](/concepts/agent)**: Learn about the agent architecture (Claude, Operator) and how they process observations and predict actions.
90
+ * **[Adapters](/concepts/adapter)**: See how actions and observations are translated between agents and environments.
91
+ * **[Jobs](/concepts/job)**: Group related runs for analysis and viewing on the HUD platform.
92
+ * **[Trajectories](/concepts/trajectory)**: Understand the recorded data from each agent run.
93
+ * **Advanced Topics**:
94
+ * **[Custom Environments](/advanced/custom-environments)**: Build your own Docker-based local or remote environments.
95
+ * **[Advanced Environment Control](/advanced/environment-control)**: Use `invoke`, `execute`, and `_setup` for finer control.
96
+ * **[CLA Action Details](/advanced/cla-details)**: Dive deeper into the standardized action format.
97
+
98
+ * **[Full API Reference](/api-reference/gym)**: Detailed specifications for all modules and classes.
99
+
100
+ ## [Examples](examples/)
101
+
102
+ We provide several example notebooks showing how to use the HUD SDK:
103
+
104
+ 1. [Browser Basics](examples/browser_use.ipynb) - Simple browser interaction with live view
105
+ 2. [Task Design](examples/tasks.ipynb) - Creating and customizing tasks
106
+ 3. [OSWorld](examples/osworld.ipynb) - Working with OS environments
107
+ 4. [Local Development](examples/local.ipynb) - Setting up local custom environments
108
+
109
+ ## Documentation
110
+
111
+ For comprehensive guides, examples, and API reference, visit [our docs](https://docs.hud.so/introduction)
112
+
113
+ ## License
114
+
115
+ [MIT License](LICENSE)
116
+
117
+ ## Citation
118
+
119
+ If you use this SDK in your research, please cite it as follows:
120
+
121
+ ```bibtex
122
+ @software{hud2025agentevalplatform,
123
+ author = {HUD and Jay Ram and Lorenss Martinsons and Parth Patel and Max Muoto and Oskars Putans and Govind Pimpale and Mayank Singamreddy and Nguyen Nhat Minh},
124
+ title = {{HUD: An Evaluation Platform for Computer Use Agents}},
125
+ date = {2025-03},
126
+ url = {https://github.com/Human-Data/hud-sdk},
127
+ langid = {en}
128
+ }
129
+ ```
@@ -0,0 +1,92 @@
1
+ ---
2
+ title: 'CLA Action Details'
3
+ description: 'Detailed look at the Common Language Action (CLA) format'
4
+ ---
5
+
6
+ # Common Language Action (CLA) Details
7
+
8
+ The HUD SDK uses a standardized format called **CLA** (Common Language Actions) for representing agent interactions within an [Environment](/concepts/environment). When your [Agent](/concepts/agent) decides on an action (e.g., "click at x=100, y=200"), its associated [Adapter](/concepts/adapter) converts this into a specific `CLA` Pydantic model instance before it's sent to `env.step()`.
9
+
10
+ Understanding the structure of these `CLA` types can be helpful for debugging or creating custom adapters/controllers. The main types are defined in `hud.adapters.common.types`.
11
+
12
+ ## Base Structure
13
+
14
+ All CLA actions inherit from `CLAAction` and have a `type` field which acts as a discriminator:
15
+
16
+ ```python
17
+ class CLAAction(pydantic.BaseModel):
18
+ type: str
19
+ ```
20
+
21
+ ## Action Categories & Examples
22
+
23
+ Here are some key CLA types grouped by category:
24
+
25
+ ### Mouse Actions
26
+
27
+ * **`ClickAction`**: Simulates mouse clicks.
28
+ * `point: Point | None`: Target coordinates (`Point(x: int, y: int)`).
29
+ * `button: Literal[...]`: `"left"`, `"right"`, `"wheel"`, `"back"`, `"forward"` (default: `"left"`).
30
+ * `pattern: list[int] | None`: List of delays (ms) for multi-clicks (e.g., `[100]` for double-click, `[100, 100]` for triple).
31
+ * `hold_keys: list[CLAKey] | None`: Modifier keys (e.g., `"shift"`, `"ctrl"`) to hold during the click.
32
+ * `selector: str | None`: Optional CSS selector to target instead of coordinates.
33
+
34
+ * **`MoveAction`**: Moves the mouse cursor.
35
+ * `point: Point | None`: Target coordinates.
36
+ * `selector: str | None`: Optional CSS selector to move to.
37
+ * `offset: Point | None`: Offset relative to the target point/selector.
38
+
39
+ * **`ScrollAction`**: Scrolls the view.
40
+ * `point: Point | None`: Coordinates *where* the scroll should originate (often ignored, scrolls the window).
41
+ * `scroll: Point | None`: Scroll amount `Point(x=dx, y=dy)`. Positive `dy` scrolls down, positive `dx` scrolls right.
42
+ * `hold_keys: list[CLAKey] | None`: Modifier keys to hold.
43
+
44
+ * **`DragAction`**: Simulates clicking and dragging.
45
+ * `path: list[Point]`: A sequence of points defining the drag path (must have at least two points).
46
+ * `pattern: list[int] | None`: Optional delays between path segments.
47
+ * `hold_keys: list[CLAKey] | None`: Modifier keys to hold.
48
+
49
+ ### Keyboard Actions
50
+
51
+ * **`TypeAction`**: Types text.
52
+ * `text: str`: The text string to type.
53
+ * `selector: str | None`: Optional CSS selector to focus before typing.
54
+ * `enter_after: bool | None`: Whether to press Enter after typing (default: `False`).
55
+
56
+ * **`PressAction`**: Presses and releases one or more keys simultaneously (hotkey).
57
+ * `keys: list[CLAKey]`: List of key names (`CLAKey` Literal type) to press together (e.g., `["ctrl", "c"]`).
58
+
59
+ * **`KeyDownAction` / `KeyUpAction`**: Presses or releases keys without the corresponding up/down action. Useful for holding modifier keys.
60
+ * `keys: list[CLAKey]`: List of key names to press down or release up.
61
+
62
+ ### Control Actions
63
+
64
+ * **`WaitAction`**: Pauses execution.
65
+ * `time: int`: Duration to wait in milliseconds.
66
+
67
+ ### Fetch Actions (Get Information)
68
+
69
+ * **`ScreenshotFetch`**: Requests a screenshot (used internally, typically not sent by agents directly).
70
+ * **`PositionFetch`**: Requests the current cursor position (used internally).
71
+
72
+ ### Custom Actions
73
+
74
+ * **`CustomAction`**: Allows defining arbitrary actions specific to a custom environment controller.
75
+ * `action: str`: The name/identifier of the custom action.
76
+ * *(Implicit)*: Any additional fields required by the custom action can be added if defined in the custom controller logic receiving it.
77
+
78
+ ## `CLAKey` Type
79
+
80
+ The `CLAKey` is a `typing.Literal` containing dozens of standard key names, including:
81
+
82
+ * Control Keys: `"backspace"`, `"tab"`, `"enter"`, `"shift"`, `"ctrl"`, `"alt"`, `"escape"`, `"space"`, `"pageup"`, `"pagedown"`, `"end"`, `"home"`, `"left"`, `"up"`, `"right"`, `"down"`, `"insert"`, `"delete"`.
83
+ * Function Keys: `"f1"`, `"f2"`, ..., `"f24"`.
84
+ * Numpad Keys: `"num0"`, `"num1"`, ..., `"add"`, `"multiply"`, etc.
85
+ * Modifier Keys: `"win"`, `"command"`, `"option"`.
86
+ * Printable Characters: `"a"`, `"b"`, `"1"`, `"!"`, `"#"` etc. (Note: For typing sentences, use `TypeAction`).
87
+
88
+ Refer to `hud/adapters/common/types.py` for the exhaustive list.
89
+
90
+ ## Usage Context
91
+
92
+ Remember, an [Agent](/concepts/agent) typically outputs actions in its model's native format. The [Adapter](/concepts/adapter) converts these raw actions into one or more of these specific `CLA` Pydantic model instances, which are then passed in a list to `env.step()`.
@@ -0,0 +1,96 @@
1
+ ---
2
+ title: 'Custom Environments'
3
+ description: 'Define and run your own Docker-based environments locally or remotely'
4
+ ---
5
+
6
+ # Custom Environments
7
+
8
+ While the HUD SDK provides standard environments like `"hud-browser"` and `"OSWorld-Ubuntu"`, you can also define and run your own custom environments using Docker. This allows you to create specific testing scenarios with custom software stacks or configurations.
9
+
10
+ Custom environments are defined using the `CustomGym` type from `hud.types`.
11
+
12
+ ## Defining a Custom Environment (`CustomGym`)
13
+
14
+ ```python
15
+ from hud.types import CustomGym
16
+ from pathlib import Path
17
+
18
+ # Example 1: Local Docker environment using a source directory
19
+ # Points to a directory containing controller code and a Dockerfile
20
+ local_env_spec = CustomGym(
21
+ location="local",
22
+ controller_source_dir="./my_custom_controller" # Path to your controller code
23
+ )
24
+
25
+ # Example 2: Remote Docker environment (built and run on HUD platform)
26
+ remote_env_spec = CustomGym(
27
+ location="remote",
28
+ # Dockerfile content is sent to HUD to build the image remotely
29
+ dockerfile="FROM ubuntu:latest\nRUN apt-get update && apt-get install -y my-package\n..."
30
+ )
31
+ ```
32
+
33
+ **Key `CustomGym` Attributes:**
34
+
35
+ * **`location` (`"local"` | `"remote"`):**
36
+ * `"local"`: Builds and runs the Docker container on your *local* machine. Requires Docker installed. Ideal for development. See [Local Environment Structure](#local-environment-structure) below.
37
+ * `"remote"`: Sends the `dockerfile` content to the HUD platform for remote build and execution. Good for sharing or running complex setups.
38
+ * **`dockerfile` (str | None):** The Dockerfile content.
39
+ * Required if `location="remote"`.
40
+ * Optional if `location="local"` and `controller_source_dir` is provided (will look for `Dockerfile` inside that directory).
41
+ * **`controller_source_dir` (str | `Path` | None):**
42
+ * *Only relevant for `location="local"`.*
43
+ * Path to your local directory containing the controller code and potentially the `Dockerfile`. This directory is mounted into the container.
44
+
45
+ ## <a name="local-environment-structure"></a>Local Environment Structure
46
+
47
+ When creating a `local` custom environment, the directory specified by `controller_source_dir` typically contains:
48
+
49
+ 1. **`Dockerfile`:** Defines the base image, system dependencies, Python dependencies (often via `pip install -e .`), and the command to run your controller script (`CMD [...]`).
50
+ 2. **`pyproject.toml`:** Defines your controller as an installable Python package. The HUD SDK reads the `[project.name]` from this file to know how to import your controller code within the container after installation.
51
+ 3. **`src/` (or your package name):** A directory containing your Python controller code. This code needs to implement the functions called by `setup`, `evaluate`, and `step` (e.g., interacting with applications inside the container, returning observations).
52
+
53
+ **Example Structure (`./my_custom_controller/`):**
54
+
55
+ ```
56
+ my_custom_controller/
57
+ ├── Dockerfile
58
+ ├── pyproject.toml
59
+ └── src/
60
+ └── my_controller_pkg/
61
+ ├── __init__.py
62
+ └── main.py # Your controller logic (e.g., setup, step functions)
63
+ ```
64
+
65
+ * **Examples:** The top-level `environments/` directory in the SDK repository contains reference implementations (like `novnc_ubuntu`) following this structure.
66
+ * **Dependencies:** For local custom environments, you might need to install development dependencies using `pip install -e ".[dev]"` in your SDK checkout to ensure the local components (like the Docker client) function correctly.
67
+
68
+ ## Using a Custom Environment
69
+
70
+ Use your `CustomGym` object with `hud.gym.make()`:
71
+
72
+ ```python
73
+ from hud import gym
74
+ from hud.types import CustomGym
75
+
76
+ # Assuming local_env_spec = CustomGym(location="local", controller_source_dir="./my_custom_controller")
77
+ env = await gym.make(local_env_spec)
78
+
79
+ print("Custom local environment created.")
80
+
81
+ # Interact as usual - Task setup/evaluate calls functions in your controller
82
+ # task = Task(prompt="...", gym=local_env_spec, setup=("my_setup_func", arg1), ...)
83
+ # env = await gym.make(task)
84
+ # obs, _ = await env.reset()
85
+ # result = await env.evaluate()
86
+
87
+ await env.close()
88
+ ```
89
+
90
+ Creating a custom environment requires careful design of both the Dockerfile and the controller script to ensure they work together correctly.
91
+
92
+ ## Related Concepts
93
+
94
+ * [Environment](/concepts/environment): The runtime instance created from the `CustomGym` spec.
95
+ * [Task](/concepts/task): Can specify a `CustomGym` object in its `gym` attribute to request your custom environment.
96
+ * [Advanced Environment Control](/advanced/environment-control): Using `invoke` and `execute` for debugging or advanced control.
@@ -0,0 +1,100 @@
1
+ ---
2
+ title: 'Advanced Environment Control'
3
+ description: 'Using invoke, execute, and _setup for finer control over environments'
4
+ ---
5
+
6
+ # Advanced Environment Control
7
+
8
+ While the standard `step`, `evaluate`, and `close` methods cover most interactions, the `Environment` object provides lower-level methods for more direct control, particularly useful for custom environments, debugging, and complex setup/evaluation scenarios.
9
+
10
+ ## `invoke`
11
+
12
+ The `env._invoke_all()` method (and its underlying `client.invoke()`) is the core mechanism for calling specific functions *within* the environment's controller script.
13
+
14
+ ```python
15
+ async def _invoke_all(self, configs: HudStyleConfigs) -> list[Any]: ...
16
+ ```
17
+
18
+ * **Purpose:** Execute custom functions defined in your environment controller (the Python code running inside the Docker container or remote instance). This is how `setup` and `evaluate` configurations in a `Task` are ultimately executed.
19
+ * **Usage:** You provide a configuration (string, tuple, dict, or list) matching the `HudStyleConfigs` format. The SDK sends this to the environment controller, which runs the specified function(s) with the given arguments.
20
+ * **When to Use:**
21
+ * Triggering custom evaluation logic not suitable for the standard `evaluate` attribute.
22
+ * Running specific diagnostic or state-setting functions within your custom environment controller during development or debugging.
23
+ * Implementing complex, multi-step setup or teardown procedures beyond what's easily defined in the `Task` `setup`.
24
+
25
+ ```python
26
+ from hud.task import Task
27
+ from hud import gym
28
+
29
+ # Assume a custom environment controller has a function 'get_system_load()'
30
+ task = Task(prompt="Check system load", gym=...) # Using a CustomGym spec
31
+
32
+ env = await gym.make(task)
33
+
34
+ # Manually invoke the custom function
35
+ # Use the dictionary format for clarity
36
+ config = {"function": "get_system_load", "args": []}
37
+ results = await env._invoke_all(config)
38
+ system_load = results[0] # _invoke_all returns a list of results
39
+
40
+ print(f"Current system load: {system_load}")
41
+
42
+ await env.close()
43
+ ```
44
+
45
+ ## `execute`
46
+
47
+ The `client.execute()` method (accessible via `env.client.execute()` if `env.client` is a `DockerClient` subclass like `LocalDockerClient` or `RemoteDockerClient`) allows running arbitrary shell commands *inside* the environment container.
48
+
49
+ ```python
50
+ # Assuming env.client is a LocalDockerClient or RemoteDockerClient
51
+ # Example: List files in the container's /tmp directory
52
+ result: ExecuteResult = await env.client.execute(
53
+ command=["ls", "-la", "/tmp"],
54
+ timeout=10 # Timeout in seconds
55
+ )
56
+
57
+ print("STDOUT:", result['stdout'].decode())
58
+ if result['stderr']:
59
+ print("STDERR:", result['stderr'].decode())
60
+ print("Exit Code:", result['exit_code'])
61
+ ```
62
+
63
+ * **Purpose:** Directly interact with the environment's shell.
64
+ * **Availability:** Primarily available for Docker-based environments (local or remote custom). Standard remote environments (like `"hud-browser"`) might not support arbitrary command execution via this method.
65
+ * **When to Use:**
66
+ * **Debugging:** Checking file existence, process status, or network connectivity *inside* the container.
67
+ * **Complex Setup:** Running intricate setup scripts or commands that are difficult to express using the standard `setup` configuration.
68
+ * **Local Development:** Installing packages or modifying the container state interactively during development of a custom environment.
69
+ * **Returns:** An `ExecuteResult` typed dictionary containing `stdout` (bytes), `stderr` (bytes), and `exit_code` (int).
70
+
71
+ ## `_setup`
72
+
73
+ ```python
74
+ async def _setup(self, config: HudStyleConfigs | None = None) -> None: ...
75
+ ```
76
+
77
+ * **Purpose:** Executes the setup configuration for the environment.
78
+ * **Execution:** This is normally called *automatically* by `hud.gym.make(task)` if the provided `task` has a `setup` configuration.
79
+ * **When to Use Manually:**
80
+ * **Debugging:** To re-run setup steps on an already created environment instance without recreating it entirely.
81
+ * **Custom Flow:** If you create an environment *without* an initial task (`env = await gym.make("gym-id")`) and later want to apply setup steps before starting agent interaction (though `env.reset(task=...)` might be more idiomatic).
82
+ * To override the task's default setup by passing a different `config`.
83
+
84
+ ```python
85
+ # Example: Manually re-running setup (less common)
86
+ task = Task(prompt="...", gym="...", setup=("goto", "initial_page.com"))
87
+ env = await gym.make(task) # Initial setup runs here
88
+
89
+ # ... some interaction ...
90
+
91
+ print("Re-running setup...")
92
+ await env._setup() # Re-runs the setup defined in the task
93
+
94
+ # Or run different setup steps
95
+ await env._setup( ("goto", "another_page.com") )
96
+
97
+ await env.close()
98
+ ```
99
+
100
+ These advanced methods provide deeper control when the standard `step`/`evaluate`/`close` cycle isn't sufficient. Use them carefully, especially `execute`, as direct shell access can make scenarios less reproducible if not managed properly.