hud-python 0.1.5__py3-none-any.whl → 0.2.1__py3-none-any.whl

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 (46) hide show
  1. hud/__init__.py +16 -12
  2. hud/adapters/__init__.py +4 -2
  3. hud/adapters/claude/adapter.py +9 -2
  4. hud/adapters/common/adapter.py +11 -10
  5. hud/adapters/common/types.py +34 -13
  6. hud/adapters/operator/__init__.py +5 -0
  7. hud/adapters/operator/adapter.py +97 -0
  8. hud/agent/__init__.py +7 -0
  9. hud/agent/base.py +109 -0
  10. hud/agent/claude.py +207 -0
  11. hud/agent/operator.py +208 -0
  12. hud/env/__init__.py +11 -0
  13. hud/env/client.py +35 -0
  14. hud/env/docker_client.py +306 -0
  15. hud/env/environment.py +354 -0
  16. hud/env/local_docker_client.py +251 -0
  17. hud/env/remote_client.py +185 -0
  18. hud/env/remote_docker_client.py +221 -0
  19. hud/evaluators/__init__.py +10 -0
  20. hud/evaluators/base.py +31 -0
  21. hud/evaluators/inspect.py +29 -0
  22. hud/evaluators/judge.py +213 -0
  23. hud/evaluators/match.py +163 -0
  24. hud/evaluators/remote.py +78 -0
  25. hud/gym.py +101 -15
  26. hud/job.py +185 -0
  27. hud/server/__init__.py +2 -2
  28. hud/server/requests.py +87 -0
  29. hud/settings.py +13 -2
  30. hud/task.py +144 -0
  31. hud/taskset.py +103 -0
  32. hud/trajectory.py +90 -0
  33. hud/types.py +65 -0
  34. hud/utils/__init__.py +4 -2
  35. hud/utils/common.py +96 -0
  36. hud/utils/config.py +91 -4
  37. hud/utils/telemetry.py +67 -0
  38. hud_python-0.2.1.dist-info/METADATA +181 -0
  39. hud_python-0.2.1.dist-info/RECORD +44 -0
  40. {hud_python-0.1.5.dist-info → hud_python-0.2.1.dist-info}/licenses/LICENSE +1 -1
  41. hud/client.py +0 -200
  42. hud/environment.py +0 -318
  43. hud/run.py +0 -208
  44. hud_python-0.1.5.dist-info/METADATA +0 -125
  45. hud_python-0.1.5.dist-info/RECORD +0 -21
  46. {hud_python-0.1.5.dist-info → hud_python-0.2.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,181 @@
1
+ Metadata-Version: 2.4
2
+ Name: hud-python
3
+ Version: 0.2.1
4
+ Summary: SDK for the HUD evaluation platform.
5
+ Project-URL: Homepage, https://github.com/hud-evals/hud-sdk
6
+ Project-URL: Bug Tracker, https://github.com/hud-evals/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
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 Claude Computer Use
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
+ Make sure your have defined your `ANTRHOPIC_API_KEY` in environment variables to run Claude.
94
+
95
+ ```python
96
+ import asyncio
97
+ from hud import gym, job
98
+ from hud.task import Task
99
+ from hud.agent import ClaudeAgent
100
+
101
+ @job("test-run")
102
+ async def main():
103
+ task = Task(
104
+ prompt="Insert the text 'capybara' into the search bar",
105
+ gym="hud-browser",
106
+ setup=("goto", "google.com"),
107
+ evaluate=("contains_text", "capybara")
108
+ )
109
+
110
+ # Create environment using the gym module
111
+ env = await gym.make(task)
112
+
113
+ # Initialize Operator agent (API key is loaded automatically)
114
+ agent = ClaudeAgent()
115
+
116
+ # Agent loop with predict and step functions
117
+ obs, _ = await env.reset() # Gets first observation
118
+ for i in range(5):
119
+ actions, done = await agent.predict(obs)
120
+ if done:
121
+ break
122
+
123
+ obs, reward, terminated, info = await env.step(actions)
124
+
125
+ # Evaluate and close
126
+ result = await env.evaluate()
127
+ print(f"Evaluation result: {result}")
128
+ await env.close()
129
+
130
+ if __name__ == "__main__":
131
+ asyncio.run(main())
132
+
133
+ ```
134
+
135
+ ## Documentation Sections
136
+
137
+ Explore the core concepts and features of the SDK:
138
+
139
+ * **[Tasks and TaskSets](/concepts/task)**: Define goals, context, setup, and evaluation criteria for agent scenarios. This includes both interactive and **question-answering (QA)** style tasks.
140
+ * **[Environments](/concepts/environment)**: Understand the browser and OS runtimes where agents interact.
141
+ * **[Agents](/concepts/agent)**: Learn about the agent architecture (Claude, Operator) and how they process observations and predict actions.
142
+ * **[Adapters](/concepts/adapter)**: See how actions and observations are translated between agents and environments.
143
+ * **[Jobs](/concepts/job)**: Group related runs for analysis and viewing on the HUD platform.
144
+ * **[Trajectories](/concepts/trajectory)**: Understand the recorded data from each agent run.
145
+ * **Advanced Topics**:
146
+ * **[CLA Action Details](/advanced/cla-details)**: Explore the standardized action format.
147
+ * **[Custom Environments](/advanced/custom-environments)**: Build your own Docker-based local or remote environments.
148
+ * **[Advanced Environment Control](/advanced/environment-control)**: Use `invoke`, `execute`, and `_setup` for finer control.
149
+
150
+ * **[Full API Reference](/api-reference/gym)**: Detailed specifications for all modules and classes.
151
+
152
+ ## [Examples](examples/)
153
+
154
+ We recommend you first take a look at the example notebooks showing how to use the HUD SDK:
155
+
156
+ 1. [Browser Basics](examples/browser_use.ipynb) - Simple browser interaction with live view
157
+ 2. [Task Design](examples/tasks.ipynb) - Creating and customizing tasks
158
+ 3. [OSWorld](examples/osworld.ipynb) - Running the OSWorld benchmark
159
+ 4. [Local Development](examples/local.ipynb) - Setting up local custom environments
160
+
161
+ ## Documentation
162
+
163
+ For comprehensive guides, examples, and API reference, visit [our docs](https://docs.hud.so/introduction)
164
+
165
+ ## License
166
+
167
+ [MIT License](LICENSE)
168
+
169
+ ## Citation
170
+
171
+ If you use this SDK in your research, please cite it as follows:
172
+
173
+ ```bibtex
174
+ @software{hud2025agentevalplatform,
175
+ 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},
176
+ title = {{HUD: An Evaluation Platform for Agents}},
177
+ date = {2025-04},
178
+ url = {https://github.com/hud-evals/hud-sdk},
179
+ langid = {en}
180
+ }
181
+ ```
@@ -0,0 +1,44 @@
1
+ hud/__init__.py,sha256=HFL1iwPhLZd7z--2QADzipur68XlekwGrOzU2vWL-Vw,464
2
+ hud/gym.py,sha256=cKjIuJS7A0vJx4K7fctpUjIEv8TkW5x6aB_PRrODrDY,3651
3
+ hud/job.py,sha256=E4RN1CkppRQVy46RWCUDjNIyhMa7lNlFfCgpky2vKFk,5463
4
+ hud/settings.py,sha256=rv8TiZx4wmBzIoEEkOzoywC0nt8UZXlHxIa_LW4tWAg,1346
5
+ hud/task.py,sha256=aNbHMlO7r1cm5DcO0QLU1SZ7EawOFw9W6DZwTNy72-4,5383
6
+ hud/taskset.py,sha256=xDPBXeDm4AlSOwl-MM98lN0x6PmGV8t9jv7sNyS_u0c,2426
7
+ hud/trajectory.py,sha256=PA-sE2iyt2BctO2Dex-2ZaRmS95AkEXTicZjHCVCYqE,3749
8
+ hud/types.py,sha256=fJZnzK3j3mq7G0gO5TbqRaN92qT4xAb4jUNOXIX8ZZ0,2395
9
+ hud/adapters/__init__.py,sha256=0RNQgrzBCkhNBq1Q7JRESN1WfUVLs_99fR5g1re3APs,207
10
+ hud/adapters/claude/__init__.py,sha256=i7QEF-29FLb9qxp1eYtXs-adIk_tG54tL-9g6d3xodk,100
11
+ hud/adapters/claude/adapter.py,sha256=x0qQglWsg7n8DJ_NacsymlUQBnkpqNVguUlkQRpYX-A,5955
12
+ hud/adapters/common/__init__.py,sha256=BjdZWJVs_AKtpFrt-tNsdQRjnz7D97DFEQirJ-r0mp8,118
13
+ hud/adapters/common/adapter.py,sha256=ls-gXtg1N_SQc211rkDb3LL511HNZv6etm1nx2ZtrkQ,5808
14
+ hud/adapters/common/types.py,sha256=APxGEmoePwjF7OYXAKqBTVT73PJTFV0eBmbURbaT5xk,5091
15
+ hud/adapters/operator/__init__.py,sha256=31vTRs268_TOLd-TeQRKau5bDYy78wxCNpJFhD5_l8U,104
16
+ hud/adapters/operator/adapter.py,sha256=svHgjCdUeMyfgfGzRO3ItGWTKGkm3tmldO2zfjX_sGI,3301
17
+ hud/agent/__init__.py,sha256=cI3bqfmG2_Lwzn2RjrxV0X9qIxCRDiffwd1UaWToct4,238
18
+ hud/agent/base.py,sha256=RThJ_h4A3oU23zyvvKtxY2a_YM03Vd1XYDXdY3bAf8g,3881
19
+ hud/agent/claude.py,sha256=tbDKAzGCLJPnUnHc8eV-zZmj3ZG6QQx0ukWKoO4Ekec,7445
20
+ hud/agent/operator.py,sha256=44t19TzcCrS1N3-rnD25ZLXx5s4Io8On27LomALuugs,8185
21
+ hud/env/__init__.py,sha256=BHFY_N0kEI142pjWtMyqUb3BGnoiekY8evRCIbSbO2w,271
22
+ hud/env/client.py,sha256=SPR6ct6NFxmIrgIi3K8tEC-vnqOmCbCBtuT81PaVjuY,869
23
+ hud/env/docker_client.py,sha256=56_u3Ri4NulGcBumAg-7-KilmFmBKthOwEIM5bOLOZc,10418
24
+ hud/env/environment.py,sha256=Xyq4KQO9aWYPwZ0uESAetB5EEZgmlEnZVc7sA0DLz2c,13706
25
+ hud/env/local_docker_client.py,sha256=TCD9z1qjafxjwAWLatAL8d587_ioMDHjs8T5cBgusr8,7789
26
+ hud/env/remote_client.py,sha256=iJiwueuf98xOx0_Y2ltu_63BwKIKNvohhim73Goq74E,5804
27
+ hud/env/remote_docker_client.py,sha256=FwaO7NyygDt9oe3pDD7PwUS21pxzc465mwcXk-Cx-60,6838
28
+ hud/evaluators/__init__.py,sha256=XophB666xPnurhQ_ygfW44h0Jh0BQGCgUzCXEOG2Q1g,158
29
+ hud/evaluators/base.py,sha256=CNbrvFWQfl1YuBxJKzuG4_TBAdAf0TOQA3hl7eGsbaA,782
30
+ hud/evaluators/inspect.py,sha256=eTu9E2eBFe4jd4sPtXL0_vGIEY8aiEmTgmN__v77jvI,735
31
+ hud/evaluators/judge.py,sha256=0T9DHFRR38oH2X1d87t58SBSAhbKWRH5PlljzCa3rkg,6449
32
+ hud/evaluators/match.py,sha256=iFJ_qqaHJQ19TICdQPjHgTubBhq7izCIET5qU_104Fk,4719
33
+ hud/evaluators/remote.py,sha256=NVUJJvrpGQj2eL-aFxzTEnAWW7iuSI9eDWtar54dc6E,2174
34
+ hud/server/__init__.py,sha256=cxDKTwMdGzhj7bYajtejN8XCt7K8Xq3eKB2No0qBpoY,169
35
+ hud/server/requests.py,sha256=s8LZZYWT1wl7lPu2vwRaYPZs9_gjKwSg3LZLvS5-s6E,9085
36
+ hud/utils/__init__.py,sha256=LnoI2tQUnd-mQ4eg-gpJJgmHBBIhggJ6c9ap7MBgrfs,260
37
+ hud/utils/common.py,sha256=XJZ-hKJkeaNmelG2QD5ybi9FpZQS1ErA40fAYzUSHVE,2742
38
+ hud/utils/config.py,sha256=ePi3GDo8mDUnOZ5G5HyMprqGRvxrxCMfixGNuTOA8rQ,3266
39
+ hud/utils/telemetry.py,sha256=md7AuKxtDqsONMeeTOHen1XpmNds8CbXROX_PnkDxFc,1993
40
+ hud/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
+ hud_python-0.2.1.dist-info/METADATA,sha256=f2lyqGmu9L7_zgCOqrhZ6ZX1JUU6Z0e92bRTfmojSqQ,7219
42
+ hud_python-0.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
+ hud_python-0.2.1.dist-info/licenses/LICENSE,sha256=yIzBheVUf86FC1bztAcr7RYWWNxyd3B-UJQ3uddg1HA,1078
44
+ hud_python-0.2.1.dist-info/RECORD,,
@@ -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
hud/client.py DELETED
@@ -1,200 +0,0 @@
1
- """
2
- HUD client for interacting with the API.
3
- """
4
-
5
- from __future__ import annotations
6
-
7
- import json
8
- from typing import Any
9
-
10
- from .adapters.common import Adapter
11
- from .environment import EvalSet
12
- from .gym import Gym
13
- from .run import Run, RunResponse
14
- from .server import make_request
15
- from .settings import settings
16
-
17
-
18
- class HUDClient:
19
- """
20
- Client for interacting with the HUD API.
21
-
22
- This is the main entry point for the SDK, providing methods to load gyms,
23
- evalsets, and create runs.
24
- """
25
-
26
- def __init__(self, api_key: str | None = None) -> None:
27
- """
28
- Initialize the HUD client with an API key.
29
-
30
- Args:
31
- api_key: API key for authentication with the HUD API
32
- """
33
- self.api_key = api_key or settings.api_key
34
- settings.api_key = self.api_key
35
-
36
- async def load_gym(self, id: str) -> Gym:
37
- """
38
- Load a gym by ID from the HUD API.
39
-
40
- Args:
41
- id: The ID of the gym to load
42
-
43
- Returns:
44
- Gym: The loaded gym object
45
- """
46
- # API call to get gym info
47
- data = await make_request(
48
- method="GET",
49
- url=f"{settings.base_url}/gyms/{id}",
50
- api_key=self.api_key,
51
- )
52
- return Gym(id=data["id"], name=data["name"])
53
-
54
- async def load_evalset(self, id: str) -> EvalSet:
55
- """
56
- Load an evalset by ID from the HUD API.
57
-
58
- Args:
59
- id: The ID of the evalset to load
60
-
61
- Returns:
62
- EvalSet: The loaded evalset object
63
- """
64
- # API call to get evalset info
65
- data = await make_request(
66
- method="GET",
67
- url=f"{settings.base_url}/evalsets/{id}",
68
- api_key=self.api_key,
69
- )
70
- return EvalSet(id=data["id"], name=data["name"])
71
-
72
- async def list_gyms(self) -> list[str]:
73
- """
74
- List all available gyms.
75
-
76
- Returns:
77
- list[str]: List of gym IDs
78
- """
79
- # API call to get gyms
80
- data = await make_request(
81
- method="GET", url=f"{settings.base_url}/gyms", api_key=self.api_key
82
- )
83
- return data["gyms"]
84
-
85
- async def get_runs(self) -> list[Run]:
86
- """
87
- Get all runs associated with the API key.
88
-
89
- Returns:
90
- list[Run]: List of run objects
91
- """
92
- # API call to get runs
93
- data = await make_request(
94
- method="GET", url=f"{settings.base_url}/runs", api_key=self.api_key
95
- )
96
- return data["runs"]
97
-
98
- async def load_run(self, id: str, adapter: Adapter | None = None) -> Run | None:
99
- """
100
- Load a run by ID from the HUD API.
101
-
102
- Args:
103
- id: The ID of the run to load
104
- adapter: Optional adapter for action conversion
105
-
106
- Returns:
107
- Run: The loaded run object, or None if not found
108
- """
109
- adapter = adapter or Adapter()
110
- # API call to get run info
111
- data = await make_request(
112
- method="GET",
113
- url=f"{settings.base_url}/runs/{id}",
114
- api_key=self.api_key,
115
- )
116
- if data:
117
- response = RunResponse(**data)
118
- gym = Gym(id=response.gym["id"], name=response.gym["name"])
119
- evalset = EvalSet(
120
- id=response.evalset["id"],
121
- name=response.evalset["name"],
122
- tasks=response.evalset["tasks"],
123
- )
124
- return Run(
125
- id=response.id,
126
- name=response.name,
127
- gym=gym,
128
- evalset=evalset,
129
- adapter=adapter,
130
- config=response.config,
131
- metadata=response.metadata,
132
- )
133
- return None
134
-
135
- async def create_run(
136
- self,
137
- name: str,
138
- gym: Gym,
139
- evalset: EvalSet,
140
- config: dict[str, Any] | None = None,
141
- metadata: dict[str, Any] | None = None,
142
- adapter: Adapter | None = None,
143
- ) -> Run:
144
- """
145
- Create a new run in the HUD system.
146
-
147
- Args:
148
- name: Name of the run
149
- gym: Gym to use for the run
150
- evalset: Evalset to use for the run
151
- config: Optional configuration parameters
152
- metadata: Optional metadata for the run
153
- adapter: Optional adapter for action conversion
154
-
155
- Returns:
156
- Run: The created run object
157
- """
158
- adapter = adapter or Adapter()
159
- # Make synchronous API call to create run
160
- if metadata is None:
161
- metadata = {}
162
- if config is None:
163
- config = {}
164
- data = await make_request(
165
- method="POST",
166
- url=f"{settings.base_url}/runs",
167
- json={
168
- "name": name,
169
- "gym_id": gym.id,
170
- "evalset_id": evalset.id,
171
- "config": json.dumps(config),
172
- "metadata": json.dumps(metadata),
173
- },
174
- api_key=self.api_key,
175
- )
176
- return Run(
177
- id=data["id"],
178
- name=name,
179
- gym=gym,
180
- evalset=evalset,
181
- adapter=adapter,
182
- config=config,
183
- metadata=metadata,
184
- )
185
-
186
- def display_stream(self, live_url: str) -> None:
187
- """
188
- Display a stream in the HUD system.
189
- """
190
- from IPython.display import HTML, display
191
-
192
- html_content = f"""
193
- <div style="width: 960px; height: 540px; overflow: hidden;">
194
- <div style="transform: scale(0.5); transform-origin: top left;">
195
- <iframe src="{live_url}" width="1920" height="1080" style="border: 1px solid #ddd;">
196
- </iframe>
197
- </div>
198
- </div>
199
- """
200
- display(HTML(html_content))