Metadata-Version: 2.4
Name: hud-python
Version: 0.3.5
Summary: SDK for the HUD platform.
Project-URL: Homepage, https://github.com/hud-evals/hud-python
Project-URL: Bug Tracker, https://github.com/hud-evals/hud-python/issues
Project-URL: Documentation, https://docs.hud.so
Author-email: HUD SDK <founders@hud.so>
License: MIT License
        
        Copyright (c) 2025 Human Union Data, Inc
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: <3.14,>=3.11
Requires-Dist: anthropic
Requires-Dist: datasets>=2.14.0
Requires-Dist: dotenv>=0.9.9
Requires-Dist: httpx<1,>=0.23.0
Requires-Dist: langchain
Requires-Dist: langchain-anthropic
Requires-Dist: langchain-openai
Requires-Dist: mcp-use>=1.3.7
Requires-Dist: mcp>=1.12.2
Requires-Dist: openai
Requires-Dist: pathspec>=0.12.1
Requires-Dist: pydantic-settings<3,>=2
Requires-Dist: pydantic<3,>=2
Requires-Dist: wrapt>=1.14.0
Provides-Extra: dev
Requires-Dist: aiodocker>=0.24.0; extra == 'dev'
Requires-Dist: anthropic; extra == 'dev'
Requires-Dist: dotenv; extra == 'dev'
Requires-Dist: ipykernel; extra == 'dev'
Requires-Dist: ipython<9; extra == 'dev'
Requires-Dist: jupyter-client; extra == 'dev'
Requires-Dist: jupyter-core; extra == 'dev'
Requires-Dist: openai; extra == 'dev'
Requires-Dist: pillow>=11.1.0; extra == 'dev'
Requires-Dist: playwright; extra == 'dev'
Requires-Dist: pyautogui>=0.9.54; extra == 'dev'
Requires-Dist: pyright==1.1.401; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Requires-Dist: pytest<9,>=8.1.1; extra == 'dev'
Requires-Dist: ruff==0.11.8; extra == 'dev'
Requires-Dist: toml>=0.10.2; extra == 'dev'
Provides-Extra: v2
Requires-Dist: aiodocker>=0.24.0; extra == 'v2'
Requires-Dist: inspect-ai>=0.3.80; extra == 'v2'
Requires-Dist: ipykernel; extra == 'v2'
Requires-Dist: numpy; extra == 'v2'
Requires-Dist: pillow>=11.1.0; extra == 'v2'
Requires-Dist: pyautogui>=0.9.54; extra == 'v2'
Requires-Dist: textdistance<5,>=4.5.0; extra == 'v2'
Requires-Dist: toml>=0.10.2; extra == 'v2'
Description-Content-Type: text/markdown

<div align="left">
  <img src="https://raw.githubusercontent.com/hud-evals/hud-python/main/docs/logo/hud_logo.svg" alt="HUD" width="150" style="margin-bottom: 20px;"/>
</div>

<h3>
Evaluate your Computer Use AI agents across web browsers, desktop environments, and custom scenarios.
</h3>

### 🚀 Are you a startup building agents?

[📅 Hop on a call](https://cal.com/jay-ram-z6st6w/demo) or [📧 founders@hud.so](mailto:founders@hud.so)

We're here to help with eval strategies, custom environments, or improving your agent architecture!


> **Early Release Notice**: We'd love to hear your feedback in [Issues](https://github.com/hud-evals/hud-python/issues), as the SDK is still evolving!

[![PyPI version](https://img.shields.io/pypi/v/hud-python)](https://pypi.org/project/hud-python/)

## ✨ What You Can Do

**[Evaluate Existing Benchmarks](https://docs.hud.so/examples/benchmarking-agents)**
```python
from hud import load_taskset, run_job, ClaudeAgent

taskset = await load_taskset("WebVoyager")  # or GAIA, OSWorld-Ubuntu, Mind2Web
job = await run_job(ClaudeAgent, taskset, "my-evaluation")
```

**[Create Custom Tasks](https://docs.hud.so/task-creation)** 
```python
from hud.task import Task

task = Task(
    prompt="Find and book the cheapest flight from NYC to Paris",
    gym="hud-browser",
    setup=("goto", "https://kayak.com"),
    evaluate=("page_contains", "confirmation")
)
```

**[Build Custom Environments](https://docs.hud.so/environment-creation)**
```python
from hud.types import CustomGym

# Launch any website as an environment
custom_gym = CustomGym(
    image_or_build_context="nginx:alpine",
    location="local"
)

# Or create complex Docker environments - see environments/ folder for examples
```

**[Trace Tool Calls Alongside HUD Environments (or Independently)](https://docs.hud.so/examples/mcp-agent-tracing)**
```python
import hud

with hud.trace("my-agent-run"):
    # Your agent code here - MCP calls automatically captured
    result = await agent.run(task)
```

## Quick Start

### Installation

```bash
pip install hud-python
```

### API Key Setup

Before getting started, you'll need to obtain an API key:

1. Visit [app.hud.so](https://app.hud.so) to create a free account and generate your API key
2. Set it in your environment or .env file:

```bash
export HUD_API_KEY=your_api_key_here
```

### Simple Browser Example with Claude Computer Use

> This example uses the `@register_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).

Make sure your have defined your `ANTRHOPIC_API_KEY` in environment variables to run Claude.

```python
import asyncio
from hud import gym, register_job
from hud.task import Task
from hud.agent import ClaudeAgent

@register_job("test-run")
async def main():
    task = Task(
        prompt="Insert the text 'capybara' into the search bar",
        gym="hud-browser",
        setup=("goto", "google.com"),
        evaluate=("contains_text", "capybara")
    )
    print(f"Running task with prompt: {task.prompt}")
    
    # Create environment using the gym module
    env = await gym.make(task)
    
    # Initialize Claude agent (API key is loaded automatically)
    agent = ClaudeAgent()
    
    # Agent loop with predict and step functions
    obs, _ = await env.reset() # Gets first observation
    for i in range(5):
        actions, done = await agent.predict(obs)
        print(f"Agent action {i}: {actions}")

        obs, reward, terminated, info = await env.step(actions)
        if done or terminated: break
    
    # Evaluate and close
    result = await env.evaluate()
    print(f"Evaluation result: {result}")
    await env.close()

if __name__ == "__main__":
    asyncio.run(main())
```

Alternatively, run a full evaluation set via the ```run_job``` command:

```python
from hud import load_taskset, run_job, ClaudeAgent

# Load a benchmark
taskset = load_taskset("GAIA")

# Evaluate
job = await run_job(ClaudeAgent, taskset, "test-gaia-job")

# Get results OR view them in app.hud.so
print(await job.get_analytics())
```

## Ready-to-Use TaskSets

- **WebVoyager** - Web navigation and interaction
- **Mind2Web** - Complex web application tasks  
- **GAIA** - Question answering and reasoning
- **OSWorld-Ubuntu** - Desktop interaction
- **hud-samples** - Getting started examples

## Community

**Contributing Custom Environments**

Add your environment to the `environments/` folder and submit a PR! Examples:
- `environments/novnc_ubuntu/` - Ubuntu with VNC access 
- `environments/pokemon_controller/` - Pokemon emulator environment (In Development)
- `environments/qa_controller/` - Lightweight app sample

See [Custom Environments Guide](https://docs.hud.so/environment-creation) for details.

## Documentation Sections

Explore the core concepts and features of the SDK:

*   **[Task Creation](https://docs.hud.so/task-creation)**: Build custom evaluation scenarios with setup and evaluation criteria.
*   **[Environments](https://docs.hud.so/environments/browser)**: Understand browser environments and create custom Docker-based environments.
*   **[Agents](https://docs.hud.so/concepts/agent)**: Learn about the agent architecture (Claude, Operator) and how they process observations and predict actions.
*   **[Jobs](https://docs.hud.so/concepts/job)**: Group related runs for analysis and viewing on the HUD platform.
*   **[MCP Telemetry](https://docs.hud.so/telemetry/mcp)**: Automatic tracing of Model Context Protocol interactions.
*   **[Full API Reference](https://docs.hud.so/api-reference/gym)**: Detailed specifications for all modules and classes.

## [Examples](examples/)

We recommend you first take a look at the example notebooks showing how to use the HUD SDK:

1. [Browser Basics](examples/browser_use.ipynb) - Simple browser interaction with live view
2. [Task Design](examples/tasks.ipynb) - Creating and customizing tasks
3. [OSWorld](examples/osworld.ipynb) - Running the OSWorld benchmark
4. [Local Development](examples/local.ipynb) - Setting up local custom environments

## Documentation

For comprehensive guides, examples, and API reference, visit [our docs](https://docs.hud.so/introduction)

## License

[MIT License](LICENSE)

## Citation

If you use this SDK in your research, please cite it as follows:

```bibtex
@software{hud2025agentevalplatform,
  author = {HUD and Jay Ram and Lorenss Martinsons and Parth Patel and Oskars Putans and Govind Pimpale and Mayank Singamreddy and Nguyen Nhat Minh},
  title = {{HUD: An Evaluation Platform for Agents}},
  date = {2025-04},
  url = {https://github.com/hud-evals/hud-python},
  langid = {en}
}
```
