Skip to main content

LangGraph Integration

MarinaBox can be integrated with LangGraph to create AI agents that can interact with isolated desktop environments. This guide shows you how to set up MarinaBox as a Computer Tool for LangGraph agents.

Prerequisites

  • MarinaBox installed and configured
  • Python 3.8+
  • Anthropic API key for Claude

Basic Setup

First, install the required dependencies:
Set up your Anthropic API key:

Creating the Workflow

Here’s a complete example showing how to create a LangGraph workflow with MarinaBox:
MarinaBox provides three key LangGraph components:
  • mb_start_computer: A LangGraph node that initializes and starts up an isolated desktop environment
  • mb_stop_computer: A LangGraph node that safely shuts down the desktop session
  • mb_use_computer_tool: A LangGraph tool that enables agents to interact with the desktop using natural language commands

How It Works

  1. Start Computer Node: The workflow begins with the mb_start_computer node, which creates and initializes an isolated desktop environment
  2. Computer Control Tool: The agent uses the mb_use_computer_tool to send natural language commands to control the desktop
  3. Stop Computer Node: When finished, the mb_stop_computer node ensures proper cleanup and shutdown of the session

Monitoring Sessions

You can monitor the desktop session in your browser using the VNC port provided by MarinaBox. For embedding the live view in your application, see our Embedding Guide.

Example Usage

Here’s a sample interaction with the agent:

Get Support & Join Our Community