Skip to main content

Variable: Baleybots

const Baleybots: object

Defined in: packages/core/src/index.ts:622

Type Declaration​

conditional​

conditional: (config) => Processable<unknown, boolean>

A yes/no decision, answered by whoever is configured to answer it.

A condition is z.boolean().describe(goal) — a constrained schema — so a bounded-decision provider can answer it natively and a model can answer it as structured output. Both are answers to the same question; neither is the primary path.

Which one runs is resolved when the conditional runs, not when it is built, so a pipeline defined before setDefaults() still finds the model, and one invocation can override it through ProcessOptions.defaults.

Parameters​

config​

ConditionalConfig

Returns​

Processable<unknown, boolean>

Example​

const isSpam = conditional({ name: 'spam-filter', goal: 'Is this email spam?' });
await isSpam(email); // boolean, from the decision provider or a model

create​

create: <TOutputSchema, TTools>(config) => Baleybot<TOutputSchema, TTools>

Create a new Baleybot (static factory method for convenience)

When output is undefined or omitted, the output type is inferred as string.

Type Parameters​

TOutputSchema​

TOutputSchema = undefined

TTools​

TTools extends Tools = Record<string, never>

Parameters​

config​

BaleybotConfig<TOutputSchema, TTools>

Returns​

Baleybot<TOutputSchema, TTools>

Example​

// Without model - auto-selects based on available API keys
const bot = Baleybot.create({
name: 'my-bot',
goal: 'Help users'
// No model specified - auto-selects!
});
const result: string = await bot.process('Hello');

// With explicit model
const bot2 = Baleybot.create({
name: 'my-bot',
goal: 'Help users',
model: 'gpt-5.6-luna'
});
const result2: string = await bot2.process('Hello');

// With output - returns typed output
const bot3 = Baleybot.create({
name: 'my-bot',
goal: 'Help users',
model: 'gpt-5.6-luna',
output: Output.object({ schema: z.object({ sentiment: z.string() }) })
});
const result3: { sentiment: string } = await bot3.process('Hello');