dabla commented on code in PR #76917:
URL: https://github.com/apache/airflow/pull/76917#discussion_r4708663183


##########
providers/common/ai/src/airflow/providers/common/ai/durable/capability.py:
##########
@@ -615,6 +616,13 @@ async def execute(
                 # Local validation of the arguments the recorded call was made 
with: nothing to
                 # save by replaying it, and it is the same on every attempt, 
so it takes no position.
                 return await body()
+            case CapabilityOperationId() if (parent := get_executing_step()) 
is not None and (

Review Comment:
   No, I never saw it diverge: that comment came from reading 
`DurableWorkspace._in_container()`, not from a run, as it said. I have now run 
your workspace case at fb1cfecb32d with pydantic-ai-slim 2.66.0 (an Airflow 
toolset tool that calls `ctx.workspace.stat`, with `LocalWorkspace`, fail on 
the final request, then retry). After the first attempt the journal holds 
`run_0_step_0` (the model request) and `run_0_step_1` (the tool call) and 
nothing for the workspace call; on the retry the tool and the `stat` do not run 
again. So there is no divergence, with this backend or another: I did not try 
any other.
   
   Your point about the nested agent is the part I got wrong. I expected the 
`parent.durable_run` check to keep that case working under the scope, but 
pydantic-ai runs the nested operation inline before it reaches the backend, so 
the inner run loses its own steps. The guard as it is covers what the scope 
would have broken. Fine to resolve from my side.
   



##########
providers/common/ai/src/airflow/providers/common/ai/operators/agent.py:
##########
@@ -547,7 +634,18 @@ class AgentOperator(CancellableAgentRunMixin, 
BaseOperator, HITLReviewMixin, Usa
         :ref:`the cross-attempt usage budget <agent-usage-budget>` for how
         it is persisted, reset, and how ``durable`` replay and HITL
         regeneration interact with it.
-    :param durable: When ``True``, attaches
+    :param durable: Whether a retry replays what earlier attempts completed 
instead of
+        running it again. ``None`` (default) turns it on on Airflow 3.3+ for a 
task that
+        can retry (``retries`` above 0, or from Airflow 3.4 a 
``retry_policy``), and off for
+        any other task. It also turns it off, with the reason in the task log, 
where it cannot
+        apply: a ``SandboxToolset``, an ``MCPToolset`` without an ``id``, a 
toolset without an
+        ``id`` inside a combined or wrapper capability or built by a 
``Toolset`` capability, a
+        capability pydantic-ai refuses to run durably 
(``Capability(toolsets=...)`` with a
+        toolset without an ``id`` among them), or a context with no task state 
store; and it

Review Comment:
   **[nit]** The `durable` parameter's list of where the default turns itself 
off misses the case fb1cfecb32d added.
   
   `_why_not_durable_by_default` now also returns 
`_get_model_switch_problem(...)`: a `ModelFallback`, or a capability whose 
`get_model()` returns something other than a model name. 
`durable_execution.rst` and the changelog say so; this docstring, which is what 
the API reference renders for `AgentOperator`, still stops at "a context with 
no task state store".



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to