Skip to main content

Interface: BaleybotConditionalConfig

Defined in: packages/core/src/conditional.ts:12

Configuration for BaleybotConditional Extends BaleybotConfig for future extensibility

Extends

Properties

codeExecution?

optional codeExecution?: 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

BaleybotConfig.codeExecution


goal

goal: string

Defined in: packages/core/src/baleybot.ts:81

What the baleybot is trying to accomplish

Inherited from

BaleybotConfig.goal


keepHistory?

optional keepHistory?: 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 history
  • History.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

BaleybotConfig.keepHistory


maxTokens?

optional maxTokens?: number

Defined in: packages/core/src/baleybot.ts:244

Maximum tokens for LLM response (optional)

Inherited from

BaleybotConfig.maxTokens


memory?

optional memory?: 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 its tools
  • 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

BaleybotConfig.memory


model?

optional model?: 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

BaleybotConfig.model


name

name: string

Defined in: packages/core/src/baleybot.ts:78

Baleybot name (for logging/debugging)

Inherited from

BaleybotConfig.name


output?

optional output?: 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

BaleybotConfig.output


sandbox?

optional sandbox?: 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

readonly provider: 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

BaleybotConfig.sandbox


smoothStream?

optional smoothStream?: 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

BaleybotConfig.smoothStream


stopWhen?

optional stopWhen?: 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

BaleybotConfig.stopWhen


systemPromptBuilder?

optional systemPromptBuilder?: (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?

optional temperature?: number

Defined in: packages/core/src/baleybot.ts:247

Temperature for response randomness (0–2, provider-dependent).

Inherited from

BaleybotConfig.temperature


toolChoice?

optional toolChoice?: "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

BaleybotConfig.toolChoice


toolFailMode?

optional toolFailMode?: 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 with toolChoice: 'none' — forces a text response about the error.
  • 'throw': Error is re-thrown from executeTools, breaking the tool loop entirely. Caller must catch.

Default

'returnToAI'

Inherited from

BaleybotConfig.toolFailMode


tools?

optional tools?: 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

BaleybotConfig.tools


verbose?

optional verbose?: boolean

Defined in: packages/core/src/baleybot.ts:241

Enable verbose logging

Inherited from

BaleybotConfig.verbose