FIBRE_API_KEY and FIBRE_API_URL=https://api.fibre.dev. For the
steps that call a model, you also need your model provider’s API key.
One sandbox per conversation
Create a sandbox when a conversation starts, and label it with the conversation’s ID so that the next turn can find it again:Response
Response
response
The tool’s function
The tool itself is a single function. It runs a shell command in the sandbox and returns the exit code and the end of the output. Returning only the end matters: a command that prints a lot of text would otherwise fill up the model’s context. A command that runs for more than two minutes is stopped, and the model is told why.Response
Response
response
Hand it to the framework
Every framework describes a tool in the same way: a name, a description that the model reads to decide when to use it, the shape of its input, and the function to call. Here is the same tool for the AI SDK and for OpenAI Agents:sbx.files.read, sbx.files.write). If it needs the web,
add a tool for the sandbox’s browser.
What the model can reach
It is worth being clear about what the model can and cannot reach through this tool:- It can only reach the sandbox. Your Fibre API key stays in your app, inside
runCommand. The model sends a command and gets its output back, but never sees the key. - The sandbox has none of your app’s secrets or files, unless you put them there. Anything you do put there, the model can read with its next command.
- The sandbox can reach the internet, so the agent can install packages and fetch pages. To limit that, see network access.
Between turns
Between turns, the sandbox goes to sleep after its idle timeout, with its memory and files saved, and the next tool call wakes it. A conversation can therefore pause for minutes or hours and pick up again with everything in place. Read more in sleep, wake and lifetime.When the conversation ends
Response
Response
response