Skip to main content

LangGraph Integration

MarinaBox can be integrated with LangGraph to create AI agents that can interact with isolated web browsers. This guide shows you how to set up MarinaBox as a Browser 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_browser: A LangGraph node that initializes and starts up an isolated browser session
  • mb_stop_browser: A LangGraph node that safely closes the browser session
  • mb_use_browser_tool: A LangGraph tool that enables agents to interact with the browser using natural language commands

How It Works

  1. Start Browser Node: The workflow begins with the mb_start_browser node, which creates and initializes an isolated browser session
  2. Browser Control Tool: The agent uses the mb_use_browser_tool to send natural language commands to control the browser
  3. Stop Browser Node: When finished, the mb_stop_browser node ensures proper cleanup and closure of the session

Monitoring Sessions

You can monitor the browser session in real-time 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