vercel-labs / vercel-labs/bash-tool

Support lazy sandbox initialization in createBashTool

Open
#18 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
622
Forks
43
Avg merge
22m
Merged PRs (30d)
1

Description

I’m building a chatbot that exposes tools to an LLM. In most conversations, users never need shell execution, so I only want to create a sandbox when a bash-related tool is actually called.

Current blocker:

createBashTool requires an already-created sandbox instance at tool initialization time.
In chatbot frameworks, tools are usually initialized upfront for every request/session.
This forces sandbox creation even when bash tools are never used, which adds avoidable latency/cost.
What I’m looking for
A way to initialize bash tools without an eager sandbox, for example:

Accepting a lazy provider: sandbox: Sandbox | (() => Promise)
Or a getSandbox() callback option that is called only on first tool execution
Or an officially supported “deferred init” API for tool construction

Why this matters

For agent/chatbot scenarios, lazy resource provisioning is important:

Most sessions are non-technical and never call bash tools
Eager sandbox creation wastes resources
Deferred creation improves startup performance and cost

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the createBashTool entry point and trace how the sandbox is currently required during tool initialization. Define completion as sandbox creation being deferred until the first bash-tool execution, while preserving the existing tool behavior for callers that provide a ready sandbox.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, typescript
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.