Skip to content

Return an approved agent answer as output_type after human review - #73904

Merged
kaxil merged 1 commit into
apache:mainfrom
astronomer:agent-hitl-review-keeps-string-output
Sep 29, 2026
Merged

kaxil merged 1 commit into
apache:mainfrom
astronomer:agent-hitl-review-keeps-string-output

Conversation

@kaxil

@kaxil kaxil commented Sep 29, 2026

Copy link
Copy Markdown
Member

With enable_hitl_review=True, AgentOperator ran the approved text through json.loads unless output_type was a Pydantic model. So with the default output_type=str, an approved answer of 42 came back as an int, and one that looked like a JSON object came back as a dict. @task.llm returns the same text unchanged.

It now uses the same conversion as LLMOperator's approval path: a str output passes through unchanged, any other output_type is validated from the JSON, and an edit the type rejects falls back to the reviewer's text. The new test fails on the old code for the two str cases.


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

With enable_hitl_review, AgentOperator ran the approved text through
json.loads unless output_type was a Pydantic model, so an answer of "42"
came back as an int and one that looked like a JSON object as a dict, even
with the default output_type=str. It now uses the same conversion as
LLMOperator's approval path: str passes through unchanged, and any other
output_type is validated from the JSON, falling back to the text a reviewer
edited into something the type rejects.
@kaxil
kaxil merged commit 029cdf8 into apache:main Sep 29, 2026
135 of 141 checks passed
@kaxil
kaxil deleted the agent-hitl-review-keeps-string-output branch September 29, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants