Skip to content

Python Code Interpreter #1022

Closed
Closed

Description

@psschwei

Part of #1020

The problem

Today's code_interpreter() / local_code_interpreter() helpers are function-shaped and tightly bound to specific environment classes. There's no clean path for "run this Python in the sandbox my user chose, with these libraries available, and hand me back the files it produced." The motivating use case: user asks for a plot, Granite 4.1 emits code, the code runs in the chosen sandbox, matplotlib writes a PNG, and the PNG comes back as a structured artifact.

Acceptable implementation

  • A configurable Python tool that replaces the current helpers. The existing helpers can stay as thin backwards-compat wrappers for one release.
  • Validated against matplotlib, numpy, and pandas. If these aren't in the default sandbox image, pick and document a package-install story (prebuilt image, on-demand install, cached venv, etc.) and exercise it in tests.
  • matplotlib.use('Agg') (or equivalent) configured automatically so plots don't try to display interactively.
  • A convention for the expected output directory; created files surfaced as structured artifact metadata (path, size, content type) on the execution result.
  • At least one runnable example per canonical task: arithmetic, CSV summary, matplotlib plot saved to file.

Design questions worth resolving

  • Does the Python tool become a new Component, or stay a function wrapped in MelleaTool? This affects how requirements compose on top of it.
  • Where does "please install seaborn for this execution" live — tool config, capability policy, or the requirement/repair layer?
  • Per-execution tempdir vs. a stable artifact directory the user can point at?

Activity

  1. added this to the Release 0.6.0 milestone on May 6, 2026
  2. added
    area/tools
    enhancement
    on May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/toolsenhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions