OptionalapiOptional API key to call the provider directly. When present, the call bypasses the web-global usage gate entirely (no preflight, no metering).
OptionalchatConversation history to seed the model with. Each entry is {role: "user"|"assistant"|"tool", content: string}. Overrides any server-side session.
OptionalflagCustom tracking flag (e.g. "marketingModule"). Reported to the usage gate so superusers can scope limits and reporting by flag.
OptionalmodelAI model identifier to use. Falls back to the provider's configured default when omitted.
OptionalonContinuation callback for script-driven multi-turn conversations. After each assistant turn (no outstanding tool calls), the callback is invoked with the response. Return an AiTurnDecision with a message to continue, or {done: true} / null to stop.
OptionalproviderAI provider name (e.g. "anthropic"). Falls back to the configured tenant default when omitted.
OptionalsystemSystem prompt. When provided, replaces the configured tenant default; per-call agent directives are still appended.
OptionaltoolsTool definitions exposed to the model. Each tool combines a JSON schema with a JS executor invoked when the model emits a tool_use block. Inline literals get their executor's args type derived from their own input_schema; tools produced by B.ai.tool.custom()/forNewEntry/forExistingEntry pass through as AiTool.
Shared options for
B.ai.agent(options)andB.ai.call'sAiCallOptions. The type parameterSchemascarries the literal types of each tool'sinput_schemaso inline tool literals get a typedexecutorargsparameter without an explicit cast — seeB.ai.call.