Skip to content

accumulateMessage

accumulateMessage(acc, message): void

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/core/runStats.ts:74

Fold one LangChain message (or message chunk) into the accumulator. Fail-soft: any unexpected shape is swallowed so a run is never affected. Harvests, when present:

  • usage_metadata.input_tokens / .output_tokens (summed; marks sawUsage),
  • tool names from an AIMessage’s requested tool_calls[].name AND from a ToolMessage’s own .name (the executed tool), so both “requested” and “executed” tools are captured, and
  • (BATCH-21) a per-ToolMessage result record — name + isError (from .status) + capped content — into acc.toolResults, so tool-RESULT assertions can grade what a tool returned.

RunStatsAccumulator

unknown

void