Skip to main content

Interface: BaleybotConditionalConfig

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

Configuration for BaleybotConditional Extends BaleybotConfig for future extensibility

Extends

Properties

activeTools?

optional activeTools?: readonly string[]

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

BaleybotConfig.activeTools


codeExecution?

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

BaleybotConfig.codeExecution


goal

goal: string

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

What the baleybot is trying to accomplish

Inherited from

BaleybotConfig.goal


keepHistory?

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

BaleybotConfig.keepHistory


maxTokens?

optional maxTokens?: number

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

Maximum tokens for LLM response (optional)

Inherited from

BaleybotConfig.maxTokens


memory?

optional memory?: 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 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 | 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 LanguageModel instance (passthrough — covers the whole AI SDK catalog, community providers, and createOpenAICompatible)
  • Undefined: Auto-selects based on available API keys

Inherited from

BaleybotConfig.model


name

name: string

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

Baleybot name (for logging/debugging)

Inherited from

BaleybotConfig.name


onStepEnd?

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

BaleybotConfig.onStepEnd


output?

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

BaleybotConfig.output


prepareStep?

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

BaleybotConfig.prepareStep


repairToolCall?

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

BaleybotConfig.repairToolCall


runtimeContext?

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

BaleybotConfig.runtimeContext


sandbox?

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

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


skills?

optional skills?: 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_skill tool) into its tools map 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

BaleybotConfig.skills


smoothStream?

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

BaleybotConfig.smoothStream


stopWhen?

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

BaleybotConfig.stopWhen


systemPromptBuilder?

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

optional temperature?: number

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

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

BaleybotConfig.toolChoice


toolFailMode?

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


toolOrder?

optional toolOrder?: readonly string[]

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

BaleybotConfig.toolOrder


tools?

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

BaleybotConfig.tools


verbose?

optional verbose?: boolean

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

Enable verbose logging

Inherited from

BaleybotConfig.verbose