Claude Agent
An example of using the HUD SDK with Claude
This example demonstrates how to use the HUD SDK with Anthropic’s Claude model to interact with an environment.
Setup
First, import the necessary components:
Initialize Claude and Adapter
Main Loop
Running the Example
- Make sure you have the HUD SDK installed and configured with your API key
- Install the Anthropic Python client:
pip install anthropic
- Set up your Anthropic API key
- Save the code in a Python file (e.g.,
claude_example.py
) - Run the script:
python claude_example.py
Key Features
This example demonstrates:
- Using Claude as an agent for environment interaction
- Using the Claude-specific adapter for action conversion
- Handling screenshots and text input for Claude
- Managing the agent-environment interaction loop
- Evaluating the results
Notes
- The Claude adapter is used for rescaling screenshots and adapting responses
- Screenshots are automatically rescaled to Claude’s preferred dimensions (1024x768)
- The agent maintains conversation history for context