hud-python 0.4.0__py3-none-any.whl → 0.4.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.
- hud/agents/__init__.py +0 -2
- hud/cli/init.py +2 -2
- hud/cli/push.py +0 -9
- hud/clients/base.py +27 -2
- hud/clients/fastmcp.py +21 -1
- hud/utils/tests/test_version.py +1 -1
- hud/version.py +1 -1
- {hud_python-0.4.0.dist-info → hud_python-0.4.1.dist-info}/METADATA +14 -12
- {hud_python-0.4.0.dist-info → hud_python-0.4.1.dist-info}/RECORD +12 -12
- {hud_python-0.4.0.dist-info → hud_python-0.4.1.dist-info}/WHEEL +0 -0
- {hud_python-0.4.0.dist-info → hud_python-0.4.1.dist-info}/entry_points.txt +0 -0
- {hud_python-0.4.0.dist-info → hud_python-0.4.1.dist-info}/licenses/LICENSE +0 -0
hud/agents/__init__.py
CHANGED
|
@@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
3
3
|
from .art import ArtHUDAgent
|
|
4
4
|
from .base import MCPAgent
|
|
5
5
|
from .claude import ClaudeAgent
|
|
6
|
-
from .langchain import LangChainAgent
|
|
7
6
|
from .openai import OperatorAgent
|
|
8
7
|
from .openai_chat_generic import GenericOpenAIChatAgent
|
|
9
8
|
|
|
@@ -11,7 +10,6 @@ __all__ = [
|
|
|
11
10
|
"ArtHUDAgent",
|
|
12
11
|
"ClaudeAgent",
|
|
13
12
|
"GenericOpenAIChatAgent",
|
|
14
|
-
"LangChainAgent",
|
|
15
13
|
"MCPAgent",
|
|
16
14
|
"OperatorAgent",
|
|
17
15
|
]
|
hud/cli/init.py
CHANGED
|
@@ -37,7 +37,7 @@ version = "0.1.0"
|
|
|
37
37
|
description = "A minimal HUD environment"
|
|
38
38
|
requires-python = ">=3.11"
|
|
39
39
|
dependencies = [
|
|
40
|
-
"hud-python
|
|
40
|
+
"hud-python",
|
|
41
41
|
]
|
|
42
42
|
|
|
43
43
|
[build-system]
|
|
@@ -259,7 +259,7 @@ def create_environment(name: str | None, directory: str, force: bool) -> None:
|
|
|
259
259
|
console.print(" [cyan]hud dev[/cyan]")
|
|
260
260
|
else:
|
|
261
261
|
console.print("1. Enter the directory:")
|
|
262
|
-
console.print(f" [cyan]cd {target_dir
|
|
262
|
+
console.print(f" [cyan]cd {target_dir}[/cyan]")
|
|
263
263
|
console.print("\n2. Start development server:")
|
|
264
264
|
console.print(" [cyan]hud dev[/cyan]")
|
|
265
265
|
|
hud/cli/push.py
CHANGED
|
@@ -348,15 +348,6 @@ def push_environment(
|
|
|
348
348
|
console.print("Test locally:")
|
|
349
349
|
console.print(f" [cyan]hud run {image}[/cyan]\n")
|
|
350
350
|
|
|
351
|
-
console.print("Use in MCP configs:")
|
|
352
|
-
console.print(" Claude Desktop:")
|
|
353
|
-
console.print(
|
|
354
|
-
f' [cyan]{{"docker": {{"image": "{pushed_digest}", "command": "auto"}}}}[/cyan]\n'
|
|
355
|
-
)
|
|
356
|
-
|
|
357
|
-
console.print(" Via HUD (recommended):")
|
|
358
|
-
console.print(f' [cyan]{{"hud": {{"registry": "{pushed_digest}"}}}}[/cyan]\n')
|
|
359
|
-
|
|
360
351
|
console.print("Share environment:")
|
|
361
352
|
console.print(
|
|
362
353
|
" Share the updated [cyan]hud.lock.yaml[/cyan] for others to reproduce your exact environment" # noqa: E501
|
hud/clients/base.py
CHANGED
|
@@ -128,8 +128,33 @@ class BaseHUDClient(AgentMCPClient):
|
|
|
128
128
|
|
|
129
129
|
logger.debug("Initializing MCP client...")
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
try:
|
|
132
|
+
# Subclasses implement connection
|
|
133
|
+
await self._connect(self._mcp_config)
|
|
134
|
+
except RuntimeError as e:
|
|
135
|
+
# Re-raise authentication errors with clear message
|
|
136
|
+
if "Authentication failed" in str(e):
|
|
137
|
+
raise
|
|
138
|
+
raise
|
|
139
|
+
except Exception as e:
|
|
140
|
+
# Check for authentication errors in the exception chain
|
|
141
|
+
error_msg = str(e)
|
|
142
|
+
if "401" in error_msg or "Unauthorized" in error_msg:
|
|
143
|
+
# Check if connecting to HUD API
|
|
144
|
+
for server_config in self._mcp_config.values():
|
|
145
|
+
url = server_config.get("url", "")
|
|
146
|
+
if "mcp.hud.so" in url:
|
|
147
|
+
raise RuntimeError(
|
|
148
|
+
"Authentication failed for HUD API. "
|
|
149
|
+
"Please ensure your HUD_API_KEY environment variable is set correctly. "
|
|
150
|
+
"You can get an API key at https://app.hud.so"
|
|
151
|
+
) from e
|
|
152
|
+
# Generic 401 error
|
|
153
|
+
raise RuntimeError(
|
|
154
|
+
f"Authentication failed (401 Unauthorized). "
|
|
155
|
+
f"Please check your credentials or API key."
|
|
156
|
+
) from e
|
|
157
|
+
raise
|
|
133
158
|
|
|
134
159
|
# Common hud behavior - fetch telemetry
|
|
135
160
|
await self._fetch_telemetry()
|
hud/clients/fastmcp.py
CHANGED
|
@@ -82,7 +82,27 @@ class FastMCPHUDClient(BaseHUDClient):
|
|
|
82
82
|
|
|
83
83
|
if self._stack is None:
|
|
84
84
|
self._stack = AsyncExitStack()
|
|
85
|
-
|
|
85
|
+
try:
|
|
86
|
+
await self._stack.enter_async_context(self._client)
|
|
87
|
+
except Exception as e:
|
|
88
|
+
# Check for authentication errors
|
|
89
|
+
error_msg = str(e)
|
|
90
|
+
if "401" in error_msg or "Unauthorized" in error_msg:
|
|
91
|
+
# Check if connecting to HUD API
|
|
92
|
+
for server_config in mcp_config.values():
|
|
93
|
+
url = server_config.get("url", "")
|
|
94
|
+
if "mcp.hud.so" in url:
|
|
95
|
+
raise RuntimeError(
|
|
96
|
+
"Authentication failed for HUD API. "
|
|
97
|
+
"Please ensure your HUD_API_KEY environment variable is set correctly. "
|
|
98
|
+
"You can get an API key at https://app.hud.so"
|
|
99
|
+
) from e
|
|
100
|
+
# Generic 401 error
|
|
101
|
+
raise RuntimeError(
|
|
102
|
+
f"Authentication failed (401 Unauthorized). "
|
|
103
|
+
f"Please check your credentials or API key."
|
|
104
|
+
) from e
|
|
105
|
+
raise
|
|
86
106
|
|
|
87
107
|
# Configure validation for output schemas based on client setting
|
|
88
108
|
from mcp.client.session import ValidationOptions
|
hud/utils/tests/test_version.py
CHANGED
hud/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hud-python
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: SDK for the HUD platform.
|
|
5
5
|
Project-URL: Homepage, https://github.com/hud-evals/hud-python
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/hud-evals/hud-python/issues
|
|
@@ -129,11 +129,12 @@ OSS RL environment + evals toolkit. Wrap software as environments, run benchmark
|
|
|
129
129
|
# Core installation - MCP servers, telemetry, basic tools for environment design
|
|
130
130
|
pip install hud-python
|
|
131
131
|
|
|
132
|
-
# Agent installation - Adds AI providers,
|
|
132
|
+
# Agent installation - Adds AI providers, datasets
|
|
133
133
|
pip install "hud-python[agent]"
|
|
134
134
|
|
|
135
135
|
# CLI utilities
|
|
136
136
|
uv tool install hud-python
|
|
137
|
+
# uv tool update-shell
|
|
137
138
|
|
|
138
139
|
# From source (latest)
|
|
139
140
|
git clone https://github.com/hud-evals/hud-python
|
|
@@ -162,19 +163,20 @@ from hud.datasets import Task # See docs: https://docs.hud.so/reference/tasks
|
|
|
162
163
|
|
|
163
164
|
async def main() -> None:
|
|
164
165
|
with hud.trace("Quick Start 2048"): # All telemetry works for any MCP-based agent (see https://app.hud.so)
|
|
165
|
-
task =
|
|
166
|
-
prompt
|
|
167
|
-
mcp_config
|
|
166
|
+
task = {
|
|
167
|
+
"prompt": "Reach 64 in 2048.",
|
|
168
|
+
"mcp_config": {
|
|
168
169
|
"hud": {
|
|
169
|
-
"url": "https://mcp.hud.so", # HUD's cloud MCP server (see https://docs.hud.so/core-concepts/architecture)
|
|
170
|
+
"url": "https://mcp.hud.so/v3/mcp", # HUD's cloud MCP server (see https://docs.hud.so/core-concepts/architecture)
|
|
170
171
|
"headers": {
|
|
171
|
-
"Authorization": f"Bearer {
|
|
172
|
-
"Mcp-Image": "hudpython/hud-text-2048:v1.
|
|
172
|
+
"Authorization": f"Bearer {settings.api_key}", # Get your key at https://app.hud.so
|
|
173
|
+
"Mcp-Image": "hudpython/hud-text-2048:v1.2" # Docker image from https://hub.docker.com/u/hudpython
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
},
|
|
176
|
-
evaluate_tool
|
|
177
|
-
|
|
177
|
+
"evaluate_tool": {"name": "evaluate", "arguments": {"name": "max_number", "arguments": {"target": 64}}},
|
|
178
|
+
}
|
|
179
|
+
task = Task(**task)
|
|
178
180
|
|
|
179
181
|
# 1. Define the client explicitly:
|
|
180
182
|
client = MCPClient(mcp_config=task.mcp_config)
|
|
@@ -189,7 +191,7 @@ async def main() -> None:
|
|
|
189
191
|
# result = await ClaudeAgent().run(task)
|
|
190
192
|
|
|
191
193
|
print(f"Reward: {result.reward}")
|
|
192
|
-
await client.
|
|
194
|
+
await client.shutdown()
|
|
193
195
|
|
|
194
196
|
asyncio.run(main())
|
|
195
197
|
```
|
|
@@ -346,7 +348,7 @@ result = await ClaudeAgent().run({ # See all agents: https://docs.hud.so/refere
|
|
|
346
348
|
"prompt": "Please explore this environment",
|
|
347
349
|
"mcp_config": {
|
|
348
350
|
"my-environment": {
|
|
349
|
-
"url": "https://mcp.hud.so",
|
|
351
|
+
"url": "https://mcp.hud.so/v3/mcp",
|
|
350
352
|
"headers": {
|
|
351
353
|
"Authorization": f"Bearer {os.getenv('HUD_API_KEY')}",
|
|
352
354
|
"Mcp-Image": "my-name/my-environment:latest"
|
|
@@ -2,8 +2,8 @@ hud/__init__.py,sha256=g2ounE6q48MfCsMm-4UfoC__d0KLz1O3e_arCHFQgBk,419
|
|
|
2
2
|
hud/datasets.py,sha256=bDIWbuu2eshsxl4RvtxZkb4k28NevIBaKUsk8v6pDQk,12214
|
|
3
3
|
hud/settings.py,sha256=-GEBsb60PwhikCQlFgD1DiuNWgOjFmFVhqK7iTwcvac,2112
|
|
4
4
|
hud/types.py,sha256=li7HCCzIH8FfIGEgO2GFmAHpwCCUfBT-NbXloVVkJAY,4373
|
|
5
|
-
hud/version.py,sha256=
|
|
6
|
-
hud/agents/__init__.py,sha256=
|
|
5
|
+
hud/version.py,sha256=JvdmARn-wCmKr0LMLqNvVkCz8MF01kl1VDUCZC2oDgw,111
|
|
6
|
+
hud/agents/__init__.py,sha256=2F7aXfCROLXreVTxWoJNlTZeP8MSY7eZUom1ZSITlsU,349
|
|
7
7
|
hud/agents/art.py,sha256=GE31q7XcnP8qo7Uu1VJCCG5RaiKVf53WIubtdqUPmIU,3574
|
|
8
8
|
hud/agents/base.py,sha256=CHZj73_gwcWcuUIv4fT_1PH2Ac5EnizYV4rBa10JdVE,22857
|
|
9
9
|
hud/agents/claude.py,sha256=2EozkHZS9M2b7Z1sMb07CFeftfnHdSO8W1aDn-rGVGE,14646
|
|
@@ -26,11 +26,11 @@ hud/cli/clone.py,sha256=nc10s8qm4943fvC5f4ASDHVJ7-A_J6cWkyuwiPuBPbo,6284
|
|
|
26
26
|
hud/cli/cursor.py,sha256=hyaArxYpiVENzjPYQAit7cwNjEdTDaCpftX0A1fC_zw,3101
|
|
27
27
|
hud/cli/debug.py,sha256=ZAHMaNjyYosi40bhid_hrCaFCw4Uu7DrTn7F6uhgN54,14005
|
|
28
28
|
hud/cli/docker_utils.py,sha256=FQLmSJZLLYl5fq4H0sekP0_0u6FK-53IXIbPn9zpAbI,2778
|
|
29
|
-
hud/cli/init.py,sha256=
|
|
29
|
+
hud/cli/init.py,sha256=AgUGFYyUqSlCNNJiXd3p7Z_eOL8nJIfx3ais-9qDucs,7953
|
|
30
30
|
hud/cli/interactive.py,sha256=ewO-ipLNR9Q16OteAAouSa_2_FNSH3OO3vMxXBJQyQI,13216
|
|
31
31
|
hud/cli/mcp_server.py,sha256=E5CsIHz5mxoFyfXfZ2UQxirlsLgF9bvzdbl_nu6LATw,28873
|
|
32
32
|
hud/cli/pull.py,sha256=Y5XMOPPIgJ2agZyLgjHYMAJ_HDUiOE1LJka-s_5zMak,12275
|
|
33
|
-
hud/cli/push.py,sha256=
|
|
33
|
+
hud/cli/push.py,sha256=IkuIO6g6EmTzjCOB0eZ1DB5KLN7-yu5xQ2Cb2whVkJ8,14533
|
|
34
34
|
hud/cli/remote_runner.py,sha256=8iH9ez11Xd9R2lsbArn517MVICogsYcyCMkXA_fe2TQ,9716
|
|
35
35
|
hud/cli/runner.py,sha256=5526x2hC_cd7MSvDPtMVsDIAjVPXHMpre0KO3CChkQY,5048
|
|
36
36
|
hud/cli/utils.py,sha256=rKnjcgJ3Fm844qardCrQPQ_PFVtad9JIXQhUEOHhl0A,9104
|
|
@@ -45,8 +45,8 @@ hud/cli/tests/test_mcp_server.py,sha256=6v9-5_iNDTf3WLFWUevS_brv1puG7U0GDpTx4szw
|
|
|
45
45
|
hud/cli/tests/test_utils.py,sha256=DZfe-0xoX_VGQO-mSZr7xca0WBl6z_9Eai_7OxjzuUI,13854
|
|
46
46
|
hud/clients/README.md,sha256=ypuNGE97Bv-1c--DIiy7mh-yUVITsEKn-CBgDvLs4J4,3969
|
|
47
47
|
hud/clients/__init__.py,sha256=_mdxGF3pnuFB0tpVKpNZ9lz27iKSOa2-ck3NjHHFg_Y,344
|
|
48
|
-
hud/clients/base.py,sha256=
|
|
49
|
-
hud/clients/fastmcp.py,sha256=
|
|
48
|
+
hud/clients/base.py,sha256=tYHwoCArNSdc6tCSbGoDDdKw_IVitNIHxF2mk94FB3Y,13876
|
|
49
|
+
hud/clients/fastmcp.py,sha256=mF1ZZHburlpzNdZZ1ndZCaF_0jVT7-ot2sqmZXK49Vo,9389
|
|
50
50
|
hud/clients/mcp_use.py,sha256=38_-yfNC-zhHbqmV2HRmBpMd-fTbB22DO0PnJPd7A50,11302
|
|
51
51
|
hud/clients/tests/__init__.py,sha256=FSkZn2zN5p4DQTMcv6RppiboIxG-9wSUoPpB5kw06g8,34
|
|
52
52
|
hud/clients/tests/test_client_integration.py,sha256=he-Vtmo84G7HuNSk1harEwcBli_K5T9ttQaH2MKGgDU,4309
|
|
@@ -123,10 +123,10 @@ hud/utils/tests/test_async_utils.py,sha256=Sraje4i83CcCEmMtLQQA5GKS8BKXsPZ1uPp-f
|
|
|
123
123
|
hud/utils/tests/test_init.py,sha256=jKwlbj7tz9tOpgBe9cffFGAIsVS47KYkW7DnygcRqYA,400
|
|
124
124
|
hud/utils/tests/test_progress.py,sha256=8kcinr6u6vgvLSWZ4rZlNWz4vL835SUIFwmZj11Q4Qg,7655
|
|
125
125
|
hud/utils/tests/test_telemetry.py,sha256=DNoGqq7zs1fjKA9GsmvT1U8FlekHAVwYD4pxSJvLgYs,2863
|
|
126
|
-
hud/utils/tests/test_version.py,sha256=
|
|
126
|
+
hud/utils/tests/test_version.py,sha256=vwgyzM9FUBbH9by_fUwTmBPLEoQ0cgqZZ_jtEsH-x2E,167
|
|
127
127
|
hud/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
128
|
-
hud_python-0.4.
|
|
129
|
-
hud_python-0.4.
|
|
130
|
-
hud_python-0.4.
|
|
131
|
-
hud_python-0.4.
|
|
132
|
-
hud_python-0.4.
|
|
128
|
+
hud_python-0.4.1.dist-info/METADATA,sha256=Re8FIOUusD1B4-jkdb3lyTJNOwXld4L-BRDMhs8H-CY,19554
|
|
129
|
+
hud_python-0.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
130
|
+
hud_python-0.4.1.dist-info/entry_points.txt,sha256=jJbodNFg1m0-CDofe5AHvB4zKBq7sSdP97-ohaQ3ae4,63
|
|
131
|
+
hud_python-0.4.1.dist-info/licenses/LICENSE,sha256=bskFRICmpDj1GtBpnuisjMR6mtQZtkPnRCtTz1CMMB0,1099
|
|
132
|
+
hud_python-0.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|