[Go to site: main page, start]

ADK for TypeScript: API Reference
    Preparing search index...

    Class UnsafeLocalCodeExecutor

    A code executor that unsafely executes code in the local context. Supports JavaScript, Python, and Shell capabilities cross-platform.

    Execution Details:

    • JavaScript: Executed via node (defaults to process.execPath).
    • Python: Executed via python3 on Unix, and python on Windows.
    • Shell: Executed via bash on Unix, and defaults to powershell (injecting ExecutionPolicy Bypass) or cmd.exe on Windows.

    WARNING: This executor runs code in the local environment without sandboxing or security restrictions. Use with caution and only for trusted code.

    Hierarchy (View Summary)

    Constructors

    Properties

    "[BASE_CODE_EXECUTOR_SIGNATURE_SYMBOL]": true

    A unique symbol to identify BaseCodeExecutor class.

    codeBlockDelimiters: [string, string][] = ...

    The list of the enclosing delimiters to identify the code blocks. For example, the delimiter('javascript\\n', '\\n') can be used to identify code blocks with the following format:

     console.log("hello")
    
    errorRetryAttempts: number = 2

    The number of attempts to retry on consecutive code execution errors. Default to 2.

    executionResultDelimiters: [string, string] = ...

    The delimiters to format the code execution result.

    optimizeDataFile: boolean = false

    If true, extract and process data files from the model request and attach them to the code executor.

    Supported data file MimeTypes are [text/csv]. Default to false.

    stateful: boolean = false

    Whether the code executor is stateful. Default to false.

    Methods