just-bash library. This means your agent can execute regular bash commands — using tools like ls, cat, cp, grep, and more — directly against Mesa repositories without cloning or mounting anything, or even needing a sandbox. Both read and write operations are supported.
The integration lives in the @mesadev/sdk package. You create a Mesa filesystem, call .bash() to get a bash executor, and start executing commands.
Quick Start
Prerequisites
- A Mesa account. If you haven’t signed up yet, you can do so here.
- An API key with admin scope. You can create one at
https://app.mesa.dev/<your-org>/tokens. - A repository to access. You can create one at
https://app.mesa.dev/<your-org>/repositories.
Running in Docker with a slim base image? See Running in Docker
for required system packages.
Install the SDK
Create a Mesa Filesystem
Initialize a Mesa client and a filesystem handle scoped to the repos you want to access. You can create as many filesystem handles as you need.Managing Changes and Bookmarks
Beyond file operations, the Mesa filesystem exposes APIs to create/switch changes and manage bookmarks (analogous to branches in git) directly from TypeScript.How It Works
When you run a command likels /my-repo/src, just-bash calls into Mesa which fetches the directory listing from Mesa’s API.
Writes work the same way — file changes are persisted back to Mesa automatically.
Our just-bash implementation takes advantage of the same caching and prefetching mechanisms as Mesa FUSE, which means you get the same performance benefits without the need for a sandbox.
When to use Mesa just-bash
If you have an existing TypeScript-defined agent that runs in your multi-tenant backend, Mesa just-bash enables you to get the full benefits of a filesystem without needing a sandbox. For example, agents written using Vercel’s AI SDK, Mastra, or Langchain can now manipulate files using the full power ofbash and common Unix tools, rather than just basic readFile/writeFile tools.
When not to use just-bash
If your agent needs to install dependencies or run arbitrary code, you should instead mount Mesa FUSE in a sandboxed environment like an ECS container or lightweight VM from a provider like Daytona, Vercel, or Modal. Just-bash does allow you to use sqlite databases and execute small scripts in Python and JavaScript, but it is not a general-purpose VM.Integrating with Agents
Mesa just-bash is designed to be used with any agent framework that supports tool calling. By wrapping the bash execution function in a tool, you can use it in your agent’s workflow. For end-to-end examples, see the Mesa examples repo.Vercel AI SDK
To define a tool in the Vercel AI SDK, you can use thetool function.
Langchain
To define a tool in Langchain, you can use thetool function.
Mastra
To define a tool in Mastra, you can use thecreateTool function.
Configuring the Shell
The.bash() method accepts options to configure the shell environment. Mesa’s Bash implementation is is a thin wrapper over the underlying just-bash library,
so all of the exposed options are pure passthrough to the underlying just-bash Bash instance. We omit some options that are not relevant to a typical Mesa bash() setup.
For more details, you can refer to the just-bash documentation.
Options like
fs and files from BashOptions are intentionally omitted — the filesystem is always
the MesaFileSystem instance, and files are populated from your Mesa repositories.cwd (Current Working Directory)
Thecwd option sets the starting directory for the shell. The default is /home/user, and Mesa mounts your repos at /<org>/<repo>.
In most cases, you will want to set cwd to either /<org>/<repo> or, for multi-repo filesystems, /<org>.
env (Environment Variables)
Theenv option sets the environment variables available to commands. For compatibility, the defaults simulate a typical Linux/GNU environment,
ex. PATH, HOME, PWD, and OLDPWD.
executionLimits (Resource Limits)
TheexecutionLimits option sets iteration limits for commands, which protects against infinite loops and deep recursion.
All of these limits are optional and have reasonable defaults.
You can override them to suit your needs.
fetch (Custom Fetch)
Thefetch option allows you to use a custom fetch implementation for network access. This is useful if you want to use a different HTTP client or proxy.
network (Network Access)
Network access is disabled by default. You can enable it with the network option.python (Python Runtime)
Python (CPython compiled to WASM) is opt-in due to additional security surface. Enable withpython: true:
javascript (JavaScript Runtime)
JavaScript and TypeScript execution via QuickJS is opt-in due to additional security surface. Enable withjavascript: true:
commands (Built-in Commands)
Thecommands option allows you restrict the built-in commands that are available. This is useful if you want to limit what your agents can do.
By default, all 90+ built-in commands are enabled.
customCommands (User-Defined Commands)
ThecustomCommands option allows you to provide your own custom commands to the shell.
logger (Logging Hooks)
Thelogger option allows you to hook into the internal logging of the shell.
This is useful if you want to trace the execution of commands for debugging or monitoring.
Available options
| Option | Description |
|---|---|
env | Environment variables available to commands |
cwd | Starting directory for command execution |
executionLimits | Iteration limits for commands |
fetch | Custom fetch implementation for network access |
network | Enable network access |
python | Enable Python runtime |
javascript | Enable JavaScript runtime |
commands | Which built-in commands to enable |
customCommands | User-defined custom commands |
logger | Logging interface |
Direct Filesystem Operations
You can also use the Mesa filesystem directly without going through bash. The filesystem implements the fulljust-bash IFileSystem interface:
Caching
For better performance on repeated reads, configure a disk cache:Limitations
- By default,
just-bashdoes not support installing dependencies (ex. runningnpm install) or executing arbitrary code (although you can enable Python and JavaScript execution via thepythonandjavascriptoptions). - Mesa just-bash is not currently supported in the browser or browser-like runtimes like Cloudflare Workers or Vercel Edge Functions. NOTE: this limitation is due to the use of NAPI — we will likely support a browser-runtime version in the future via a WASM build.
- Bun support is experimental and may not work in all cases. This is due to Bun’s incomplete support for NAPI.

