Quarkus LangChain4j tests what agents forget when prompts shrink
In one simulated incident, trimming old tool outputs nearly matched model-written summaries on recall without adding a model call.
Quarkus LangChain4j 2.0 introduced an experimental context-compaction extension that keeps the full conversation in the application’s chat store while sending the model a smaller view. A Nov. 30 engineering post from the Quarkus project compares eight strategies using a simulated incident. Its most useful result for teams building tool-heavy assistants: start by measuring what happens when you trim old tool output, before paying for a model to summarize the conversation.
What gets lost when the prompt shrinks
In the project’s fictional incident, tool results account for 73% of the conversation’s tokens. As logs and metrics fill the window, older messages fall out, including an instruction not to restart pods in one region. The token-window baseline then incorrectly tells the operator that a restart is allowed. Because the extension separates stored history from the view sent to the model, changing strategies does not require throwing away the original conversation. It does not, however, guarantee that the model sees the right detail on any given turn.
Pruning held up against summaries in one replay
The team replayed an 81-message conversation with a deliberately constrained 6,000-token window, asking nine recall questions three times. In the published results, pruning old tool output averaged 7 correct answers out of 9 and cut total prompt tokens by 49% relative to sending the full history. The default pipeline scored 7.5 out of 9 and saved 53%, but its slowest compaction added 5.2 seconds. Pruning did not call a model; it also lost facts that appeared only in tool results. The project treats the half-point recall gap as noise and cautions that the test covers one conversation and one answering model.
What to test before enabling it
For teams evaluating the extension, replay a representative long conversation and score the facts that matter to your workflow: an early user constraint, a decision made halfway through, or an identifier present only in a tool result. Measure the latency of the request that triggers compaction as well as total prompt tokens. And if the assistant can recommend or perform operational changes, enforce hard restrictions outside the model’s conversation history. Keeping a full transcript makes the omission inspectable after the fact; it does not make a compacted prompt an authorization check.
sources
comments · 0