kaxil commented on code in PR #70651:
URL: https://github.com/apache/airflow/pull/70651#discussion_r3707250944
##########
providers/common/ai/docs/operators/llm_branch.rst:
##########
@@ -75,6 +75,26 @@ With multiple branches:
:start-after: [START howto_decorator_llm_branch_multi]
:end-before: [END howto_decorator_llm_branch_multi]
+Human-in-the-Loop Approval
+--------------------------
+
+Set ``require_approval=True`` to pause the task after the LLM chooses the
+branch(es) and wait for a human reviewer to approve the choice before any
+downstream task is skipped. The review form shows the LLM's choice and the
+valid downstream task IDs. When ``allow_modifications=True``, the reviewer
+can also change the choice — rendered as a dropdown of the downstream task
+IDs, or a free-text JSON list of task IDs (e.g. ``["task_a", "task_b"]``)
+with ``allow_multiple_branches=True``. The reviewed branch(es) are validated
+against the downstream task IDs before branching:
+
+.. exampleinclude::
/../../ai/src/airflow/providers/common/ai/example_dags/example_llm_branch.py
+ :language: python
+ :start-after: [START howto_operator_llm_branch_approval]
+ :end-before: [END howto_operator_llm_branch_approval]
+
+``approval_timeout`` and the rest of the approval behaviour are inherited
Review Comment:
Two things missing from this section. Reject and a timeout both fail the
task, because `LLMApprovalMixin.execute_complete` raises `HITLRejectException`
/ `HITLTimeoutError`, so declining the LLM's routing leaves downstream tasks
`upstream_failed` rather than skipped, the opposite of `ApprovalOperator`,
whose docstring calls failing on reject "generally discouraged" for mixing
human decision outcomes with task states. And line 67 tells the reader the
callable may return a `Sequence[UserContent]` directly above a section telling
them to set `require_approval=True`, with no note that the combination raises
`TypeError`, which `llm.rst:162-164` does carry. `do_branch(context, None)`
already means skip-all-downstream in `BranchMixIn` if you want the reject path
to match.
--
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]