A production-quality AI agent dashboard that extends the Vercel AI SDK computer use demo. This application provides a robust, two-panel interface for interacting with an AI agent capable of controlling a remote computer environment via E2B.
This project was built to transform a simple demo into a comprehensive agentic workflow tool. Key objectives achieved include:
- Two-Panel Dashboard: A resizable split-screen layout featuring a chat interface on the left and a live VNC desktop viewer on the right.
- Session Management: Full support for creating, switching, and deleting multiple chat sessions, with history persisted locally.
- Event Pipeline: A typed state management system that captures tool calls, execution status, and durations for debugging and visualization.
- Robust Architecture: Implementation of TypeScript best practices and a decoupled chat architecture to ensure state isolation between sessions.
- Node.js: v20+
- Docker (optional, for containerized deployment)
- API Keys:
ANTHROPIC_API_KEY: For the AI model (Claude).E2B_API_KEY: For the sandboxed computer environment.
Create a .env.local file in the root directory:
ANTHROPIC_API_KEY=your_anthropic_key
E2B_API_KEY=your_e2b_key
# Optional UI Configuration
NEXT_PUBLIC_GITHUB_URL="https://github.com/your-repo"
NEXT_PUBLIC_GITHUB_BUTTON_LABEL="Code"
NEXT_PUBLIC_STORYBOOK_URL="/storybook/"
NEXT_PUBLIC_STORYBOOK_BUTTON_LABEL="Storybook"This project includes a production-ready Docker setup that builds both the Next.js application and the Storybook documentation.
-
Build and Run:
docker-compose up --build
This will automatically load variables from your
.env.localfile. -
Access:
- App: http://localhost:3000
- Storybook: http://localhost:3000/storybook
-
Install Dependencies:
npm install --legacy-peer-deps
-
Start Development Server:
npm run dev
Access the app at http://localhost:3000.
-
Run Storybook:
npm run storybook
Access the component library at http://localhost:6006.
The chat interface is powered by the Vercel AI SDK and Anthropic's Claude 3.5 Sonnet (or newer). It supports:
A dynamic overlay system for the right panel that provides deep context without cluttering the UI. Supported views include:
- Debug Console (
DEBUG_PANEL): Real-time JSON activity log of every agent action (tool calls, navigation, errors). Integrates@uiw/react-json-viewfor inspecting complex objects. - Tool Details (
TOOL_DETAILS): Deep dive into specific tool invocations (e.g., full bash output or API arguments). - Screenshot Viewer (
SCREENSHOT_VIEWER): Full-resolution inspection of agent-captured images. - Event State (
EVENT_STATE_VIEWER): Raw state inspection for debugging the event pipeline.
Robust VM management integrated directly into the chat workflow:
- 1:1 Session Binding: Each chat session is uniquely bound to a dedicated E2B desktop instance.
- Auto-Recovery: If a connection drops or the 404s, the system automatically provisions a fresh VM and updates the session credentials.
- Smart Persistence: Desktop stream URLs and Sandbox IDs are persisted in Redux for seamless tab switching, but cleared on browser close to prevent stale connections ("Fresh Start" logic).
Fully optimized for all devices:
- Desktop/Tablet: Resizable split-pane layout (Chat Left / VNC Right).
- Mobile: Unified view with the VNC desktop front-and-center. Chat is accessible via a floating action button, and overlays (debug logs, tools) slide up smoothly over the interface.
The application features a fully responsive Dark/Light mode system.
- Tailwind CSS: Used for all styling, ensuring consistency and ease of customization.
- Shadcn UI: Built on top of Radix UI primitives for accessible, high-quality components.
- CSS Variables: Colors are defined in
globals.cssusing HSL variables, making global theme updates trivial.
Application state is managed using Redux Toolkit.
- Middleware: A custom middleware listens to Redux actions and syncs specific slices (like
chatsessions) to the browser'slocalStorage. - Hydration: On app startup, state is rehydrated from local storage, allowing users to pick up exactly where they left off.
To solve common issues with state leaks in single-page apps (SPA), the chat system was refactored into a ChatContainer architecture.
- Isolation: The
<ChatContainer />component renders theuseChathook. - Key-based Remounting: The parent layout renders
<ChatContainer key={activeSessionId} />. Changing thekeyforces React to completely unmount the old chat and mount a fresh instance. - Benefit: This guarantees that when switching sessions, zero state leaks from the previous conversation. You always get a fresh message list (or the correct restored history) without "ghost" messages.
We use Storybook to document and test components in isolation.
- Coverage: Stories exist for UI primitives (
Button,Input) and complex feature components (ChatInput,ProjectInfo). - Docker Integration: The specific
Dockerfilebuilds the static Storybook site (npm run build-storybook) and serves it under the/storybookroute in the production container. - Routing: A
next.config.tsredirect ensures visiting/storybookautomatically serves the correctindex.html.
While the current system is robust, future enhancements could include:
- Backend Persistence: Move from
localStorageto a proper database (PostgreSQL/Supabase) to support cross-device sync. - Mobile Optimization: Further refine the VNC viewer controls for touch devices.
- Agent Customization: Allow users to configure the system prompt or choose different models via the UI.
- Multi-Agent Support: Orchestrate multiple agents working in the same sandbox.
- Demo Video: https://drive.google.com/file/d/1EgsYwEnCpZoLpGLEXTqEDtlIz3iNTpr1/view?usp=sharing
- Live App (Alpha): https://ai-computer-assistant-alpha.labstack.site/
Note: The live app is hosted on a homelab and may be unstable. For the best experience, please run the project locally using Docker.
Built using Next.js, AI SDK, and E2B.