langchain.js
    Preparing search index...

    Interface LocalShellOptions

    Options for the Local Shell tool.

    interface LocalShellOptions {
        execute: (action: Action) => string | Promise<string>;
    }
    Index

    Properties

    Properties

    execute: (action: Action) => string | Promise<string>

    Optional execute function that handles shell command execution. This function receives the action input and should return the command output (stdout + stderr combined).

    If not provided, you'll need to handle action execution manually by checking local_shell_call outputs in the response.

    execute: async (action) => {
    const result = await exec(action.command.join(' '), {
    cwd: action.working_directory,
    env: { ...process.env, ...action.env },
    timeout: action.timeout_ms,
    });
    return result.stdout + result.stderr;
    }