Getting Started
Quickstart
Get started quickly with the HUD SDK
This guide will get you up and running with the HUD SDK using a simple browser task and the OpenAI Operator Agent.
1. Prerequisites
- Python: Ensure you have Python 3.10 or later installed.
- API Keys: You’ll need API keys for both HUD and the agent you want to use (e.g., OpenAI).
2. Installation
Install the HUD SDK using pip:
For more details, see the Installation Guide.
3. API Key Setup
The SDK automatically loads API keys from environment variables or a .env
file in your project root. Set the following:
HUD_API_KEY
: Your key from app.hud.so.OPENAI_API_KEY
: Your OpenAI API key (if using OperatorAgent).ANTHROPIC_API_KEY
: Your Anthropic API key (if using ClaudeAgent).
Example .env
file:
4. Run Your First Agent
This example uses the OperatorAgent
to interact with a browser environment. It defines a task, creates an environment, runs the agent, and evaluates the result.
Explanation:
- Task: Defines the goal (
prompt
), the type of environment (gym
), initial setup steps (setup
), and how success is measured (evaluate
). - Environment:
gym.make(task)
creates the specified browser environment instance. - Agent:
OperatorAgent
is initialized. It automatically uses theOPENAI_API_KEY
found byhud.settings
. - Interaction Loop:
env.step()
with no actions gets the initial observation.agent.predict(obs)
gets the next action(s) from the agent.env.step(actions)
executes the actions and gets the new observation.
- Evaluation & Close:
env.evaluate()
checks if the task succeeded based on theevaluate
definition.env.close()
shuts down the environment. @job
Decorator: Wrappingmain
with@job("quickstart-run")
automatically creates a Job. Whenenv.close()
is called, the recorded interactions (trajectory) are associated with this Job. You can view the job and its trajectory video on the HUD Jobs page.
Next Steps
- Explore the Core Concepts to understand the SDK architecture in more detail.
- Check out the Examples folder in the GitHub repo for more detailed, runnable notebooks covering different agents and environments.
- Review the API Reference for comprehensive documentation on specific functions and classes.