Open Agent Loops
API Reference

retainsReasoningHistory

@open-agent-loops/core


function retainsReasoningHistory(kwargs): boolean;

Defined in: providers/reasoning-kwargs.ts:365

Whether a resolved chat_template_kwargs set asks the model to retain its FULL reasoning history across turns — "Preserved Thinking" rather than plain interleaved thinking. True when a family's continuity key is present: GLM's clear_thinking: false or Kimi/Qwen's preserve_thinking: true.

The distinction drives how much reasoning the loop resends. Interleaved thinking needs reasoning only on tool-call turns; preserved thinking needs it on EVERY assistant turn, so the resent history matches what the kwarg promises (GLM/Kimi/Qwen want the complete, in-order reasoning sequence back). The loop reads this — via ModelClient.retainsReasoning — to decide whether to keep reasoning on plain (non-tool-call) turns too.

Parameters

ParameterTypeDescription
kwargsRecord<string, unknown> | undefinedThe resolved chat_template_kwargs, or undefined.

Returns

boolean

true when a preserve-everything continuity key is set.

On this page