Getting Started With Claude's Computer Use Demo

DockerDockerBeginner
Practice Now

Introduction

In this lab, you'll explore Claude's ability to interact with a computer environment through the Anthropic Computer Use Demo. You'll see how Claude can perform real computer tasks like opening applications, installing software, and managing system resources. This hands-on experience will give you a practical understanding of AI's capabilities in computer interaction.

Setting Up Your API Key

First, we need to set up the Anthropic API key to allow Claude to authenticate.

  1. Export your Anthropic API key as an environment variable:

    export ANTHROPIC_API_KEY=your_api_key_here

    Replace your_api_key_here with your actual Anthropic API key.

    alt text

Note: If you don't have an Anthropic API key, you can request one by following the instructions in the Anthropic API Key Guide.
Note: LabEx VM does not save your API key, and the environment will be deleted after use.

Running the Demo Container

Now, let's start the Computer Use Demo container with the necessary configurations.

  1. Run the Docker container:

    docker run \
      -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
      -v $HOME/.anthropic:/home/computeruse/.anthropic \
      -p 5900:5900 \
      -p 8501:8501 \
      -p 6080:6080 \
      -p 8080:8080 \
      -e WIDTH=1024 \
      -e HEIGHT=768 \
      -it ghcr.io/anthropics/anthropic-quickstarts:computer-use-demo-latest

    You can copy the command above and use the right-click menu in the terminal to paste it.

    alt text
    alt text
  2. Wait for the container to initialize (1~3 minutes). You'll see several startup messages in your terminal.

    When the container is ready, you'll see the message: Computer Use Demo is ready!

    alt text

Accessing the Demo Interface

Let's open the demo interface in Firefox and start interacting with Claude.

  1. Open a new terminal window to run the following command:

    firefox http://localhost:8080

    Or, you can click the Firefox icon on the desktop to open the browser. Then, enter the following URL in the address bar: http://localhost:8080.

    alt text

    This will open the combined interface that shows both the chat and desktop view.

  2. Wait for the interface to load completely. You should see a chat panel and a virtual desktop view.

Trying Out Computer Interaction

Let's test Claude's computer interaction capabilities with a practical example.

  1. In the chat interface, enter the following request:

    Open a terminal, install htop and open it.
    alt text
  2. Watch as Claude automatically:

    • Opens a terminal
    • Uses apt-get to install htop
    • Launches htop in the terminal
  3. Observe htop's system monitor interface in the desktop view.

    alt text
  4. You can prompt Claude to perform other tasks or explore the system using the chat interface. Try asking Claude to open applications, run commands, or provide information about the system.

Note: LabEx VM will automatically destroy the environment after the countdown timer ends (top-right corner).

Summary

In this lab, you've learned how to:

  1. Configure the necessary API key for Claude
  2. Launch the Computer Use Demo container
  3. Access the demo interface through a web browser
  4. Interact with Claude to perform real computer tasks

You've seen how Claude can understand and execute computer commands, install software, and interact with applications. This demonstrates the potential of AI systems to assist with practical computing tasks while maintaining appropriate safety measures.

Remember that this is a beta feature, and Claude will always prioritize safe and responsible computer interaction. Feel free to explore more commands and interactions, but be mindful of the system's safety boundaries and limitations.