vercel-labs/bash-tool

A bash tool for AI SDK

What it solves

It provides a standardized way for AI agents to interact with a bash environment, allowing them to execute commands, read files, and write files within a secure sandbox. This enables agents to perform tasks like project analysis, file manipulation, and running scripts without requiring a custom tool implementation for every agent.

How it works

The library integrates with the AI SDK and provides a set of tools (bash, readFile, and writeFile) that an agent can call. It can operate using a lightweight just-bash instance or a full VM via @vercel/sandbox. It supports uploading local directories, maintaining persistent sandboxes across serverless invocations, and intercepting commands to modify or block dangerous operations.

Who it’s for

Developers building AI agents that need the ability to run shell commands and manage files in a controlled environment.

Highlights

  • AI SDK Compatibility: Designed to work seamlessly with the AI SDK.
  • Flexible Sandboxing: Supports multiple sandbox backends, including full VM support via Vercel Sandbox.
  • Persistence: Ability to reconnect to existing sandboxes using a unique ID to preserve state.
  • Command Interception: Hooks to intercept and modify bash commands before and after execution.
  • Experimental Skills Support: Integration with modular capabilities (Skills) that provide agents with specific instructions and scripts.

Related

  • Project
  • Project
  • Project
  • Project
  • Project