hud-python 0.2.10__py3-none-any.whl → 0.3.0__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 (64) hide show
  1. hud/__init__.py +14 -5
  2. hud/env/docker_client.py +1 -1
  3. hud/env/environment.py +10 -7
  4. hud/env/local_docker_client.py +1 -1
  5. hud/env/remote_client.py +1 -1
  6. hud/env/remote_docker_client.py +2 -2
  7. hud/exceptions.py +2 -1
  8. hud/mcp_agent/__init__.py +15 -0
  9. hud/mcp_agent/base.py +723 -0
  10. hud/mcp_agent/claude.py +316 -0
  11. hud/mcp_agent/langchain.py +231 -0
  12. hud/mcp_agent/openai.py +318 -0
  13. hud/mcp_agent/tests/__init__.py +1 -0
  14. hud/mcp_agent/tests/test_base.py +437 -0
  15. hud/settings.py +14 -2
  16. hud/task.py +4 -0
  17. hud/telemetry/__init__.py +11 -7
  18. hud/telemetry/_trace.py +82 -71
  19. hud/telemetry/context.py +9 -27
  20. hud/telemetry/exporter.py +6 -5
  21. hud/telemetry/instrumentation/mcp.py +174 -410
  22. hud/telemetry/mcp_models.py +13 -74
  23. hud/telemetry/tests/test_context.py +9 -6
  24. hud/telemetry/tests/test_trace.py +92 -61
  25. hud/tools/__init__.py +21 -0
  26. hud/tools/base.py +65 -0
  27. hud/tools/bash.py +137 -0
  28. hud/tools/computer/__init__.py +13 -0
  29. hud/tools/computer/anthropic.py +411 -0
  30. hud/tools/computer/hud.py +315 -0
  31. hud/tools/computer/openai.py +283 -0
  32. hud/tools/edit.py +290 -0
  33. hud/tools/executors/__init__.py +13 -0
  34. hud/tools/executors/base.py +331 -0
  35. hud/tools/executors/pyautogui.py +585 -0
  36. hud/tools/executors/tests/__init__.py +1 -0
  37. hud/tools/executors/tests/test_base_executor.py +338 -0
  38. hud/tools/executors/tests/test_pyautogui_executor.py +162 -0
  39. hud/tools/executors/xdo.py +503 -0
  40. hud/tools/helper/README.md +56 -0
  41. hud/tools/helper/__init__.py +9 -0
  42. hud/tools/helper/mcp_server.py +78 -0
  43. hud/tools/helper/server_initialization.py +115 -0
  44. hud/tools/helper/utils.py +58 -0
  45. hud/tools/playwright_tool.py +373 -0
  46. hud/tools/tests/__init__.py +3 -0
  47. hud/tools/tests/test_bash.py +152 -0
  48. hud/tools/tests/test_computer.py +52 -0
  49. hud/tools/tests/test_computer_actions.py +34 -0
  50. hud/tools/tests/test_edit.py +233 -0
  51. hud/tools/tests/test_init.py +27 -0
  52. hud/tools/tests/test_playwright_tool.py +183 -0
  53. hud/tools/tests/test_tools.py +154 -0
  54. hud/tools/tests/test_utils.py +156 -0
  55. hud/tools/utils.py +50 -0
  56. hud/types.py +10 -1
  57. hud/utils/tests/test_init.py +21 -0
  58. hud/utils/tests/test_version.py +1 -1
  59. hud/version.py +1 -1
  60. {hud_python-0.2.10.dist-info → hud_python-0.3.0.dist-info}/METADATA +9 -6
  61. hud_python-0.3.0.dist-info/RECORD +124 -0
  62. hud_python-0.2.10.dist-info/RECORD +0 -85
  63. {hud_python-0.2.10.dist-info → hud_python-0.3.0.dist-info}/WHEEL +0 -0
  64. {hud_python-0.2.10.dist-info → hud_python-0.3.0.dist-info}/licenses/LICENSE +0 -0
hud/__init__.py CHANGED
@@ -10,24 +10,31 @@ from .job import create_job, load_job, run_job
10
10
  from .job import job as register_job
11
11
  from .task import Task
12
12
  from .taskset import load_taskset
13
- from .telemetry import flush, init_telemetry, trace
13
+ from .telemetry import flush, trace, trace_open
14
14
  from .version import __version__
15
15
 
16
- if settings.settings.telemetry_enabled:
17
- init_telemetry()
16
+
17
+ def init_telemetry() -> None:
18
+ from .telemetry import init_telemetry as _init_telemetry
19
+
20
+ _init_telemetry()
21
+
18
22
 
19
23
  if settings.settings.fancy_logging:
20
24
  import logging
25
+ import sys
21
26
 
22
27
  hud_logger = logging.getLogger("hud")
23
- # TODO: Make this configurable
24
28
  hud_logger.setLevel(logging.INFO)
25
29
 
26
30
  if not hud_logger.handlers:
27
- handler = logging.StreamHandler()
31
+ # Use the configured stream (defaults to stderr)
32
+ stream = sys.stderr if settings.settings.log_stream.lower() == "stderr" else sys.stdout
33
+ handler = logging.StreamHandler(stream)
28
34
  formatter = logging.Formatter("[%(levelname)s] %(asctime)s | %(name)s | %(message)s")
29
35
  handler.setFormatter(formatter)
30
36
  hud_logger.addHandler(handler)
37
+ hud_logger.propagate = False
31
38
 
32
39
  __all__ = [
33
40
  "Response",
@@ -38,6 +45,7 @@ __all__ = [
38
45
  "env",
39
46
  "flush",
40
47
  "gym",
48
+ "init_telemetry",
41
49
  "load_job",
42
50
  "load_taskset",
43
51
  "register_job",
@@ -46,6 +54,7 @@ __all__ = [
46
54
  "task",
47
55
  "taskset",
48
56
  "trace",
57
+ "trace_open",
49
58
  "types",
50
59
  "utils",
51
60
  ]
hud/env/docker_client.py CHANGED
@@ -262,7 +262,7 @@ class DockerClient(Client):
262
262
  self,
263
263
  command: list[str],
264
264
  *,
265
- timeout: int | None = None,
265
+ timeout: int | None = None, # noqa: ASYNC109
266
266
  ) -> ExecuteResult:
267
267
  """
268
268
  Execute a command in the environment. May not be supported by all environments.
hud/env/environment.py CHANGED
@@ -378,13 +378,16 @@ def create_remote_config(
378
378
 
379
379
  # Case 1: Explicit config provided
380
380
  if config:
381
- expanded_configs = expand_config(config)
382
- if env and env.final_response and expanded_configs[0].args[0] in LOCAL_EVALUATORS:
383
- # Ensure args is a list before appending
384
- if not isinstance(expanded_configs[0].args, list):
385
- expanded_configs[0].args = [expanded_configs[0].args]
386
- expanded_configs[0].args.append(env.final_response) # for remote responses
387
- return [FunctionConfig(function=function, args=expanded_configs, metadata=metadata)]
381
+ if not isinstance(config, dict):
382
+ expanded_configs = expand_config(config)
383
+ if env and env.final_response and expanded_configs[0].args[0] in LOCAL_EVALUATORS:
384
+ # Ensure args is a list before appending
385
+ if not isinstance(expanded_configs[0].args, list):
386
+ expanded_configs[0].args = [expanded_configs[0].args]
387
+ expanded_configs[0].args.append(env.final_response) # for remote responses
388
+ return [FunctionConfig(function=function, args=expanded_configs, metadata=metadata)]
389
+ else:
390
+ return [FunctionConfig(function=function, args=[config], metadata=metadata)]
388
391
 
389
392
  # Otherwise, use the environment's task
390
393
  task = env.task if env else None
@@ -222,7 +222,7 @@ class LocalDockerClient(DockerClient):
222
222
  self,
223
223
  command: list[str],
224
224
  *,
225
- timeout: int | None = None,
225
+ timeout: int | None = None, # noqa: ASYNC109
226
226
  ) -> ExecuteResult:
227
227
  """
228
228
  Execute a command in the container.
hud/env/remote_client.py CHANGED
@@ -147,7 +147,7 @@ class RemoteClient(Client):
147
147
  command: list[str],
148
148
  *,
149
149
  workdir: str | None = None,
150
- timeout: float | None = None,
150
+ timeout: float | None = None, # noqa: ASYNC109
151
151
  ) -> ExecuteResult:
152
152
  """
153
153
  Execute a command in the environment.
@@ -23,7 +23,7 @@ logger = logging.getLogger("hud.env.remote_env_client")
23
23
  async def upload_bytes_to_presigned_url(
24
24
  presigned_url: str,
25
25
  data_bytes: bytes,
26
- timeout: float = 600,
26
+ timeout: float = 600, # noqa: ASYNC109
27
27
  ) -> None:
28
28
  try:
29
29
  async with httpx.AsyncClient() as client:
@@ -206,7 +206,7 @@ class RemoteDockerClient(DockerClient):
206
206
  command: list[str],
207
207
  *,
208
208
  workdir: str | None = None,
209
- timeout: float | None = None,
209
+ timeout: float | None = None, # noqa: ASYNC109
210
210
  ) -> ExecuteResult:
211
211
  """
212
212
  Execute a command in the environment.
hud/exceptions.py CHANGED
@@ -4,8 +4,9 @@ import logging
4
4
  from typing import TYPE_CHECKING, Any
5
5
 
6
6
  if TYPE_CHECKING:
7
+ from typing import Self
8
+
7
9
  import httpx
8
- from typing_extensions import Self
9
10
 
10
11
  logger = logging.getLogger(__name__)
11
12
 
@@ -0,0 +1,15 @@
1
+ """MCP Agent implementations for HUD."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from .base import BaseMCPAgent
6
+ from .claude import ClaudeMCPAgent
7
+ from .langchain import LangChainMCPAgent
8
+ from .openai import OpenAIMCPAgent
9
+
10
+ __all__ = [
11
+ "BaseMCPAgent",
12
+ "ClaudeMCPAgent",
13
+ "LangChainMCPAgent",
14
+ "OpenAIMCPAgent",
15
+ ]