Skip to content

Conversation

@DorianZheng
Copy link

Summary

Add four new tools for secure, isolated code execution using BoxLite:

  • BoxliteSandboxTool: Execute commands in isolated VM sandbox
  • BoxliteCodeInterpreterTool: Execute Python code with dynamic package installation
  • BoxliteComputerUseTool: GUI automation in isolated VM desktop environment
  • BoxliteBrowserTool: Browser automation via Chrome DevTools Protocol (CDP)

BoxLite provides VM-level isolation using lightweight virtualization, ensuring complete separation between the sandbox and host system. This is particularly useful for AI agents that need to run untrusted or generated code safely.

Features

  • Full async/sync support for all tools
  • Configurable resources (memory, CPUs, container images)
  • Proper error handling with informative messages
  • Comprehensive unit tests
  • Lazy loading via __getattr__ pattern

Usage

from langchain_community.tools.boxlite import (
    BoxliteSandboxTool,
    BoxliteCodeInterpreterTool,
    BoxliteComputerUseTool,
    BoxliteBrowserTool,
)

# Execute commands in isolated sandbox
sandbox = BoxliteSandboxTool()
result = await sandbox.ainvoke({"command": "echo", "args": ["hello"]})

# Run Python code with package installation
interpreter = BoxliteCodeInterpreterTool()
result = await interpreter.ainvoke({
    "code": "import pandas as pd; print(pd.__version__)",
    "packages": ["pandas"]
})

# GUI automation
computer = BoxliteComputerUseTool()
screenshot = await computer.ainvoke({"action": "screenshot"})

# Browser automation
browser = BoxliteBrowserTool()
result = await browser.ainvoke({"action": "start"})
# Use result["endpoint"] with Playwright/Puppeteer

Dependencies

BoxLite is an optional dependency. Users install it with:

pip install boxlite

Test plan

  • All Python files compile successfully
  • Unit tests created for all four tools
  • Run make test in libs/community
  • Verify imports work correctly

🤖 Generated with Claude Code

Add four new tools for secure, isolated code execution using BoxLite:

- BoxliteSandboxTool: Execute commands in isolated VM sandbox
- BoxliteCodeInterpreterTool: Execute Python code with package installation
- BoxliteComputerUseTool: GUI automation in isolated VM desktop
- BoxliteBrowserTool: Browser automation via Chrome DevTools Protocol

BoxLite provides VM-level isolation using lightweight virtualization,
ensuring complete separation between the sandbox and host system.
This is useful for AI agents that need to run untrusted code safely.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant