Feature Request: Size-based composition
📝 Overview
Currently, reflection occurs on an interval basis. LLM has a limit of max token. There is a high possibility that max token will occur on an interval basis. If you compare before max token occurs based on size, you will be able to lower the problem of llm bursting due to max token.
🎯 Proposed Feature Description: For example, if possible, calculate the current input to detect that it is adjacent to the max token and perform reflection.
🛠️ Benefits The probability of the problem due to the maximum input token may be further reduced.
@maxx1958 Thank you for submitting this feature request. It’s currently under review by our product team, and I’ll keep you posted on any updates. We appreciate your input! Thanks.
size-based compaction landed in v1.25.0, alongside the interval trigger. set token_threshold and event_retention_size on EventsCompactionConfig (import from google.adk.apps.app) and leave compaction_interval unset. compaction then runs when the prompt token count hits your threshold rather than after a fixed number of invocations, keeping the last event_retention_size raw events uncompacted.
evaluated at two points, before the next model request and after each invocation. uses the most recent prompt token count, estimating from current contents when no usage metadata is available.
you pick the threshold, adk doesn't derive it from the model's limit. the api is still experimental.