Skip to content

Conversation

@philipph-askui
Copy link
Contributor

I analyzed the truncation strategy that we are using for summarizing the message history for the LLM.
Currently, we are keeping all of the screenshots in the history and send them to the LLM with every request.
As you can imagine, this costs tons of token with a minimal chance of providing any relevant information to the LLM.

Hence, I implemented a new truncation strategy, that will only send the latest screenshot in the history to the LLM and replace all other screenshots with a string („Screenshot removed to save tokens“).
In small experiments, this allowed me to save up to 90% of token consumption.

However, there might be scenarios where keeping previous images in the history might help to explain e.g. when searching for something or trying to understand the UI transition graph. Hence, I marked this truncation strategy as experimental.

Summary of what I added:

  • New truncation strategy that will keep only the latest screenshot in the message history
  • Option to set the truncation strategy in the ActSettings
  • Doc explaining the truncation strategies and when to use them
  • Tests

@philipph-askui philipph-askui marked this pull request as ready for review December 5, 2025 13:12
@philipph-askui philipph-askui marked this pull request as draft December 9, 2025 20:32
@philipph-askui philipph-askui marked this pull request as ready for review December 9, 2025 20:43
@philipph-askui philipph-askui self-assigned this Dec 9, 2025
@philipph-askui philipph-askui changed the title Refined Truncation Strategy to save significant amount of tokens feat: refined Truncation Strategy to save significant amount of tokens Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants