Repository navigation
Compaction or a held-state loop for jobs that edit a state step by step? #8367
gaurshalendra2412
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The ADK docs describe context compaction as summarizing older session history, by token threshold or by sliding window, to cut latency and cost. A question about one kind of job: an agent that edits a structured state (a schedule, an inventory, a config) one change per step, where later steps need exact values from earlier ones.
For that shape we tried not keeping the history at all. The host holds the state as data, the model proposes one change per step in a small strict format, a deterministic check admits or refuses it, and each prompt is rebuilt from the held state. It is a layer on the host side, for whoever runs the model; the model is unchanged, and it applies from the first step, short jobs and long. Gemini 3.8 Flash, direct API, not through ADK: 400 turns, 99,809 prompt tokens a turn with the chat kept against 1,177 with the held state; 1,500 steps, 1,500 of 1,500 states exact at about 2,824 prompt tokens a step.
At Gemini 3.8 Flash's own rates, one verified step of the 400-turn job cost $0.0014 with the held state, $0.0148 with the chat kept and the cache warm (worked out at the cached-token price) and $0.0870 with the chat kept and the cache cold. The total for the held-state and cold-chat runs together came within 1.3 percent of Google's billing report for that day: https://github.com/gaurshalendra2412/axi-runtime/blob/main/docs/BILLING_CHECK.md
Two questions for people who run ADK agents:
Tests and saved results: https://github.com/gaurshalendra2412/axi-runtime
I'm on Rajnish Choubey's team; the architecture is his, and I run the tests with an AI assistant as a tool. I'm not affiliated with Google.
All reactions