Class-Based Agents
Build reusable, encapsulated agents by extending the AiAgent class instead of configuring everything inline with the aiAgent() BIF.
Why Use Class-Based Agents?
Minimal Class-Based Agent
// agents/SupportAgent.bx
class extends="bxModules.bxai.models.runnables.AiAgent" {
function init() {
super.init(
name : "SupportAgent",
description : "Customer support specialist",
instructions: "Resolve support issues clearly and politely"
)
return this
}
}Encapsulated Agent with Model, Memory, and Tools
Registering Class-Based Agents at Application Startup
Base Class + Specialized Agents
Sub-Agents Inside an Encapsulated Agent
Testing Pattern
When to Use aiAgent() vs Class-Based
aiAgent() vs Class-BasedApproach
Best For
Related Pages
Last updated