Skip to content

createBashTool

createBashTool(options): BashTools

Defined in: bash/tools.ts:47

bash tool: runs a shell command through options.executor. execute returns the executor’s own generator directly (yield*-compatible with the AI SDK’s tool execute contract — see BashExecutor.run’s doc comment) rather than awaiting to a single value, so progress updates stream through as preliminary tool results and the final one lands as the ordinary, non-preliminary result.

A non-zero exit code is data on the final result ({ done: true, exitCode, stdout, stderr, ... }), not a thrown error — a failing command (a grep with no matches, a failing test run) is meaningful information for the model, not a tool-call error. execute only throws for infrastructure failures — the executor’s own sandbox couldn’t start, a missing prerequisite, a spawn error.

BashToolOptions

BashTools