Skip to content

Fix agent HITL review for list, marker and function output types - #74537

Open
FrankYang0529 wants to merge 1 commit into
apache:mainfrom
FrankYang0529:fix-common-ai-hitl-output-spec
Open

FrankYang0529 wants to merge 1 commit into
apache:mainfrom
FrankYang0529:fix-common-ai-hitl-output-spec

Conversation

@FrankYang0529

Copy link
Copy Markdown
Member

Why

  • Return an approved agent answer as output_type after human review #73904 (in apache-airflow-providers-common-ai 0.11.0rc1) made AgentOperator convert an answer approved in HITL review with a pydantic TypeAdapter built from output_type. Following cases can pass in 0.10.0, but not 0.11.0rc1.
    • A list of output types, such as [Verdict, Other], raises PydanticSchemaGenerationError, and the task fails.
    • An output marker, such as ToolOutput(Verdict), raises AttributeError, and the task fails. NativeOutput, PromptedOutput and TextOutput fail the same way.
    • For an output function, TypeAdapter validates the approved text as the function's arguments and calls the function a second time.

How

  • rehydrate_pydantic_output handles an output_type that is neither a class nor a generic alias by parsing the approved text with json.loads. If the approved text is not JSON, the helper returns the text unchanged. 0.10.0 gave the same result. Classes and generic aliases such as list[str] or Verdict | Other still go through TypeAdapter.

Was generative AI tooling used to co-author this PR?
  • Yes - Claude Code

Signed-off-by: PoAn Yang <payang@apache.org>

This branch has not been deployed

No deployments
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.

1 participant