Handling Files
Learn how file inputs and sandboxed file references work in Bluebag.
When using the ai-sdk v5, you send files to the server and they're automatically received in messages when passed to the model.
With Bluebag, this remains the same.
// handles files automatically
const config = bluebag.enhance(...)File support is automatically handled via the bluebag.enhance method.
Under the hood
By default, files uploaded will be sent to the model, and also persisted in the bluebag sandbox so your agents have access to the files in any given session.
For most usecases there's nothing more to do. Files are automatically handled and avialable to manipulate via Agent Skills.
Prevent files from being sent to the LLM
In certain cases, you want the LLM to have access to the files via Bluebag, but you don't want the files to be sent directly to the model.
const bluebag = new Bluebag({
apiKey: process.env.BLUEBAG_API_KEY,
/**
* This will prevent zip files from being sent to the LLM
* but still available for manipulation via Skills
*/
stripMimeTypes: ["application/zip"],
});For example, if you were processing zip files, some models have strict limits.
You may bypass sending the files to the model, but still make them available to the agent in the bluebag sandbox so they can be manipulated via Agent Skills.
A good example is the zip-handler Skill.
To do this, use the stripMimeTypes option when initialising Bluebag and pass it the mime types to ignore. This will prevent the file from being sent directly to the LLM, but persisted in the bluebag sandbox and availble to manipulate via Skills.