Class CodeRunner

  • All Implemented Interfaces:

    
    public final class CodeRunner
    
                        

    Sandboxed code execution for the coding domain — coding.runCode(language, code).

    Runs user/agent-provided code in a throwaway subprocess with:

    • a private temp working directory (nothing in the workspace can be touched unless the code explicitly reaches out via absolute paths),

    • a hard timeout (default 30s) after which the process is killed,

    • stdout/stderr capture with truncation (no unbounded output),

    • a deny-list of interpreters that would be too dangerous to spawn as-is (interactive shells, database clients, etc.).

    It deliberately does NOT provide network, persistence, or workspace access — scripts that need those should use coding.shell with the normal command whitelist instead.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public final class CodeRunner.RunResult
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      CodeRunner(Long defaultTimeoutSeconds, Integer maxOutputChars)
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final List<String> supportedLanguages() Supported languages for runCode.
      final CodeRunner.RunResult run(String language, String code, Long timeoutSeconds, List<String> args) Run code in a sandboxed subprocess.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait