Bluestep JS Documentation
    Preparing search index...

    Interface AiCallResult

    Result of B.ai.call().

    interface AiCallResult {
        denialCode?: string;
        denialMessage?: string;
        exchanges: number;
        inputTokens: number;
        iterations: number;
        outputTokens: number;
        stopReason: string;
        text: string;
        toolCalls: {
            arguments: object;
            isError: boolean;
            name: string;
            result: string;
        }[];
    }
    Index

    experimental

    denialCode?: string

    Usage gate denial code. Populated only when stopReason == "ai_denied".

    denialMessage?: string

    User-facing usage gate denial message. Populated only when stopReason == "ai_denied".

    exchanges: number

    Number of times the onTurn continuation callback was invoked. Always 0 when no callback was provided.

    inputTokens: number

    Total input tokens consumed across all iterations of this call.

    iterations: number

    Number of provider round-trips performed (each tool_use cycle counts as one).

    outputTokens: number

    Total output tokens consumed across all iterations of this call.

    stopReason: string

    Reason the model stopped emitting. Provider-native when the model itself stopped — Anthropic emits "end_turn" / "max_tokens" / "tool_use"; OpenAI-compatible providers (OpenAI, Groq, Together, Mistral, …) emit "stop" / "length" / "tool_calls". Synthetic values added by the BSJS orchestration layer: "ai_denied", "budget_exceeded", "iteration_limit", "max_iterations", "on_turn_exchange_limit", "on_turn_returned_invalid". Provider/transport failures (rate limits, circuit breaker, etc.) are thrown as exceptions to the script rather than returned in this field. Scripts that need to branch on "normal end of turn" should match both "end_turn" and "stop" rather than hard-coding a single provider's vocabulary.

    text: string

    Final assistant text response.

    toolCalls: { arguments: object; isError: boolean; name: string; result: string }[]

    Summary of tool calls executed during this call. In agent stub mode (AiAgent.sendMessage(message, false)) every entry has result: "action queued" and isError: false — no executor was invoked.