GitHub user purushah added a comment to the discussion: [Discussion] Context 
compaction for Flink Agents

Thanks, this is a clear direction. I agree with the sequence: a hardened PR for 
A1 and A2 first, C1 next under the same design, C2 and D later, and group B 
tracked as Memory API work (`MemoryObject.remove` plus a documented pattern; 
`append` can wait).

On the round cap, agreed. It controls how long the loop runs, not what the 
model sees, so it leaves the compaction PR and gets designed together with the 
time, round and token budgets in the 1.0 priorities, including the `finish` 
behaviour. I'll drop it from the hardened PR.

One place where I'd push back a little.

**Scope of the policy.** Per logical chat request is the right unit for the 
semantics. For configuration I'd still want an agent-level default, with 
per-request override. Most users want one policy per agent, and setting it on 
every request repeats the same values at every call site. So: 
`context-management.*` as execution options for the default, and the same keys 
accepted as request parameters to override. On "round": one model call plus 
every tool call that reply requested, so parallel tool calls in one assistant 
message are one round.

Agree on the rest. Standard placeholder for v1. Summariser defaults to the 
request's chat model with an explicit resource as override. Budget plus trigger 
threshold for C1, with task instructions, constraints, the last K turns and 
tool-call/result pairing kept verbatim.

Two points on how A1, A2 and C1 combine, which I'll write into the PR docs:
- Order: truncate a result before its first send (A2), mask older rounds in 
steps (A1), summarise only when the estimate is still over budget (C1).
- The summariser reads the stored originals of the rounds it folds, not the 
placeholders, otherwise it summarises placeholders.

For token estimation I'll propose a small interface: count the full input 
including tool definitions, a provider-specific implementation where one 
exists, and a labelled approximate fallback. The previous round's reported 
usage is a cheap check on the estimate.

Next step from me: PR for A1 and A2 (masking in steps, as jimy-r suggested, 
with a restart test and trace entries per compaction step), then a short 
write-up for C1 and the estimator. I'll open the group B issue separately and 
link it here.


GitHub link: 
https://github.com/apache/flink-agents/discussions/1202#discussioncomment-19271596

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to