airflow.providers.common.ai.durable.caching_model¶
Caching model wrapper for durable execution.
Attributes¶
Classes¶
Wraps a model to cache responses in ObjectStorage for durable execution. |
Module Contents¶
- class airflow.providers.common.ai.durable.caching_model.CachingModel(wrapped, *, storage, counter)[source]¶
Bases:
pydantic_ai.models.wrapper.WrapperModelWraps a model to cache responses in ObjectStorage for durable execution.
On each
request()call, checks if a cached response exists for the current step index and was produced by an equivalent request (same model, message history, settings, and tools – compared via fingerprint). If so, returns the cached response without calling the underlying model. Otherwise, calls the model and caches the response. A fingerprint mismatch means the agent changed between attempts; the stale entry is discarded and the step re-runs live.