DEV Community

Cover image for Getting Started with Claude's Computer Use Demo: A Hands-on Guide
Labby for LabEx

Posted on

Getting Started with Claude's Computer Use Demo: A Hands-on Guide

Introduction

This lab guides you through Claude 3.5 Sonnet's computer interaction capabilities using the Anthropic Computer Use Demo. Through hands-on exercises with Anthropic's official demo environment, you'll experience how Claude's Computer Use features enable real-world computing tasks - from managing applications and installing software to monitoring system resources. This practical tutorial showcases Claude's advanced computer interaction abilities, demonstrating how Anthropic's AI technology can understand and execute complex system operations while maintaining security and safety protocols.

Updated

Try the Anthropic Computer Use Demo instantly, no installation required.

If you want to deploy the demo step by step, follow the instructions below.

Preview

alt text

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
Enter fullscreen mode Exit fullscreen mode

Replace your_api_key_here with your actual Anthropic API key.

alt text

Note 1: If you don't have an Anthropic API key, you can request one by following the instructions in the Anthropic API Key Guide.
Note 2: 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
Enter fullscreen mode Exit fullscreen mode

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

alt text

alt text

  1. 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
Enter fullscreen mode Exit fullscreen mode

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.

  1. 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.
Enter fullscreen mode Exit fullscreen mode

alt text

  1. Watch as Claude automatically:
  • Opens a terminal
  • Uses apt-get to install htop
  • Launches htop in the terminal
  1. Observe htop's system monitor interface in the desktop view.

alt text

  1. 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.


πŸš€ Practice Now: Getting Started with Claude's Computer Use Demo


Want to Learn More?

Top comments (0)