Interface: BaleybotConditionalConfig
Defined in: packages/core/src/conditional.ts:12
Configuration for BaleybotConditional Extends BaleybotConfig for future extensibility
Extends
Properties
codeExecution?
optionalcodeExecution?:boolean
Defined in: packages/core/src/baleybot.ts:238
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:81
What the baleybot is trying to accomplish
Inherited from
keepHistory?
optionalkeepHistory?:boolean|History
Defined in: packages/core/src/baleybot.ts:155
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
const bot = Baleybot.create({
name: 'assistant',
goal: 'Help the user',
keepHistory: true, // Auto-creates in-memory 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:244
Maximum tokens for LLM response (optional)
Inherited from
memory?
optionalmemory?:MemoryBankLike
Defined in: packages/core/src/baleybot.ts:292
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
Defined in: packages/core/src/baleybot.ts:94
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: '...' } }
- Undefined: Auto-selects based on available API keys
Inherited from
name
name:
string
Defined in: packages/core/src/baleybot.ts:78
Baleybot name (for logging/debugging)
Inherited from
output?
optionaloutput?:OutputConfig<undefined>
Defined in: packages/core/src/baleybot.ts:118
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
sandbox?
optionalsandbox?:object
Defined in: packages/core/src/baleybot.ts:216
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
smoothStream?
optionalsmoothStream?:boolean| {chunking?:RegExp|"word"|"line";delayInMs?:number; }
Defined in: packages/core/src/baleybot.ts:267
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:184
Stop condition for the tool loop (v6)
Controls when the tool execution loop should stop.
Replaces maxToolIterations with more flexible conditions.
Examples
stopWhen: stepCountIs(10)
stopWhen: hasToolResult('submit_answer')
stopWhen: combine(
stepCountIs(50),
hasToolResult('done'),
noToolCalls()
)
Default
stepCountIs(50)
Inherited from
systemPromptBuilder?
optionalsystemPromptBuilder?: (input) =>string|Promise<string>
Defined in: packages/core/src/baleybot.ts:280
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:247
Temperature for response randomness (0–2, provider-dependent).
Inherited from
toolChoice?
optionaltoolChoice?:"auto"|"none"|"required"
Defined in: packages/core/src/baleybot.ts:255
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:195
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
tools?
optionaltools?:Record<string,never>
Defined in: packages/core/src/baleybot.ts:121
Tools available to the baleybot (optional) - supports traditional tools and Processable agents
Inherited from
verbose?
optionalverbose?:boolean
Defined in: packages/core/src/baleybot.ts:241
Enable verbose logging