Repository navigation
Fix agent HITL review for list, marker and function output types - #74537
Conversation
Signed-off-by: PoAn Yang <payang@apache.org>
803cbd3 to
6f5025a
Compare
kaxil
left a comment
There was a problem hiding this comment.
Thanks, the approved answer now comes back as the agent returned it, so [str, int] keeps "42" a string and the list, marker and function shapes no longer fail. LGTM.
One thing for a follow-up: the path without review (_complete_run, the if self._serialize_model_output and isinstance(output, BaseModel) branch) still dumps a model only when serialize_output is set. With output_type=[Summary, int] and review off, a 3.3+ worker pushes a Summary instance that the downstream pull rejects with the allow-list ImportError, while the review path now pushes a dict. That was already true before this PR. A small _to_xcom helper holding the condition you added here, called from both returns, would make the two paths agree.
Also minor: the tests that set run_hitl_review's return value to the agent's own output (test_execute_with_enable_hitl_review_delegates_to_run_hitl_review, test_execute_with_hitl_returns_string_unchanged, test_hitl_branch_success_also_deletes_the_budget_key) can no longer tell which value execute returns. One of them could return different text and assert the result is still the agent's, and test_execute_with_hitl_rehydrates_base_model still has the name and comment from the parse-back.
|
Merged but can you handle those minor comments in a follow-up PR @FrankYang0529 |
Why
output_typeafter human review #73904 (in apache-airflow-providers-common-ai 0.11.0rc1) madeAgentOperatorconvert an answer approved in HITL review with a pydanticTypeAdapterbuilt fromoutput_type. The following cases work on 0.10.0 but break on 0.11.0rc1:[Verdict, Other], raisesPydanticSchemaGenerationError, and the task fails.ToolOutput(Verdict), raisesAttributeError, and the task fails.NativeOutput,PromptedOutputandTextOutputfail the same way.TypeAdaptervalidates the approved text as the function's arguments and calls the function a second time.How
AgentOperatorreviewer can approve, reject or ask for a new answer, but cannot edit the answer. SoAgentOperatornow keeps the output of the last run or regeneration and returns it when the reviewer approves, instead of converting the approved text. The operator no longer callsrehydrate_pydantic_output.Was generative AI tooling used to co-author this PR?