Repository navigation
Commit 8ea6f83
authored
Python: fix: preserve parallel function_result contents in AG-UI conversion (microsoft#7980)
* Python: fix: preserve parallel function_result contents in AG-UI conversion
agent_framework_messages_to_agui collapsed a tool Message carrying
multiple function_result contents (parallel tool calls) into a single
AG-UI tool message, keeping only the last call_id/result. Clients then
saw the missing results as pending tool approvals.
Emit one AG-UI tool message per function_result, each with its own
toolCallId and content, with distinct ids so downstream clients keyed
by id do not re-collapse them.
Fixes microsoft#7979
* Python: fix: preserve non-result contents in mixed AG-UI tool messages
A single Agent Framework message can carry function_result contents
alongside text or function_call contents (e.g. a finalized assistant
turn). The parallel-result fix emitted the tool messages then returned
early, dropping that leftover content.
Emit a separate, distinctly-identified AG-UI message for any remaining
text/tool_calls after the split tool results, so mixed messages are
preserved instead of silently losing the assistant output.
* Python: fix: use independent ids for split AG-UI tool messages
Deriving suffixes from the source id (f"{base_id}-{idx}") could collide
with a legitimate message id elsewhere in the converted history, letting
id-keyed clients re-collapse a result. Keep the source id for the first
result and generate an independent id for each additional message.1 parent e2f7db2 commit 8ea6f83
2 files changed
Lines changed: 100 additions & 10 deletions
File tree
- python/packages/ag-ui
- agent_framework_ag_ui
- tests/ag_ui
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
995 | 995 | | |
996 | 996 | | |
997 | 997 | | |
998 | | - | |
| 998 | + | |
999 | 999 | | |
1000 | 1000 | | |
1001 | 1001 | | |
| |||
1012 | 1012 | | |
1013 | 1013 | | |
1014 | 1014 | | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1018 | 1047 | | |
1019 | 1048 | | |
1020 | 1049 | | |
| |||
1025 | 1054 | | |
1026 | 1055 | | |
1027 | 1056 | | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | 1057 | | |
1035 | 1058 | | |
1036 | 1059 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
896 | 896 | | |
897 | 897 | | |
898 | 898 | | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
899 | 966 | | |
900 | 967 | | |
901 | 968 | | |
| |||
0 commit comments