API Reference
shellTool
function shellTool(backend): Tool;Defined in: tools/builtin/shell.ts:40
Build a shell tool bound to a backend.
Parameters
| Parameter | Type | Description |
|---|---|---|
backend | ShellBackend | The ShellBackend that actually executes commands on the host. |
Returns
A Tool named shell ready to pass to the agent loop or a ToolRegistry.
Remarks
Runs sequentially (ExecutionMode.Sequential): shell commands commonly have side effects and order matters, so the loop must not race a batch of them against each other. Results are shaped by formatShellResult.
See
Example
const tool = shellTool(myShellBackend);
// Recommended: gate a shell tool before granting it to an untrusted model.
await runAgent({ ...opts, tools: [tool] });
// The model can now call: shell({ command: "ls -la" })