﻿# How can an application keep a transcript while trimming the model input?

How can an application keep a transcript while trimming the model input? Accept a run only when the transcript and the active context each meet their own contract.

Author: Retrivium editorial team
Updated: 2026-11-29
Canonical URL: https://retrivium.ai/journal/research-20261129-pydantic-trim-history-ledger/
Language: en

Pydantic AI v2.76.0, published November 26, keeps messages added by a run in result.conversation even when a capability trims the history during that run. The returned transcript and the prompt sent later can therefore serve different purposes.

## What the source establishes

Choose a clear distinction between a record of what happened and the bounded slices sent to the model. A retention decision for the record is separate from the context policy. Keep the model, task and tool definitions fixed while you change the session behavior.

## Design the comparison

Run a synthetic multi-turn task that trims mid-run. Compare the sequence of messages returned in result.conversation with the actual model input after trimming. Repeat a completion and watch for duplicate entries. 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

Confirm that omitted context and omitted history are not confused in UI and logs. Use artificial identifiers to trace messages without storing their content in production. 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

Accept a run only when the transcript and the active context each meet their own contract. Document which view powers replay or audit. 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

- [Primary source · pydantic-ai #13211](https://github.com/pydantic/pydantic-ai/pull/13211)
- [Primary source · pydantic-ai v2.76.0](https://github.com/pydantic/pydantic-ai/releases/tag/v2.76.0)

## Related reading

- [How can a gateway preserve reasoning metadata without displaying it?](/journal/daily-20261128-routing-litellm-reasoning-only-frames/)
- [Keep an OpenRouter tool conversation portable across eligible routes](/journal/learn-openrouter-tool-history-routing/)
