Interface: BaleybotConditionalConfig
Defined in: packages/core/src/conditional.ts:13
Configuration for BaleybotConditional Extends BaleybotConfig for future extensibility
Extends
Properties
activeTools?
optionalactiveTools?: readonlystring[]
Defined in: packages/core/src/baleybot.ts:283
AI SDK activeTools passthrough — restrict which of the declared tools
the model may call. Thin passthrough, no baleybots semantics; overridable
per-call via ProcessOptions.activeTools.
Inherited from
codeExecution?
optionalcodeExecution?:boolean
Defined in: packages/core/src/baleybot.ts:254
Enable Anthropic's programmatic code execution (tool calling). When true, the bot automatically gains a code execution tool and container IDs are forwarded between steps.
Requires @ai-sdk/anthropic to be installed.
Example
const bot = new Baleybot({
name: 'analyst',
goal: 'Analyze data with code',
codeExecution: true,
tools: { queryDatabase },
});
Inherited from
goal
goal:
string
Defined in: packages/core/src/baleybot.ts:91
What the baleybot is trying to accomplish
Inherited from
keepHistory?
optionalkeepHistory?:boolean|History
Defined in: packages/core/src/baleybot.ts:167
Enable conversation history tracking (optional)
When enabled, the Baleybot will automatically track conversation history across multiple process() calls, maintaining context between interactions.
Options:
true: Creates in-memory history (lost when process exits)History.inMemory(): Explicitly create in-memory historyHistory.file('path'): Persist history to a JSON file- Custom History instance: Use your own storage backend
Examples
In-memory history
const bot = Baleybot.create({
name: 'assistant',
goal: 'Help the user',
keepHistory: true, // Auto-creates in-memory history
});
File-based history
import { History } from '@baleybots/core';
const bot = Baleybot.create({
name: 'assistant',
goal: 'Help the user',
keepHistory: History.file('./chat-history.json'),
});
Inherited from
maxTokens?
optionalmaxTokens?:number
Defined in: packages/core/src/baleybot.ts:317
Maximum tokens for LLM response (optional)
Inherited from
memory?
optionalmemory?:MemoryBankLike
Defined in: packages/core/src/baleybot.ts:365
Persistent memory for this agent. When provided, the bot:
- auto-adds the memory bank's tool (typically
remember) to itstools - injects
bank.buildContext()into the system prompt every turn
Structural typing keeps @baleybots/core from depending on
@baleybots/memory (which itself depends on this package). Any object
implementing MemoryBankLike works — including MemoryBank from
@baleybots/memory.
Inherited from
model?
optionalmodel?:string|ModelConfig|LanguageModelLike
Defined in: packages/core/src/baleybot.ts:106
Model configuration (optional)
If not provided, auto-selects a provider based on available API keys: Priority: OpenAI (gpt-4.1-mini) → Anthropic (claude-haiku-4-5)
Can be:
- String: 'gpt-4.1-mini' (uses env vars for auth)
- Object: { id: 'gpt-4.1-mini', config: { apiKey: '...' } }
- A direct AI SDK
LanguageModelinstance (passthrough — covers the whole AI SDK catalog, community providers, andcreateOpenAICompatible) - Undefined: Auto-selects based on available API keys
Inherited from
name
name:
string
Defined in: packages/core/src/baleybot.ts:88
Baleybot name (for logging/debugging)
Inherited from
onStepEnd?
optionalonStepEnd?:GenerateTextOnStepEndCallback<ToolSet>
Defined in: packages/core/src/baleybot.ts:297
AI SDK onStepEnd passthrough — called when each step (LLM call) ends,
including intermediate tool-loop steps. Overridable per-call via
ProcessOptions.onStepEnd.
Inherited from
output?
optionaloutput?:OutputConfig<undefined>
Defined in: packages/core/src/baleybot.ts:130
Output configuration (v6)
Recommended over outputSchema. Provides cleaner API with
Output.object(), Output.array(), and Output.choice() helpers.
Example
import { Output } from '@baleybots/core';
const bot = new Baleybot({
name: 'analyzer',
goal: 'Analyze sentiment',
output: Output.object({
schema: z.object({
sentiment: z.enum(['positive', 'negative', 'neutral']),
confidence: z.number(),
}),
}),
});
Inherited from
prepareStep?
optionalprepareStep?:PrepareStepFunction<ToolSet>
Defined in: packages/core/src/baleybot.ts:276
AI SDK prepareStep passthrough — inspect or adjust each step of the tool
loop (messages, model, tools, toolChoice, activeTools) before it runs, and
return per-step overrides. Composed AFTER any internal hook (code-execution
container forwarding), so container IDs are still forwarded when
codeExecution is enabled.
This is a thin passthrough of the AI SDK's own prepareStep — see the AI
SDK docs for the argument shape and the override fields it accepts.
Example
const bot = new Baleybot({
name: 'analyst',
goal: 'Analyze data',
prepareStep: ({ stepNumber }) =>
stepNumber === 0 ? { toolChoice: 'required' } : {},
});
Inherited from
repairToolCall?
optionalrepairToolCall?:ToolCallRepairFunction<ToolSet>
Defined in: packages/core/src/baleybot.ts:304
AI SDK experimental_repairToolCall passthrough — repair a tool call the
model produced with invalid input or an unknown name. Overridable per-call
via ProcessOptions.repairToolCall.
Inherited from
runtimeContext?
optionalruntimeContext?:unknown
Defined in: packages/core/src/baleybot.ts:311
AI SDK runtimeContext passthrough — user-defined context threaded through
the generation lifecycle (visible to tools, prepareStep, approval fns).
Overridable per-call via ProcessOptions.runtimeContext.
Inherited from
sandbox?
optionalsandbox?:object
Defined in: packages/core/src/baleybot.ts:232
Sandbox configuration for code execution (optional)
When provided, the bot automatically gains a code_execution tool
that runs Python in an isolated microVM. Bridged tools (from the
tools config) are callable from within the sandbox via WebSocket.
provider
readonlyprovider:string
createProvider()
createProvider():
any
Returns
any
Example
import { microsandbox } from '@baleybots/sandbox'
const bot = new Baleybot({
name: 'coder',
goal: 'Write and run code',
sandbox: microsandbox({ memory: 1024 }),
tools: { queryDb },
});
Inherited from
skills?
optionalskills?:Skill[]
Defined in: packages/core/src/baleybot.ts:389
Skills available to this agent. A Skill is a keyword-triggered instruction sheet that bundles the tools it talks about. When provided, the bot:
- hoists every skill's tools (plus a shared
load_skilltool) into itstoolsmap at construction — tools are declared up front, never removed - injects, every turn, an always-on skill index plus the full
instructions of any skill whose keyword matches the input or that the
model has activated via
load_skill
Skills are inert guidance: they steer the agent toward tools that are already declared and already gated. They grant no capability of their own.
Scoping: keyword triggers are stateless (re-evaluated per turn). A skill the
model activates via load_skill stays active — and is re-injected into every
subsequent prompt — until the model calls unload_skill or the conversation
is reset; it is also forgotten on clearHistory(). Like conversation
history, this state is per-Baleybot-instance — treat one instance as one
conversation rather than sharing it across concurrent, unrelated requests.
See
docs/spikes/core-skill-primitive-plan.md
Inherited from
smoothStream?
optionalsmoothStream?:boolean| {chunking?:RegExp|"word"|"line";delayInMs?:number; }
Defined in: packages/core/src/baleybot.ts:340
Smooth streaming output for chat UIs — buffers tokens and releases them in configurable chunks (default: word-by-word, 10ms). Reduces flicker when models burst tokens.
true: enable with AI SDK defaults- object: configure delay and chunking strategy
Powered by AI SDK's smoothStream transform.
Inherited from
stopWhen?
optionalstopWhen?:StopCondition
Defined in: packages/core/src/baleybot.ts:200
Stop condition for the tool loop (AI SDK stopWhen).
Controls when the tool execution loop should stop.
Replaces maxToolIterations with more flexible conditions.
Default: stepCountIs(50). When that default (or a maxSteps
fallback) fires, the stream emits done with
reason: 'out_of_iterations' and iteration_count set — not a silent
normal finish. Raise the cap explicitly for long autonomous runs.
Examples
Stop after 10 iterations
stopWhen: stepCountIs(10)
Stop when a specific tool is called
stopWhen: hasToolResult('submit_answer')
Combined conditions
stopWhen: combineConditions(
stepCountIs(50),
hasToolResult('done'),
)
Default
stepCountIs(50)
Inherited from
systemPromptBuilder?
optionalsystemPromptBuilder?: (input) =>string|Promise<string>
Defined in: packages/core/src/baleybot.ts:353
Dynamic system-prompt builder invoked on every turn before tool/schema instructions are appended. Receives the current user input and returns additional markdown to splice into the system message.
Use this for per-turn injection (e.g. memory banks, freshly retrieved
context). The returned string is appended after goal and before the
tool/schema wrappers — so it sees no automatic decoration.
Returning an empty string is a no-op.
Parameters
input
string
Returns
string | Promise<string>
Inherited from
BaleybotConfig.systemPromptBuilder
temperature?
optionaltemperature?:number
Defined in: packages/core/src/baleybot.ts:320
Temperature for response randomness (0–2, provider-dependent).
Inherited from
toolChoice?
optionaltoolChoice?:"auto"|"none"|"required"
Defined in: packages/core/src/baleybot.ts:328
Controls whether the model must call tools.
- 'auto' (default): Model decides whether to call tools
- 'required': Model must call a tool on every step (prevents text-only exits from tool loop)
- 'none': Model cannot call tools
Inherited from
toolFailMode?
optionaltoolFailMode?:ToolFailMode
Defined in: packages/core/src/baleybot.ts:211
Controls what happens when a tool call fails during execution.
'returnToAI'(default): Error becomes the tool's return value. The LLM continues and can retry/adapt.'returnToUser': Error becomes the tool result, then one more LLM call withtoolChoice: 'none'— forces a text response about the error.'throw': Error is re-thrown fromexecuteTools, breaking the tool loop entirely. Caller must catch.
Default
'returnToAI'
Inherited from
toolOrder?
optionaltoolOrder?: readonlystring[]
Defined in: packages/core/src/baleybot.ts:290
AI SDK toolOrder passthrough — control the order tools are sent to the
provider (partial lists allowed; unlisted tools are appended
alphabetically). Overridable per-call via ProcessOptions.toolOrder.
Inherited from
tools?
optionaltools?:Record<string,never>
Defined in: packages/core/src/baleybot.ts:133
Tools available to the baleybot (optional) - supports traditional tools and Processable agents
Inherited from
verbose?
optionalverbose?:boolean
Defined in: packages/core/src/baleybot.ts:314
Enable verbose logging