Skip to content

feat: add code execution sandbox for data tasks #789

Description

@avoidwork

Summary

Add a dedicated code execution sandbox for data tasks — running Python/R for data analysis, executing Node.js scripts for transformations, and safe computation without full shell access.

Motivation

The existing shell tool provides general command execution, but it is not designed for data-focused workflows. Office and marketing workflows frequently need to: run Python scripts for data analysis (pandas, numpy), execute R scripts for statistics, transform data with Node.js scripts, and perform safe computation without exposing the full shell. Currently the agent must use the shell tool directly, which lacks the safety guarantees, resource limits, and structured output that a dedicated data sandbox would provide.

Proposed Solution

Create a code execution sandbox tool:

  • Python Execution: Run Python code with access to common data libraries (pandas, numpy, scipy, matplotlib)
  • R Execution: Run R code with access to common statistical packages (dplyr, ggplot2, tidyr)
  • Node.js Execution: Run Node.js scripts for data transformation and manipulation
  • Safe Computation: Resource limits (CPU, memory, time), no file system access beyond sandbox, no network access unless explicitly enabled
  • Structured Output: Return results as JSON, CSV, or markdown tables
  • Artifact Management: Save output files (charts, reports) to a designated directory

Each tool should follow the existing tool pattern in src/tools/ — a zod schema, an impl function, and registration in index.js with appropriate permissions (process:spawn, filesystem:read/write within sandbox).

Alternatives Considered

  • Shell-based execution: no resource limits, no structured output, full system access is a security risk.
  • Rely on the sandbox tool: designed for skill execution, not ad-hoc data analysis.
  • Web-based computation: adds infrastructure complexity for a local-first tool.

OpenSpec Note

This project uses OpenSpec for feature development. If this request is approved, I will:

  1. Run /opsx:propose to generate a full proposal with specs and tasks
  2. Iterate on the design before any code is written
  3. Follow the task-driven implementation workflow

Additional Context

This should integrate with the spreadsheet computation gap (#782) — e.g., running Python analysis on spreadsheet data and returning results as a new spreadsheet. The existing sandbox infrastructure (src/sandbox/) provides the foundation; this tool would add a data-focused abstraction layer on top.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions