VercelLogotypeVercelLogotype
LoginSign Up
Back to Templates

AI SDK Computer Use

An open-source AI agent demonstrating Claude Sonnet's computer use capabilities, built with Next.js, Vercel Sandbox, and the AI SDK.

DeployView Demo
ai-sdk-computer-use-thumbnail

Features

  • Streaming text responses powered by the AI SDK.
  • Anthropic Claude Sonnet 4.5 with computer use and bash tool capabilities.
  • Remote desktop environment running in a Vercel Sandbox with Chrome, a window manager, and VNC streaming.
  • shadcn/ui components for a modern, responsive UI powered by Tailwind CSS.
  • Built with the latest Next.js App Router.

How It Works

The app spins up a Vercel Sandbox from a pre-built snapshot that includes:

  • Xvnc — a virtual X11 display server
  • openbox — a lightweight window manager
  • noVNC + websockify — streams the desktop to the browser via WebSocket
  • Google Chrome — auto-launched so the AI agent has a browser ready
  • xdotool + ImageMagick — for mouse/keyboard control and screenshots

When a user sends a message, Claude uses the computer tool (screenshot, click, type, scroll) and the bash tool (run shell commands) to interact with the sandbox desktop. The noVNC stream is displayed in a resizable iframe alongside the chat.

Architecture

User ↔ Next.js Chat UI ↔ AI SDK ↔ Claude Sonnet 4.5
↓
Vercel Sandbox
┌─────────────────────┐
│ Xvnc (:99) │
│ openbox │
│ Chrome │
│ websockify → noVNC │
└─────────────────────┘
↓
noVNC iframe in browser

Deploy Your Own

You can deploy your own version to Vercel by clicking the button below:

Running Locally

Prerequisites

  • Node.js 18+
  • A Vercel account (for Sandbox access)
  • An Anthropic API key

1. Install dependencies

pnpm install

2. Set up Vercel credentials

Install the Vercel CLI and link your project:

pnpm install -g vercel
vercel link
vercel env pull

This creates a .env.local file with VERCEL_OIDC_TOKEN for Sandbox authentication.

Alternatively, set VERCEL_TOKEN, VERCEL_TEAM_ID, and VERCEL_PROJECT_ID manually in your .env.local.

3. Create a sandbox snapshot

The snapshot pre-installs the desktop environment (Xvnc, Chrome, openbox, noVNC, xdotool, ImageMagick) so sandboxes boot in seconds.

npx tsx lib/sandbox/create-snapshot.ts

This takes ~10 minutes. When done, it outputs a snapshot ID. Add it to your .env.local:

SANDBOX_SNAPSHOT_ID=snap_xxxxxxxxxxxxx

4. Add your Anthropic API key

ANTHROPIC_API_KEY=sk-ant-...

5. Start the dev server

pnpm dev

Open http://localhost:3000 to use the computer use agent.

Environment Variables

VariableRequiredDescription
ANTHROPIC_API_KEYYesAnthropic API key for Claude
SANDBOX_SNAPSHOT_IDYesVercel Sandbox snapshot with the desktop environment
VERCEL_OIDC_TOKENYes*Auto-set by vercel env pull for Sandbox auth
VERCEL_TOKENAlt*Alternative to OIDC — a Vercel personal access token
VERCEL_TEAM_IDAlt*Required with VERCEL_TOKEN
VERCEL_PROJECT_IDAlt*Required with VERCEL_TOKEN

* Either VERCEL_OIDC_TOKEN (via vercel env pull) or the VERCEL_TOKEN + team/project IDs are required for Sandbox authentication.

GitHub Repovercel-labs/ai-sdk-computer-use
Use Cases
AI
Stack
Next.jsTailwind

Related Templates

Get Started

  • Templates
  • Supported frameworks
  • Marketplace
  • Domains

Build

  • Next.js on Vercel
  • Turborepo
  • v0

Scale

  • Content delivery network
  • Fluid compute
  • CI/CD
  • Observability
  • AI GatewayNew
  • Vercel AgentNew

Secure

  • Platform security
  • Web Application Firewall
  • Bot management
  • BotID
  • SandboxNew

Resources

  • Pricing
  • Customers
  • Enterprise
  • Articles
  • Startups
  • Solution partners

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Community

Frameworks

  • Next.js
  • Nuxt
  • Svelte
  • Nitro
  • Turbo

SDKs

  • AI SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDK
  • Streamdown AINew

Use Cases

  • Composable commerce
  • Multi-tenant platforms
  • Web apps
  • Marketing sites
  • Platform engineers
  • Design engineers

Company

  • About
  • Careers
  • Help
  • Press
  • Legal
  • Privacy Policy

Community

  • Open source program
  • Events
  • Shipped on Vercel
  • GitHub
  • LinkedIn
  • X
  • YouTube

Loading status…

Select a display theme:
    • AI Cloud
      • v0

        Build applications with AI

      • AI SDK

        The AI Toolkit for TypeScript

      • AI Gateway

        One endpoint, all your models

      • Vercel Agent

        An agent that knows your stack

      • Sandbox

        AI workflows in live environments

    • Core Platform
      • CI/CD

        Helping teams ship 6× faster

      • Content Delivery

        Fast, scalable, and reliable

      • Fluid Compute

        Servers, in serverless form

      • Observability

        Trace every step

    • Security
      • Bot Management

        Scalable bot protection

      • BotID

        Invisible CAPTCHA

      • Platform Security

        DDoS Protection, Firewall

      • Web Application Firewall

        Granular, custom protection

    • Company
      • Customers

        Trusted by the best teams

      • Blog

        The latest posts and changes

      • Changelog

        See what shipped

      • Press

        Read the latest news

      • Events

        Join us at an event

    • Learn
      • Docs

        Vercel documentation

      • Academy

        Linear courses to level up

      • Knowledge Base

        Find help quickly

      • Community

        Join the conversation

    • Open Source
      • Next.js

        The native Next.js platform

      • Nuxt

        The progressive web framework

      • Svelte

        The web’s efficient UI framework

      • Turborepo

        Speed with Enterprise scale

    • Use Cases
      • AI Apps

        Deploy at the speed of AI

      • Composable Commerce

        Power storefronts that convert

      • Marketing Sites

        Launch campaigns fast

      • Multi-tenant Platforms

        Scale apps with one codebase

      • Web Apps

        Ship features, not infrastructure

    • Tools
      • Marketplace

        Extend and automate workflows

      • Templates

        Jumpstart app development

      • Partner Finder

        Get help from solution partners

    • Users
      • Platform Engineers

        Automate away repetition

      • Design Engineers

        Deploy for every idea

  • Enterprise
  • Pricing
Log InContact
Sign Up
Sign Up
Back to Templates
DeployView Demo

Chatbot

A full-featured, hackable Next.js AI chatbot built by Vercel
Chatbot

Dynamic Model Usage with AI SDK

A chatbot that allows you to dynamically set the LLM using Vercel AI SDK with Feature Flags and Edge Config
Dynamic Model Usage with AI SDK
v0

Build applications with AI

AI SDK

The AI Toolkit for TypeScript

AI Gateway

One endpoint, all your models

Vercel Agent

An agent that knows your stack

Sandbox

AI workflows in live environments

CI/CD

Helping teams ship 6× faster

Content Delivery

Fast, scalable, and reliable

Fluid Compute

Servers, in serverless form

Observability

Trace every step

Bot Management

Scalable bot protection

BotID

Invisible CAPTCHA

Platform Security

DDoS Protection, Firewall

Web Application Firewall

Granular, custom protection

Customers

Trusted by the best teams

Blog

The latest posts and changes

Changelog

See what shipped

Press

Read the latest news

Events

Join us at an event

Docs

Vercel documentation

Academy

Linear courses to level up

Knowledge Base

Find help quickly

Community

Join the conversation

Next.js

The native Next.js platform

Nuxt

The progressive web framework

Svelte

The web’s efficient UI framework

Turborepo

Speed with Enterprise scale

AI Apps

Deploy at the speed of AI

Composable Commerce

Power storefronts that convert

Marketing Sites

Launch campaigns fast

Multi-tenant Platforms

Scale apps with one codebase

Web Apps

Ship features, not infrastructure

Marketplace

Extend and automate workflows

Templates

Jumpstart app development

Partner Finder

Get help from solution partners

Platform Engineers

Automate away repetition

Design Engineers

Deploy for every idea