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!
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!