GitHub user purushah added a comment to the discussion: [Discussion] Context compaction for Flink Agents
Thanks, this is useful metering. Yes, option 1 masks at a sliding boundary today: the keep-last-N cut is recomputed every round, so another round's results become placeholders each round and, as you say, the kept rounds behind them lose their cache prefix. We made exactly that argument for summaries in strategy 5 and did not carry it over to masking. I'll add a step parameter so masking waits until K rounds are eligible and clears them in one pass (Anthropic's clear_at_least is the same idea: it sets a minimum of tokens cleared per step so the cache break is worth it, while its keep count is in tool uses), and measure provider-reported cached tokens per round with and without it. On truncation: max-chars applies before a result's first send and on each later send until it is masked, while the stored original is kept during the request. Your position-is-price point is a good reason to document it as the first knob and masking as the second. On group B: agreed, identifiers in state and originals fetched on demand rather than copied. One correction to what I had in mind: the stored tool-call context is cleared when a request completes, so pointers that outlive a request need a store that is kept on purpose, with a retrieval path. I'll make that explicit in the write-up. Thanks for the PATTERNS link. GitHub link: https://github.com/apache/flink-agents/discussions/1202#discussioncomment-19060199 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected]
