building-columnsSandbox: Pydantic MCP (Local)

PydanticExecutorSandbox runs code locally inside a WebAssembly sandbox powered by Pyodidearrow-up-right. It communicates with a Pydantic MCP server over stdin/stdout using JSON-RPC.

Prerequisites

# Install Deno
curl -fsSL https://deno.land/install.sh | sh

Setup

from gllm_tools.code_interpreter.code_sandbox.pydantic_executor_sandbox import PydanticExecutorSandbox

# Uses 'deno' from PATH by default
sandbox = PydanticExecutorSandbox()

# Custom path to deno executable
sandbox = PydanticExecutorSandbox(mcp_server_path="/usr/local/bin/deno")

Note: Unlike the other sandboxes, PydanticExecutorSandbox is synchronous in its constructor — the MCP server process is started immediately on instantiation.

Constructor Parameters

Parameter
Type
Default
Description

mcp_server_path

str | None

None

Path to the deno executable. Defaults to "deno" (from PATH).

language

str

"python"

Programming language (only Python supported)

Execution Constraints

Constraint
Value

Max timeout

300 seconds

Max output length

10,000 characters

File download

Not supported (returns None)

Persistent state

No — each execute_code call is isolated

Full Example

With SandboxCodeInterpreter

Notes

  • Each code execution is fully isolated — variables and imports do not persist between calls.

  • File upload via files= is supported (content is base64-encoded and written to /files/<filename> inside the sandbox at execution time).

  • File download is not supporteddownload_file() always returns None.

  • Runs entirely locally — no cloud calls, no API keys required.

Last updated

Was this helpful?