airflow.providers.common.ai.durable.fingerprint¶
Request fingerprints for durable replay verification.
Durable caching keys steps positionally (model_step_{N} / tool_step_{N}).
Position alone cannot tell whether a cached entry still corresponds to the
current request: if the prompt, model, toolset, or message history changed
between the failed attempt and the retry, replaying by position would feed the
agent responses recorded for a different conversation.
Each cache entry therefore stores a fingerprint of the request that produced
it. On a cache hit the stored fingerprint is compared against the current
request; a mismatch is treated as a cache miss and the step re-runs live.
A divergence invalidates downstream steps too: a fresh model response carries
newly generated tool_call_id values, which are part of the tool
fingerprint, so stale tool results recorded under the old conversation no
longer match.
Fields that pydantic-ai regenerates on every attempt (message-level
timestamp/run_id/conversation_id and part-level timestamp)
are excluded from the fingerprint. Requests that cannot be serialized to
JSON fingerprint as None, which degrades that step to unverified
positional replay (the pre-fingerprint behavior) rather than disabling
caching.
Attributes¶
Functions¶
|
Fingerprint a model request: model identity, message history, settings, and request parameters. |
|
Fingerprint a tool call: tool name, arguments, and the model-issued call id. |
Module Contents¶
- airflow.providers.common.ai.durable.fingerprint.fingerprint_model_request(model_identifier, messages, model_settings, model_request_parameters)[source]¶
Fingerprint a model request: model identity, message history, settings, and request parameters.
The full
ModelRequestParametersobject is hashed (tool definitions, output mode and schema, native tools, …) so any change to what is sent to the model invalidates the cached response.Returns
Nonewhen the request cannot be serialized;Nonecompares equal toNone, so requests that cannot be fingerprinted degrade to unverified positional replay rather than disabling caching.
- airflow.providers.common.ai.durable.fingerprint.fingerprint_tool_call(name, tool_args, tool_call_id)[source]¶
Fingerprint a tool call: tool name, arguments, and the model-issued call id.
tool_call_idround-trips through the model-response cache, so it is stable under faithful replay but regenerated whenever a live model call replaces a cached response – chaining invalidation to downstream tool steps.