Skip to content

Add Piston sandbox plugin#46

Open
eric-tramel wants to merge 2 commits into
mainfrom
codex/sandbox-piston-plugin
Open

Add Piston sandbox plugin#46
eric-tramel wants to merge 2 commits into
mainfrom
codex/sandbox-piston-plugin

Conversation

@eric-tramel
Copy link
Copy Markdown
Contributor

@eric-tramel eric-tramel commented May 11, 2026

What

Adds data-designer-sandbox-piston, a self-contained Data Designer plugin that registers the code-sandbox column type. The column executes source code from an existing dataset column through a configured local or remote Piston API and returns structured execution metadata including stdout, stderr, output, exit code, status, timing, and memory fields.

The package also includes a stdio MCP server exposing a run_code tool, helper config for creating Data Designer MCP providers/tool config, documentation, and Docker-based local/remote deployment examples.

Why

This makes the Big Iron sandbox/code-execution pattern available in the public plugin repo without Big Iron-specific deployment assumptions. Users can point Data Designer at a Piston endpoint running locally on macOS/Linux or at a separately managed remote service.

Usage

Column execution:

builder.add_column(
    name="sandbox_result",
    column_type="code-sandbox",
    target_column="python_code",
    language="python",
    version="3.12.0",
    sandbox_url="http://localhost:2000",
)

MCP helper:

from data_designer_sandbox_piston import SandboxMCPConfig

sandbox_mcp = SandboxMCPConfig(
    name="sandbox",
    sandbox_url="http://localhost:2000",
    language="python",
    version="3.12.0",
    result_fields=["stdout", "stderr", "exit_code"],
)

mcp_provider = sandbox_mcp.to_provider()
tool_config = sandbox_mcp.to_tool_config()

Local Piston helper:

plugins/data-designer-sandbox-piston/scripts/run-local-piston.sh
curl -X POST http://localhost:2000/api/v2/packages \
  -H 'Content-Type: application/json' \
  -d '{"language":"python","version":"3.12.0"}'

How

The implementation uses a shared aiohttp Piston client, structured SandboxOutput parsing, an adaptive concurrency controller with bounded retry/backpressure behavior, and a synchronous Data Designer column generator wrapper that preserves DataFrame row ordering. The MCP server launches as a stdio process and reads runtime settings from environment variables supplied by SandboxMCPConfig or the caller's environment.

The local Docker helper now mounts /piston to a Docker volume so stock Piston has a writable package store. Runtime defaults align with stock Piston's 3000 ms run limit, and python_packages is treated as declarative metadata for prebuilt custom Python runtimes rather than an implicit runtime-build request.

This PR intentionally leaves catalog/plugins.json unchanged; this repo's scaffold/release validation treats catalog registration as a first-release step.

Validation

  • data-designer config list confirmed the gpt-5.5 model alias.
  • Started local Piston via plugins/data-designer-sandbox-piston/scripts/run-local-piston.sh and installed python 3.12.0 with Piston's package API.
  • Direct Piston execute smoke test returned stdout 55 with exit code 0.
  • Data Designer column-mode workflow used gpt-5.5 to generate Python code, then code-sandbox executed it in Piston and returned stdout 650 with exit code 0.
  • Data Designer MCP-mode workflow used gpt-5.5 with tool_alias="sandbox"; the trace shows one run_code call and returned stdout 6469693118 with exit code 0.
  • make format
  • make plugin-docs
  • make test-plugin PLUGIN=data-designer-sandbox-piston
  • make validate
  • make check
  • make lint
  • make test-devtools
  • make test-plugins
  • make docs

@eric-tramel eric-tramel requested a review from danecor May 11, 2026 14:48
@eric-tramel eric-tramel self-assigned this May 11, 2026
@eric-tramel eric-tramel marked this pull request as ready for review May 12, 2026 04:12
@eric-tramel eric-tramel requested a review from a team as a code owner May 12, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant