发布

  • Python: Fix function_approval_response extraction in AG-UI workflow path (#4550)

    frostbyte_neo 发布于 2026-03-11 22:54:16 +00:00 | 1371 次提交 在此版本后已推送到 main

    • Extract function_approval_response from workflow messages (#4546)

    _extract_responses_from_messages now handles function_approval_response
    content in addition to function_result content. Previously, approval
    responses sent via the messages field were silently dropped because the
    function only checked for content.type == "function_result".

    The approval response is keyed by content.id and includes the approved
    status, id, and serialized function_call — consistent with how
    _coerce_content identifies approval response payloads.

    Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

    • Apply pre-commit auto-fixes

    • Fix #4546: Update docstring and add integration tests for message-based approvals

    • Update _extract_responses_from_messages docstring to reflect that it
      now handles function_approval_response content in addition to
      function_result content.
    • Add integration tests for run_workflow_stream across two turns with
      approval responses provided via messages (function_approvals) rather
      than resume.interrupts, covering both approved and denied scenarios.

    Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

    • Address PR review feedback for #4546
    • Use safer 'not .get("interrupt")' assertion instead of 'not in'
      to handle Pydantic v2 model_dump() including keys with None values
    • Add unit test for mixed function_result and function_approval_response
      in the same message to TestExtractResponsesFromMessages

    Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com


    Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

    下载附件