-
Notifications
You must be signed in to change notification settings - Fork 34
Surface inbound AG-UI CUSTOM events as metadata instead of dropping them #694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -373,6 +373,10 @@ type pendingToolCall struct { | |
|
|
||
| type toolCallAccumulator struct { | ||
| pending map[string]*pendingToolCall | ||
| // customSeq counts emitted custom events so each one is assigned a unique | ||
| // synthetic MessageID, keeping it in its own message rather than being merged | ||
| // into (and overwriting) an unrelated assistant message when collected. | ||
| customSeq int | ||
| } | ||
|
|
||
| func (a *toolCallAccumulator) onEvent(evt aguiEvents.Event) ([]*agent.ResponseUpdate, error) { | ||
|
|
@@ -479,6 +483,19 @@ func (a *toolCallAccumulator) onEvent(evt aguiEvents.Event) ([]*agent.ResponseUp | |
| CreatedAt: eventTime(evt), | ||
| Contents: message.Contents{newJSONDataContent(e.Delta, "application/json-patch+json")}, | ||
| }}, nil | ||
| case *aguiEvents.CustomEvent: | ||
| a.customSeq++ | ||
| return []*agent.ResponseUpdate{{ | ||
| Role: message.RoleAssistant, | ||
| MessageID: fmt.Sprintf("agui-custom-%d", a.customSeq), | ||
| CreatedAt: eventTime(evt), | ||
| AdditionalProperties: map[string]any{ | ||
| "agui_custom_event": map[string]any{ | ||
| "name": e.Name, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Parity issue — missing The Python Consider adding the AG-UI thread/run IDs here to keep observability parity with the Python SDK. |
||
| "value": e.Value, | ||
| }, | ||
| }, | ||
| }}, nil | ||
| default: | ||
| return nil, nil | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parity issue — key name diverges from Python SDK
The upstream Python
_handle_custom_eventuses"ag_ui_custom_event"(with underscore afterag) as theadditional_propertieskey. This PR uses"agui_custom_event"(no underscore). Callers inspectingAdditionalPropertiescross-SDK will need different spellings.Suggested rename to
"ag_ui_custom_event"to matchmicrosoft/agent-framework→_event_converters.py.