models/
Reusable named model configurations, referenced from Agent.bx by name.
On this page
models/
models/ lets you define reusable, named model configurations as one .bx or .json file each, referenced from Agent.bx's model field by name (with no /, so it isn't mistaken for a provider/model slug):
// models/summarizer.bx
class {
function configure() {
return {
provider : "openai",
model : "gpt-5-mini"
};
}
}
// Agent.bx
class extends="bxModules.bxai.models.runnables.AiAgent" {
function init() {
super.init( name: "my-agent", model: aiModel( provider: "openai", params: { model: "gpt-5-mini" } ) )
return this
}
// Overrides the class's own model above - resolves against models/summarizer.bx
function configure() {
return {
model : "summarizer"
};
}
}
Discovery rules
- One entry per top-level
.bxor.jsonfile directly undermodels/(not recursive). - The entry name is the file's base name (
summarizer.bxβsummarizer). - Dotfiles and files with an unrecognized extension (like a
README.mdleft in the folder for your own notes) are ignored. - Two files resolving to the same name fail validation with a duplicate-name error.
Validation
If Agent.bx's model has no /, it must be either a known core provider name (see Agent.bx) or match a models/ entry's name - anything else fails validation with a clear "no provider and does not match any models/ entry" error.