pub struct ObservationMaskingConfig {
pub max_iterations_to_keep: u32,
pub min_tokens_to_mask: u32,
}Expand description
Configuration for observation masking within the tool loop.
Observation masking replaces old tool results with compact placeholders to keep context size bounded during long tool loop runs. This is critical for agents that make many tool calls (10+) in a single request, where accumulated results can fill the context window.
§How it works
Tool results are tagged with the iteration they were produced in.
Before each LLM call, results older than max_iterations_to_keep
iterations are replaced with a placeholder like:
[Masked — {tool_name} result from iteration {N}, {tokens} tokens.
Use result_cache tool if available, or re-invoke tool.]Only results larger than min_tokens_to_mask are masked. Small
results (e.g., error messages, simple values) stay in-context.
Fields§
§max_iterations_to_keep: u32Mask tool results older than this many iterations ago.
For example, if max_iterations_to_keep = 2 and we’re on
iteration 5, results from iterations 1-2 may be masked.
Default: 2 (keep results from the last 2 iterations).
min_tokens_to_mask: u32Only mask results with estimated token count above this threshold. Small results (error messages, simple values) are kept inline.
Default: 500 tokens (~2000 chars).
Trait Implementations§
Source§impl Clone for ObservationMaskingConfig
impl Clone for ObservationMaskingConfig
Source§fn clone(&self) -> ObservationMaskingConfig
fn clone(&self) -> ObservationMaskingConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more