Skip to main content

Code Execution Tool

Execute Python code safely in a sandboxed environment using Vercel Sandbox. Run calculations, data processing, and computational tasks in isolation.

Installation

Environment Variables

Quick Start

1

Simple Usage

2

With Configuration

Adjust agent instructions, tool options, and provider settings for production — see the Configuration section below.

Configuration Options

Supported Languages

Currently supports Python 3.13 with common libraries:
  • math - Mathematical functions
  • json - JSON parsing
  • datetime - Date/time operations
  • re - Regular expressions
  • collections - Data structures

Advanced Example

Response Format

Security

  • Sandboxed - Code runs in isolated environment
  • No network - No external network access
  • No filesystem - No persistent storage
  • Time limited - Execution timeout enforced
  • Memory limited - Memory usage capped

Best Practices

  1. Set timeouts - Prevent infinite loops
  2. Limit memory - Avoid memory exhaustion
  3. Validate output - Check for errors
  4. Use for computation - Not for I/O operations