airflow.providers.common.ai.durable.caching_model

Caching model wrapper for durable execution.

Attributes

log

Classes

CachingModel

Wraps a model to cache responses in ObjectStorage for durable execution.

Module Contents

airflow.providers.common.ai.durable.caching_model.log[source]
class airflow.providers.common.ai.durable.caching_model.CachingModel(wrapped, *, storage, counter)[source]

Bases: pydantic_ai.models.wrapper.WrapperModel

Wraps 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.

storage: airflow.providers.common.ai.durable.storage.DurableStorage[source]
counter: airflow.providers.common.ai.durable.step_counter.DurableStepCounter[source]
async request(messages, model_settings, model_request_parameters)[source]

Make a request to the model.

This is ultimately called by pydantic_ai._agent_graph.ModelRequestNode._make_request(…).

Was this entry helpful?