.NET: Implement tool events > function call events for AG-UI support#4824
Open
kzu wants to merge 2 commits intomicrosoft:mainfrom
Open
.NET: Implement tool events > function call events for AG-UI support#4824kzu wants to merge 2 commits intomicrosoft:mainfrom
kzu wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds forwarding of GitHub Copilot SDK tool execution events into the Agent Framework’s function-call/function-result content model so the AG-UI adapter can surface tool-call lifecycle events to clients (fixing #4823).
Changes:
- Handle
ToolExecutionStartEventandToolExecutionCompleteEventin the Copilot session streaming event switch. - Convert tool-start to
FunctionCallContent(including JSON argument conversion) and tool-complete toFunctionResultContent. - Add unit tests covering tool start/complete conversions and JSON argument handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.GitHub.Copilot/GitHubCopilotAgent.cs | Adds streaming handling + conversion helpers to emit FunctionCallContent/FunctionResultContent from tool events. |
| dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs | Adds tests validating tool event conversion behavior and argument mapping. |
dotnet/tests/Microsoft.Agents.AI.GitHub.Copilot.UnitTests/GitHubCopilotAgentTests.cs
Outdated
Show resolved
Hide resolved
Added two new case branches and three new converter methods: - ToolExecutionStartEvent → FunctionCallContent (the AGUI layer then emits TOOL_CALL_START/ARGS/END to the client) - ToolExecutionCompleteEvent → FunctionResultContent → TOOL_CALL_RESULT - Arguments are converted from JsonElement using AOT-safe JsonElement.EnumerateObject() — no reflection/dynamic code Fixes microsoft#4823
…t events (#5) * Implement raw JsonElement argument handling Co-authored-by: kzu <169707+kzu@users.noreply.github.com> Agent-Logs-Url: https://github.com/kzu/agent-framework/sessions/ca9509f7-6318-4f1a-8ba2-17e4207bc7c4 * Fix test validation and preserve structured JSON args Co-authored-by: kzu <169707+kzu@users.noreply.github.com> Agent-Logs-Url: https://github.com/kzu/agent-framework/sessions/ca9509f7-6318-4f1a-8ba2-17e4207bc7c4 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added two new case branches and three new converter methods:
Motivation and Context
When using Copilot SDK adapter to expose an AG-UI client, tool call events aren't surfaced at all as events the client can show.
Fixes #4823