Skip to main content

mask_observations

Function mask_observations 

Source
pub fn mask_observations(messages: &mut [Message], keep_recent_turns: usize)
Expand description

Replace old tool result content with lightweight placeholders.

A “turn” is one assistant message plus its following tool results. Keeps the last keep_recent_turns turns fully intact. For older turns, tool result content is replaced with a summary placeholder preserving the tool name, a truncated summary of args, and the byte count.