TECHNOLOGY

What should an agent do if history compaction fails?

In this article
THE QUICK TAKE

Use preservation of required context and a known token budget as acceptance gates.

Pydantic AI v2.77.0, released November 27, keeps the parent run alive when automatic SummarizingCompaction fails. The application can still encounter a context limit or an unavailable summarization provider. A continued run needs an explicit workload policy.

What the source establishes

Inspect which turn triggered compaction and which original facts remain available. Continuing can be safe for a small request whose context fits, while an already long run needs a size check. Keep the model, task and tool definitions fixed while you change the session behavior.

Design the comparison

In staging, let one compaction succeed and make another return a controlled failure. Compare next-turn inputs using a synthetic history with a relevant old fact. Record that failed compaction remains visible. Use simulated state and authorized no-op tools for the decision points in the example. Trace the structured result as well as the visible text.

Read the results

Measure successful task completion and whether required facts survived. Record context use and the number of retries, because repeated calls to an unavailable summarizer can hide the useful outcome. Check exactly which state the next turn receives. Classify decisions made by the runtime separately from those made by the model. Collect the primary outcome together with a measure of workload size. Preserve errors, timeouts and explicit fallbacks in the reported population. A median from successful samples can conceal a subgroup that operates on a different path. Store enough diagnostic context for another engineer to explain which part of the system caused the difference.

Decide what goes into service

Use preservation of required context and a known token budget as acceptance gates. Define a retry, partial result or stop when the full context exceeds the limit. State the acceptance threshold before choosing the implementation. Add the tested boundary and conditions for revisiting it to the release record. If an observed behavior differs from expectations, narrow the scope of the rollout while collecting evidence for that case. Keep the prior artifact or configuration available so the comparison remains repeatable.

Sources

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles