feat/adds-delta-snapshot-token-optimization#51
Open
meprynshu wants to merge 4 commits into
Open
Conversation
…nfigure() with default to true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Delta Snapshot Optimization
Problem
On complex, data-dense pages (large tables, CRM dashboards, data grids), every tool call within an agentic step appends a full
ariaSnapshot()of theentire page to the conversation history. Token usage compounds across calls:
Tool call 1 → +80k tokens (full snapshot)
Tool call 2 → +80k tokens (full snapshot again)
Tool call 3 → +80k tokens (full snapshot again)
...
10 tool calls = ~1M tokens for one step
This causes token limit errors on complex multi-action steps and dramatically increases latency and cost.
Solution
Post-action snapshots now return only the lines that changed since the last snapshot, instead of the full page tree. The first snapshot of each step is
always full so the agent has complete context. Every subsequent snapshot within the same step is diffed against the most recently seen snapshot.
On by default. Disable globally with: