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

- **Package:** bash-tool
- **Author:** Vercel
- **Tags:** bash, file-system, sandbox, code-execution

## Included Tools
- **bash:** Execute bash commands in the sandbox environment. For analysis agents, this may be the only tool you need to give to the agent
- **readFile:** Read the contents of a file from the sandbox
- **writeFile:** Write content to a file in the sandbox. Creates parent directories if needed

## Installation
```bash
npm install bash-tool
```

## Usage
```typescript
import { generateText, stepCountIs } 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-4',
  prompt: 'List the files in src/ and show me the contents of index.ts',
  tools,
  stopWhen: stepCountIs(5),
});

console.log(text);
```

## Links
- [Documentation](https://github.com/vercel-labs/bash-tool)
- [npm](https://www.npmjs.com/package/bash-tool)
- [GitHub](https://github.com/vercel-labs/bash-tool)

---
[Full Library Index](/library.md)