bashfile-systemsandboxcode-execution

Provides bash, readFile, and writeFile tools for AI agents. Supports @vercel/sandbox for full VM isolation.

Installation

pnpm install bash-tool

Usage

import { generateText, isStepCount } from 'ai';
import { createBashTool } from 'bash-tool';

const { tools } = await createBashTool({
  files: { 'src/index.ts': "export const hello = 'world';" },
});

const { text } = await generateText({
  model: 'anthropic/claude-sonnet-5.5',
  prompt: 'List the files in src/ and show me the contents of index.ts',
  tools,
  stopWhen: isStepCount(5),
});

console.log(text);