From 6c96a6ffd551f91752cb6f19128af24592c5afb1 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Wed, 24 Jun 2026 22:49:52 +0000
Subject: [PATCH] Consolidate A2A response update creation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
agent/provider/a2aagent/a2a.go | 57 +++++++++++++---------------------
1 file changed, 21 insertions(+), 36 deletions(-)
diff --git a/agent/provider/a2aagent/a2a.go b/agent/provider/a2aagent/a2a.go
index 9179c8721..c7bf7be43 100644
--- a/agent/provider/a2aagent/a2a.go
+++ b/agent/provider/a2aagent/a2a.go
@@ -194,15 +194,8 @@ func sendMsg(session *agent.Session, seq iter.Seq2[a2a.Event, error], yield func
}
}
}
- if !yield(&agent.ResponseUpdate{
- RawRepresentation: e,
- AdditionalProperties: e.Metadata,
- MessageID: messageID,
- ResponseID: string(e.TaskID),
- Role: message.RoleAssistant,
- Contents: contents,
- CreatedAt: time.Now(),
- }, nil) {
+ update := newResponseUpdate(e, e.Metadata, string(e.TaskID), messageID, message.RoleAssistant, contents, time.Now())
+ if !yield(update, nil) {
return
}
case *a2a.TaskArtifactUpdateEvent:
@@ -211,15 +204,8 @@ func sendMsg(session *agent.Session, seq iter.Seq2[a2a.Event, error], yield func
yield(nil, err)
return
}
- if !yield(&agent.ResponseUpdate{
- RawRepresentation: e,
- AdditionalProperties: e.Metadata,
- MessageID: string(e.Artifact.ID),
- ResponseID: string(e.TaskID),
- Contents: contents,
- Role: message.RoleAssistant,
- CreatedAt: time.Now(),
- }, nil) {
+ update := newResponseUpdate(e, e.Metadata, string(e.TaskID), string(e.Artifact.ID), message.RoleAssistant, contents, time.Now())
+ if !yield(update, nil) {
return
}
case *a2a.Message:
@@ -232,15 +218,8 @@ func sendMsg
... (truncated)
Summary
Consolidates A2A provider streaming response-update construction behind a small unexported helper. This keeps the provider-specific mapping to
agent.ResponseUpdatein one place, making future .NET-to-Go ports easier to compare against the .NET response update model without changing runtime behavior..NET Reference
dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponseUpdate.cs- defines the common response-update shape that provider adapters populate.Public API and Behavior
No public Go API changed. No intentional behavior change was made.
Tests
go test ./agent/provider/a2aagentNotes
Rejected candidates:
dotnet/src/Microsoft.Agents.AI/Compaction/CompactionProvider.cs/ Goagent/compaction: Go already has a narrowCompacthelper and further provider changes risked churn for little structural gain.dotnet/src/Microsoft.Agents.AI.Workflows/SuperStepStartInfo.cs/ Goworkflow/event.go: the corresponding Go type is public, so reshaping it would risk public API churn.dotnet/src/Microsoft.Agents.AI.Workflows/Observability/WorkflowTelemetryContext.cs/ Go workflow observability: the Go telemetry bridge is already compact, and shared workflow runtime changes looked riskier than this A2A-local cleanup.Note
This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch
dotnet-code-a2a-response-update-helper-6794454b255b38d9.Click here to create the pull request
To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ
Show patch preview (110 of 110 lines)