Lee-W commented on code in PR #73706:
URL: https://github.com/apache/airflow/pull/73706#discussion_r4140391960
##########
providers/common/ai/src/airflow/providers/common/ai/operators/agent.py:
##########
@@ -239,16 +256,47 @@ class AgentOperator(CancellableAgentRunMixin,
BaseOperator, HITLReviewMixin):
A dict that omits ``request_limit`` still gets pydantic-ai's default of
``50`` requests -- pass ``"request_limit": None`` explicitly for no
- request cap. See :ref:`howto/operator:llm` for the full set of caveats,
- and :ref:`howto/operator:agent` for the ``durable=True`` replay
- double-counting warning.
+ request cap.
+
+ On Airflow >= 3.3, when this is set, the limit counts usage across
+ every attempt of the task instance combined -- the initial run, every
+ retry, and every HITL regeneration all add to one running total kept
+ in the AIP-103 task state store under the ``__commonai_usage__`` key
+ -- rather than resetting on each attempt. This also applies to the
+ implicit ``request_limit=50`` default, which can now block a retry
+ that used to pass on its own. A step replayed by ``durable=True`` does
+ not count toward the total (see ``durable`` below). Clearing and
+ rerunning a *finished* (failed or
+ succeeded) task instance gets a fresh budget automatically; clearing
+ a *running* task instance does not bump ``max_tries``, so the
+ restarted attempt still sees the prior spend. To reset the budget for
+ a task instance that keeps retrying without a clear of a finished
+ attempt, delete the ``__commonai_usage__`` key via the Task State
+ Store UI. A worker killed with SIGKILL -- including after
+ ``on_kill``'s grace period expires, or an OOM kill -- cannot persist
+ that attempt's usage, so the next attempt's count under-represents
+ actual spend by that amount. To keep
+ the same effective per-attempt headroom this cross-attempt total used
+ to give each attempt on its own, scale each limit by
+ ``retries + 1``, or use ``usage_limits=None`` to opt back out. On
+ Airflow < 3.3, and whenever ``usage_limits`` is ``None``, each attempt
+ is still checked and counted on its own, as before. See
+ :ref:`howto/operator:llm` for the full set of caveats, and
+ :ref:`howto/operator:agent` for more on the cross-attempt budget.
Review Comment:
Sure. The `usage_limits` entry in `agent.rst` is now the only one with full
description. docstring and the changelog note are short summaries that link to
it.
--
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]