diff --git a/dotnet/samples/AGUIClientServer/AGUIDojoServer/AgenticUI/AgenticUIAgent.cs b/dotnet/samples/AGUIClientServer/AGUIDojoServer/AgenticUI/AgenticUIAgent.cs index f1981e19be..cd99a090d9 100644 --- a/dotnet/samples/AGUIClientServer/AGUIDojoServer/AgenticUI/AgenticUIAgent.cs +++ b/dotnet/samples/AGUIClientServer/AGUIDojoServer/AgenticUI/AgenticUIAgent.cs @@ -79,10 +79,7 @@ protected override async IAsyncEnumerable RunCoreStreamingA Role = update.Role, ContinuationToken = update.ContinuationToken, AdditionalProperties = update.AdditionalProperties, - }) - { - AgentId = update.AgentId - }; + }); } } } diff --git a/dotnet/samples/AGUIClientServer/AGUIDojoServer/PredictiveStateUpdates/PredictiveStateUpdatesAgent.cs b/dotnet/samples/AGUIClientServer/AGUIDojoServer/PredictiveStateUpdates/PredictiveStateUpdatesAgent.cs index a06aed4176..441a487962 100644 --- a/dotnet/samples/AGUIClientServer/AGUIDojoServer/PredictiveStateUpdates/PredictiveStateUpdatesAgent.cs +++ b/dotnet/samples/AGUIClientServer/AGUIDojoServer/PredictiveStateUpdates/PredictiveStateUpdatesAgent.cs @@ -88,10 +88,7 @@ protected override async IAsyncEnumerable RunCoreStreamingA AdditionalProperties = update.AdditionalProperties, AuthorName = update.AuthorName, ContinuationToken = update.ContinuationToken, - }) - { - AgentId = update.AgentId - }; + }); // Small delay to simulate streaming await Task.Delay(50, cancellationToken).ConfigureAwait(false); diff --git a/dotnet/samples/GettingStarted/AGUI/Step04_HumanInLoop/Client/ServerFunctionApprovalClientAgent.cs b/dotnet/samples/GettingStarted/AGUI/Step04_HumanInLoop/Client/ServerFunctionApprovalClientAgent.cs index ee0191fd98..9f919ac83a 100644 --- a/dotnet/samples/GettingStarted/AGUI/Step04_HumanInLoop/Client/ServerFunctionApprovalClientAgent.cs +++ b/dotnet/samples/GettingStarted/AGUI/Step04_HumanInLoop/Client/ServerFunctionApprovalClientAgent.cs @@ -227,7 +227,6 @@ private static AgentResponseUpdate ProcessIncomingServerApprovalRequests( AdditionalProperties = chatUpdate.AdditionalProperties }) { - AgentId = update.AgentId, ContinuationToken = update.ContinuationToken, }; } diff --git a/dotnet/samples/GettingStarted/AGUI/Step04_HumanInLoop/Server/ServerFunctionApprovalServerAgent.cs b/dotnet/samples/GettingStarted/AGUI/Step04_HumanInLoop/Server/ServerFunctionApprovalServerAgent.cs index 62209792f6..8bf1f62b9b 100644 --- a/dotnet/samples/GettingStarted/AGUI/Step04_HumanInLoop/Server/ServerFunctionApprovalServerAgent.cs +++ b/dotnet/samples/GettingStarted/AGUI/Step04_HumanInLoop/Server/ServerFunctionApprovalServerAgent.cs @@ -219,7 +219,6 @@ private static AgentResponseUpdate ProcessOutgoingApprovalRequests( AdditionalProperties = chatUpdate.AdditionalProperties }) { - AgentId = update.AgentId, ContinuationToken = update.ContinuationToken }; } diff --git a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Program.cs b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Program.cs index 980a4eda40..9f4c33c6bc 100644 --- a/dotnet/samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Program.cs +++ b/dotnet/samples/GettingStarted/AgentProviders/Agent_With_CustomImplementation/Program.cs @@ -60,7 +60,6 @@ protected override async Task RunCoreAsync(IEnumerable RunCoreStreamingA { yield return new AgentResponseUpdate { - AgentId = this.Id, AuthorName = message.AuthorName, Role = ChatRole.Assistant, Contents = message.Contents, diff --git a/dotnet/samples/GettingStarted/Workflows/Declarative/HostedWorkflow/Program.cs b/dotnet/samples/GettingStarted/Workflows/Declarative/HostedWorkflow/Program.cs index 96d728b487..aca7e8ea4e 100644 --- a/dotnet/samples/GettingStarted/Workflows/Declarative/HostedWorkflow/Program.cs +++ b/dotnet/samples/GettingStarted/Workflows/Declarative/HostedWorkflow/Program.cs @@ -72,7 +72,7 @@ await aiProjectClient { if (responseUpdate.MessageId != lastMessageId) { - Console.WriteLine($"\n\n{responseUpdate.AuthorName ?? responseUpdate.AgentId}"); + Console.WriteLine($"\n\n{responseUpdate.AuthorName ?? agent.Id}"); } lastMessageId = responseUpdate.MessageId; diff --git a/dotnet/src/Microsoft.Agents.AI.A2A/A2AAgent.cs b/dotnet/src/Microsoft.Agents.AI.A2A/A2AAgent.cs index bdb667d195..9f3468e5ab 100644 --- a/dotnet/src/Microsoft.Agents.AI.A2A/A2AAgent.cs +++ b/dotnet/src/Microsoft.Agents.AI.A2A/A2AAgent.cs @@ -101,7 +101,6 @@ protected override async Task RunCoreAsync(IEnumerable RunCoreAsync(IEnumerable Messages [JsonIgnore] public IEnumerable UserInputRequests => this._messages?.SelectMany(x => x.Contents).OfType() ?? []; - /// - /// Gets or sets the identifier of the agent that generated this response. - /// - /// - /// A unique string identifier for the agent, or if not specified. - /// - /// - /// This identifier helps track which agent generated the response in multi-agent scenarios - /// or for debugging and telemetry purposes. - /// - public string? AgentId { get; set; } - /// /// Gets or sets the unique identifier for this specific response. /// @@ -276,7 +264,6 @@ public AgentResponseUpdate[] ToAgentResponseUpdates() RawRepresentation = message.RawRepresentation, Role = message.Role, - AgentId = this.AgentId, ResponseId = this.ResponseId, MessageId = message.MessageId, CreatedAt = this.CreatedAt, diff --git a/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponseExtensions.cs b/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponseExtensions.cs index 75ff6fb359..6cd65f3e96 100644 --- a/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponseExtensions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponseExtensions.cs @@ -118,15 +118,11 @@ public static AgentResponse ToAgentResponse( { _ = Throw.IfNull(updates); - AgentResponseDetails additionalDetails = new(); ChatResponse chatResponse = - AsChatResponseUpdatesWithAdditionalDetails(updates, additionalDetails) + AsChatResponseUpdates(updates) .ToChatResponse(); - return new AgentResponse(chatResponse) - { - AgentId = additionalDetails.AgentId, - }; + return new AgentResponse(chatResponse); } /// @@ -160,52 +156,31 @@ static async Task ToAgentResponseAsync( IAsyncEnumerable updates, CancellationToken cancellationToken) { - AgentResponseDetails additionalDetails = new(); ChatResponse chatResponse = await - AsChatResponseUpdatesWithAdditionalDetailsAsync(updates, additionalDetails, cancellationToken) + AsChatResponseUpdatesAsync(updates, cancellationToken) .ToChatResponseAsync(cancellationToken) .ConfigureAwait(false); - return new AgentResponse(chatResponse) - { - AgentId = additionalDetails.AgentId, - }; + return new AgentResponse(chatResponse); } } - private static IEnumerable AsChatResponseUpdatesWithAdditionalDetails( - IEnumerable updates, - AgentResponseDetails additionalDetails) + private static IEnumerable AsChatResponseUpdates( + IEnumerable updates) { foreach (var update in updates) { - UpdateAdditionalDetails(update, additionalDetails); yield return update.AsChatResponseUpdate(); } } - private static async IAsyncEnumerable AsChatResponseUpdatesWithAdditionalDetailsAsync( + private static async IAsyncEnumerable AsChatResponseUpdatesAsync( IAsyncEnumerable updates, - AgentResponseDetails additionalDetails, [EnumeratorCancellation] CancellationToken cancellationToken) { await foreach (var update in updates.WithCancellation(cancellationToken).ConfigureAwait(false)) { - UpdateAdditionalDetails(update, additionalDetails); yield return update.AsChatResponseUpdate(); } } - - private static void UpdateAdditionalDetails(AgentResponseUpdate update, AgentResponseDetails details) - { - if (update.AgentId is { Length: > 0 }) - { - details.AgentId = update.AgentId; - } - } - - private sealed class AgentResponseDetails - { - public string? AgentId { get; set; } - } } diff --git a/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponseUpdate.cs b/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponseUpdate.cs index b1e5c88ad7..2c05f519e5 100644 --- a/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponseUpdate.cs +++ b/dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponseUpdate.cs @@ -122,9 +122,6 @@ public IList Contents /// Gets or sets additional properties for the update. public AdditionalPropertiesDictionary? AdditionalProperties { get; set; } - /// Gets or sets the ID of the agent that produced the response. - public string? AgentId { get; set; } - /// Gets or sets the ID of the response of which this update is a part. public string? ResponseId { get; set; } diff --git a/dotnet/src/Microsoft.Agents.AI.CopilotStudio/CopilotStudioAgent.cs b/dotnet/src/Microsoft.Agents.AI.CopilotStudio/CopilotStudioAgent.cs index bf786a1712..f03da47d6e 100644 --- a/dotnet/src/Microsoft.Agents.AI.CopilotStudio/CopilotStudioAgent.cs +++ b/dotnet/src/Microsoft.Agents.AI.CopilotStudio/CopilotStudioAgent.cs @@ -90,7 +90,6 @@ protected override async Task RunCoreAsync( // so that they can tell things like response boundaries. return new AgentResponse(responseMessagesList) { - AgentId = this.Id, ResponseId = responseMessagesList.LastOrDefault()?.MessageId, }; } @@ -127,7 +126,6 @@ protected override async IAsyncEnumerable RunCoreStreamingA // so that they can tell things like response boundaries. yield return new AgentResponseUpdate(message.Role, message.Contents) { - AgentId = this.Id, AdditionalProperties = message.AdditionalProperties, AuthorName = message.AuthorName, RawRepresentation = message.RawRepresentation, diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/EntityAgentWrapper.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/EntityAgentWrapper.cs index ce4eef8668..5470bb17d7 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/EntityAgentWrapper.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/EntityAgentWrapper.cs @@ -21,20 +21,17 @@ internal sealed class EntityAgentWrapper( // The ID of the agent is always the entity ID. protected override string? IdCore => this._entityContext.Id.ToString(); - protected override async Task RunCoreAsync( + protected override Task RunCoreAsync( IEnumerable messages, AgentSession? session = null, AgentRunOptions? options = null, CancellationToken cancellationToken = default) { - AgentResponse response = await base.RunCoreAsync( + return base.RunCoreAsync( messages, session, this.GetAgentEntityRunOptions(options), cancellationToken); - - response.AgentId = this.Id; - return response; } protected override async IAsyncEnumerable RunCoreStreamingAsync( @@ -49,7 +46,6 @@ protected override async IAsyncEnumerable RunCoreStreamingA this.GetAgentEntityRunOptions(options), cancellationToken)) { - update.AgentId = this.Id; yield return update; } } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/InvokeAzureAgentExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/InvokeAzureAgentExecutor.cs index 0cd6fee77b..dc0273e5bb 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/InvokeAzureAgentExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows.Declarative/ObjectModel/InvokeAzureAgentExecutor.cs @@ -70,7 +70,6 @@ private async ValueTask InvokeAgentAsync(IWorkflowContext context, IEnumerable messages = []; Dictionary responses = []; - HashSet agentIds = []; foreach (string responseId in this._mergeStates.Keys) { @@ -146,11 +145,6 @@ public AgentResponse ComputeMerged(string primaryResponseId, string? primaryAgen foreach (AgentResponse response in responses.Values) { - if (response.AgentId is not null) - { - agentIds.Add(response.AgentId); - } - if (response.CreatedAt.HasValue) { createdTimes.Add(response.CreatedAt.Value); @@ -179,9 +173,6 @@ public AgentResponse ComputeMerged(string primaryResponseId, string? primaryAgen return new AgentResponse(messages) { ResponseId = primaryResponseId, - AgentId = primaryAgentId - ?? primaryAgentName - ?? (agentIds.Count == 1 ? agentIds.First() : null), CreatedAt = DateTimeOffset.UtcNow, Usage = usage, AdditionalProperties = additionalProperties @@ -204,7 +195,6 @@ static AgentResponse MergeResponses(AgentResponse? current, AgentResponse incomi return new() { - AgentId = incoming.AgentId ?? current.AgentId, AdditionalProperties = MergeProperties(current.AdditionalProperties, incoming.AdditionalProperties), CreatedAt = incoming.CreatedAt ?? current.CreatedAt, Messages = current.Messages.Concat(incoming.Messages).ToList(), diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs index 8c608090f3..ea9cf1f06a 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/HandoffAgentExecutor.cs @@ -84,7 +84,6 @@ protected override RouteBuilder ConfigureRoutes(RouteBuilder routeBuilder) => await AddUpdateAsync( new AgentResponseUpdate { - AgentId = this._agent.Id, AuthorName = this._agent.Name ?? this._agent.Id, Contents = [new FunctionResultContent(fcc.CallId, "Transferred.")], CreatedAt = DateTimeOffset.UtcNow, diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowHostAgent.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowHostAgent.cs index 3bd1059ce8..6f00ba1220 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowHostAgent.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/WorkflowHostAgent.cs @@ -105,7 +105,7 @@ Task RunCoreAsync( merger.AddUpdate(update); } - return merger.ComputeMerged(workflowSession.LastResponseId!, this.Id, this.Name); + return merger.ComputeMerged(workflowSession.LastResponseId!); } protected override async diff --git a/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs b/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs index 937a6d0f0b..d145a88144 100644 --- a/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs +++ b/dotnet/src/Microsoft.Agents.AI/ChatClient/ChatClientAgent.cs @@ -262,7 +262,6 @@ protected override async IAsyncEnumerable RunCoreStreamingA yield return new(update) { - AgentId = this.Id, ContinuationToken = WrapContinuationToken(update.ContinuationToken, GetInputMessages(inputMessages, continuationToken), responseUpdates) }; } @@ -465,11 +464,7 @@ private async Task RunCoreAsync diff --git a/dotnet/src/Shared/Workflows/Execution/WorkflowRunner.cs b/dotnet/src/Shared/Workflows/Execution/WorkflowRunner.cs index 380ea5eaeb..4389a28f95 100644 --- a/dotnet/src/Shared/Workflows/Execution/WorkflowRunner.cs +++ b/dotnet/src/Shared/Workflows/Execution/WorkflowRunner.cs @@ -185,7 +185,7 @@ public async Task ExecuteAsync(Func workflowProvider, string input) if (messageId is not null) { - string? agentName = streamEvent.Update.AuthorName ?? streamEvent.Update.AgentId ?? nameof(ChatRole.Assistant); + string? agentName = streamEvent.Update.AuthorName ?? streamEvent.ExecutorId ?? nameof(ChatRole.Assistant); Console.ForegroundColor = ConsoleColor.Cyan; Console.Write($"\n{agentName.ToUpperInvariant()}:"); Console.ForegroundColor = ConsoleColor.DarkGray; diff --git a/dotnet/tests/AgentConformance.IntegrationTests/RunTests.cs b/dotnet/tests/AgentConformance.IntegrationTests/RunTests.cs index be1fa0f2f3..ebe54a072f 100644 --- a/dotnet/tests/AgentConformance.IntegrationTests/RunTests.cs +++ b/dotnet/tests/AgentConformance.IntegrationTests/RunTests.cs @@ -49,7 +49,6 @@ public virtual async Task RunWithStringReturnsExpectedResultAsync() Assert.NotNull(response); Assert.Single(response.Messages); Assert.Contains("Paris", response.Text); - Assert.Equal(agent.Id, response.AgentId); } [RetryFact(Constants.RetryCount, Constants.RetryDelay)] diff --git a/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/A2AAgentTests.cs b/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/A2AAgentTests.cs index fd2453cb0d..1383347dc5 100644 --- a/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/A2AAgentTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.A2A.UnitTests/A2AAgentTests.cs @@ -116,7 +116,6 @@ public async Task RunAsync_WithValidUserMessage_RunsSuccessfullyAsync() // Assert response from A2AClient is converted correctly Assert.NotNull(result); - Assert.Equal(this._agent.Id, result.AgentId); Assert.Equal("response-123", result.ResponseId); Assert.NotNull(result.RawRepresentation); @@ -247,7 +246,6 @@ public async Task RunStreamingAsync_WithValidUserMessage_YieldsAgentResponseUpda Assert.Equal(ChatRole.Assistant, updates[0].Role); Assert.Equal("Hello", updates[0].Text); Assert.Equal("stream-1", updates[0].MessageId); - Assert.Equal(this._agent.Id, updates[0].AgentId); Assert.Equal("stream-1", updates[0].ResponseId); Assert.NotNull(updates[0].RawRepresentation); @@ -499,7 +497,6 @@ public async Task RunAsync_WithAgentTaskResponse_ReturnsTaskResponseCorrectlyAsy // Assert - verify task is converted correctly Assert.NotNull(result); - Assert.Equal(this._agent.Id, result.AgentId); Assert.Equal("task-789", result.ResponseId); Assert.NotNull(result.RawRepresentation); @@ -659,7 +656,6 @@ public async Task RunStreamingAsync_WithAgentMessage_YieldsResponseUpdateAsync() Assert.Equal(ChatRole.Assistant, update0.Role); Assert.Equal(MessageId, update0.MessageId); Assert.Equal(MessageId, update0.ResponseId); - Assert.Equal(this._agent.Id, update0.AgentId); Assert.Equal(MessageText, update0.Text); Assert.IsType(update0.RawRepresentation); Assert.Equal(MessageId, ((AgentMessage)update0.RawRepresentation!).MessageId); @@ -701,7 +697,6 @@ public async Task RunStreamingAsync_WithAgentTask_YieldsResponseUpdateAsync() var update0 = updates[0]; Assert.Equal(ChatRole.Assistant, update0.Role); Assert.Equal(TaskId, update0.ResponseId); - Assert.Equal(this._agent.Id, update0.AgentId); Assert.IsType(update0.RawRepresentation); Assert.Equal(TaskId, ((AgentTask)update0.RawRepresentation!).Id); @@ -740,7 +735,6 @@ public async Task RunStreamingAsync_WithTaskStatusUpdateEvent_YieldsResponseUpda var update0 = updates[0]; Assert.Equal(ChatRole.Assistant, update0.Role); Assert.Equal(TaskId, update0.ResponseId); - Assert.Equal(this._agent.Id, update0.AgentId); Assert.IsType(update0.RawRepresentation); // Assert - session should be updated with context and task IDs @@ -783,7 +777,6 @@ public async Task RunStreamingAsync_WithTaskArtifactUpdateEvent_YieldsResponseUp var update0 = updates[0]; Assert.Equal(ChatRole.Assistant, update0.Role); Assert.Equal(TaskId, update0.ResponseId); - Assert.Equal(this._agent.Id, update0.AgentId); Assert.IsType(update0.RawRepresentation); // Assert - artifact content should be in the update diff --git a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentResponseTests.cs b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentResponseTests.cs index 75bc90ca8e..d98f570450 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentResponseTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentResponseTests.cs @@ -75,10 +75,6 @@ public void PropertiesRoundtrip() { AgentResponse response = new(); - Assert.Null(response.AgentId); - response.AgentId = "agentId"; - Assert.Equal("agentId", response.AgentId); - Assert.Null(response.ResponseId); response.ResponseId = "id"; Assert.Equal("id", response.ResponseId); @@ -112,7 +108,6 @@ public void JsonSerializationRoundtrips() { AgentResponse original = new(new ChatMessage(ChatRole.Assistant, "the message")) { - AgentId = "agentId", ResponseId = "id", CreatedAt = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), Usage = new UsageDetails(), @@ -129,7 +124,6 @@ public void JsonSerializationRoundtrips() Assert.Equal(ChatRole.Assistant, result.Messages.Single().Role); Assert.Equal("the message", result.Messages.Single().Text); - Assert.Equal("agentId", result.AgentId); Assert.Equal("id", result.ResponseId); Assert.Equal(new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), result.CreatedAt); Assert.NotNull(result.Usage); @@ -184,7 +178,6 @@ public void ToAgentResponseUpdatesProducesUpdates() { AgentResponse response = new(new ChatMessage(new ChatRole("customRole"), "Text") { MessageId = "someMessage" }) { - AgentId = "agentId", ResponseId = "12345", CreatedAt = new DateTimeOffset(2024, 11, 10, 9, 20, 0, TimeSpan.Zero), AdditionalProperties = new() { ["key1"] = "value1", ["key2"] = 42 }, @@ -199,7 +192,6 @@ public void ToAgentResponseUpdatesProducesUpdates() Assert.Equal(2, updates.Length); AgentResponseUpdate update0 = updates[0]; - Assert.Equal("agentId", update0.AgentId); Assert.Equal("12345", update0.ResponseId); Assert.Equal("someMessage", update0.MessageId); Assert.Equal(new DateTimeOffset(2024, 11, 10, 9, 20, 0, TimeSpan.Zero), update0.CreatedAt); diff --git a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentResponseUpdateExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentResponseUpdateExtensionsTests.cs index 2723ed081a..77ec7aef80 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentResponseUpdateExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Abstractions.UnitTests/AgentResponseUpdateExtensionsTests.cs @@ -42,7 +42,7 @@ public async Task ToAgentResponseSuccessfullyCreatesResponseAsync(bool useAsync) { AgentResponseUpdate[] updates = [ - new(ChatRole.Assistant, "Hello") { ResponseId = "someResponse", MessageId = "12345", CreatedAt = new DateTimeOffset(2024, 2, 3, 4, 5, 6, TimeSpan.Zero), AgentId = "agentId" }, + new(ChatRole.Assistant, "Hello") { ResponseId = "someResponse", MessageId = "12345", CreatedAt = new DateTimeOffset(2024, 2, 3, 4, 5, 6, TimeSpan.Zero) }, new(new("human"), ", ") { AuthorName = "Someone", AdditionalProperties = new() { ["a"] = "b" } }, new(null, "world!") { CreatedAt = new DateTimeOffset(2025, 2, 3, 4, 5, 6, TimeSpan.Zero), AdditionalProperties = new() { ["c"] = "d" } }, @@ -55,8 +55,6 @@ public async Task ToAgentResponseSuccessfullyCreatesResponseAsync(bool useAsync) await YieldAsync(updates).ToAgentResponseAsync(); Assert.NotNull(response); - Assert.Equal("agentId", response.AgentId); - Assert.NotNull(response.Usage); Assert.Equal(5, response.Usage.InputTokenCount); Assert.Equal(7, response.Usage.OutputTokenCount); diff --git a/dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentExtensionsTests.cs index eea65444b8..42295860e5 100644 --- a/dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentExtensionsTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.UnitTests/AgentExtensionsTests.cs @@ -259,7 +259,6 @@ public async Task CreateFromAgent_InvokeWithComplexResponseFromAgentAsync_Return // Arrange var expectedResponse = new AgentResponse { - AgentId = "agent-123", ResponseId = "response-456", CreatedAt = DateTimeOffset.UtcNow, Messages = { new ChatMessage(ChatRole.Assistant, "Complex response") } @@ -283,7 +282,6 @@ public async Task CreateFromAgent_InvokeWithAdditionalProperties_PropagatesAddit // Arrange var expectedResponse = new AgentResponse { - AgentId = "agent-123", ResponseId = "response-456", CreatedAt = DateTimeOffset.UtcNow, Messages = { new ChatMessage(ChatRole.Assistant, "Complex response") } diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs index 80d4c57da8..44e787ebbd 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/Framework/WorkflowHarness.cs @@ -145,13 +145,13 @@ private static async IAsyncEnumerable MonitorAndDisposeWorkflowRu case AgentResponseEvent responseEvent: if (!string.IsNullOrEmpty(responseEvent.Response.Text)) { - Console.WriteLine($"AGENT: {responseEvent.Response.AgentId}: {responseEvent.Response.Text}"); + Console.WriteLine($"AGENT: {responseEvent.ExecutorId}: {responseEvent.Response.Text}"); } else { foreach (FunctionCallContent toolCall in responseEvent.Response.Messages.SelectMany(m => m.Contents.OfType())) { - Console.WriteLine($"TOOL: {toolCall.Name} [{responseEvent.Response.AgentId}]"); + Console.WriteLine($"TOOL: {toolCall.Name} [{responseEvent.ExecutorId}]"); } } break; diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AIAgentHostExecutorTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AIAgentHostExecutorTests.cs index 2ea117856f..09336d92bc 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AIAgentHostExecutorTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/AIAgentHostExecutorTests.cs @@ -65,7 +65,6 @@ public async Task Test_AgentHostExecutor_EmitsStreamingUpdatesIFFConfiguredAsync AgentResponseUpdate update = updateEvent.Update; update.AuthorName.Should().Be(TestAgentName); - update.AgentId.Should().Be(TestAgentId); update.Contents.Should().HaveCount(1); update.Contents[0].Should().BeEquivalentTo(expectedUpdateContent); } @@ -100,7 +99,6 @@ public async Task Test_AgentHostExecutor_EmitsResponseIFFConfiguredAsync(bool ex responseEvent.ExecutorId.Should().Be(agent.GetDescriptiveId()); AgentResponse response = responseEvent.Response; - response.AgentId.Should().Be(TestAgentId); response.Messages.Should().HaveCount(TestMessages.Count - 1); for (int i = 0; i < response.Messages.Count; i++) diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ChatMessageBuilder.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ChatMessageBuilder.cs index f3f7990c6c..1845ebfc18 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ChatMessageBuilder.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/ChatMessageBuilder.cs @@ -25,27 +25,26 @@ public static IEnumerable ToContentStream(this string? message) return splits.Select(text => (AIContent)new TextContent(text) { RawRepresentation = text }); } - public static AgentResponseUpdate ToResponseUpdate(this AIContent content, string? messageId = null, DateTimeOffset? createdAt = null, string? responseId = null, string? agentId = null, string? authorName = null) => + public static AgentResponseUpdate ToResponseUpdate(this AIContent content, string? messageId = null, DateTimeOffset? createdAt = null, string? responseId = null, string? authorName = null) => new() { Role = ChatRole.Assistant, CreatedAt = createdAt ?? DateTimeOffset.UtcNow, MessageId = messageId ?? Guid.NewGuid().ToString("N"), ResponseId = responseId, - AgentId = agentId, AuthorName = authorName, Contents = [content], }; - public static IEnumerable ToAgentRunStream(this string message, DateTimeOffset? createdAt = null, string? messageId = null, string? responseId = null, string? agentId = null, string? authorName = null) + public static IEnumerable ToAgentRunStream(this string message, DateTimeOffset? createdAt = null, string? messageId = null, string? responseId = null, string? authorName = null) { messageId ??= Guid.NewGuid().ToString("N"); IEnumerable contents = message.ToContentStream(); - return contents.Select(content => content.ToResponseUpdate(messageId, createdAt, responseId, agentId, authorName)); + return contents.Select(content => content.ToResponseUpdate(messageId, createdAt, responseId, authorName)); } - public static ChatMessage ToChatMessage(this IEnumerable contents, string? messageId = null, DateTimeOffset? createdAt = null, string? responseId = null, string? agentId = null, string? authorName = null, string? rawRepresentation = null) => + public static ChatMessage ToChatMessage(this IEnumerable contents, string? messageId = null, DateTimeOffset? createdAt = null, string? responseId = null, string? authorName = null, string? rawRepresentation = null) => new(ChatRole.Assistant, contents is List contentsList ? contentsList : contents.ToList()) { AuthorName = authorName, @@ -54,16 +53,16 @@ public static ChatMessage ToChatMessage(this IEnumerable contents, st RawRepresentation = rawRepresentation, }; - public static IEnumerable StreamMessage(this ChatMessage message, string? responseId = null, string? agentId = null) + public static IEnumerable StreamMessage(this ChatMessage message, string? responseId = null) { responseId ??= Guid.NewGuid().ToString("N"); string messageId = message.MessageId ?? Guid.NewGuid().ToString("N"); - return message.Contents.Select(content => content.ToResponseUpdate(messageId, message.CreatedAt, responseId: responseId, agentId: agentId, authorName: message.AuthorName)); + return message.Contents.Select(content => content.ToResponseUpdate(messageId, message.CreatedAt, responseId: responseId, authorName: message.AuthorName)); } - public static IEnumerable StreamMessages(this List messages, string? agentId = null) => - messages.SelectMany(message => message.StreamMessage(agentId)); + public static IEnumerable StreamMessages(this List messages) => + messages.SelectMany(message => message.StreamMessage()); public static List ToChatMessages(this IEnumerable messages, string? authorName = null) { diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MessageMergerTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MessageMergerTests.cs index 93448aa327..e02471c05c 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MessageMergerTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/MessageMergerTests.cs @@ -23,7 +23,7 @@ public void Test_MessageMerger_AssemblesMessage() MessageMerger merger = new(); - foreach (AgentResponseUpdate update in "Hello Agent Framework Workflows!".ToAgentRunStream(authorName: TestAuthorName1, agentId: TestAgentId1, messageId: messageId, createdAt: creationTime, responseId: responseId)) + foreach (AgentResponseUpdate update in "Hello Agent Framework Workflows!".ToAgentRunStream(authorName: TestAuthorName1, messageId: messageId, createdAt: creationTime, responseId: responseId)) { merger.AddUpdate(update); } @@ -33,7 +33,6 @@ public void Test_MessageMerger_AssemblesMessage() response.Messages.Should().HaveCount(1); response.Messages[0].Role.Should().Be(ChatRole.Assistant); response.Messages[0].AuthorName.Should().Be(TestAuthorName1); - response.AgentId.Should().Be(TestAgentId1); response.CreatedAt.Should().NotBe(creationTime); response.Messages[0].CreatedAt.Should().Be(creationTime); response.Messages[0].Contents.Should().HaveCount(1); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/RoleCheckAgent.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/RoleCheckAgent.cs index 732175c8b6..d7512cd1ac 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/RoleCheckAgent.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/RoleCheckAgent.cs @@ -36,7 +36,6 @@ protected override async IAsyncEnumerable RunCoreStreamingA yield return new AgentResponseUpdate(ChatRole.Assistant, "Ok") { - AgentId = this.Id, AuthorName = this.Name, MessageId = Guid.NewGuid().ToString("N"), ResponseId = Guid.NewGuid().ToString("N") diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/06_GroupChat_Workflow.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/06_GroupChat_Workflow.cs index fd19797a56..c3af7518a1 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/06_GroupChat_Workflow.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/06_GroupChat_Workflow.cs @@ -80,7 +80,6 @@ protected override async IAsyncEnumerable RunCoreStreamingA { yield return new(ChatRole.Assistant, "Hello World!") { - AgentId = this.Id, AuthorName = this.Name, MessageId = Guid.NewGuid().ToString("N"), }; diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/07_GroupChat_Workflow_HostAsAgent.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/07_GroupChat_Workflow_HostAsAgent.cs index 215bd52119..a185c0a7d3 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/07_GroupChat_Workflow_HostAsAgent.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/Sample/07_GroupChat_Workflow_HostAsAgent.cs @@ -28,7 +28,7 @@ public static async ValueTask RunAsync(TextWriter writer, IWorkflowExecutionEnvi continue; } string updateText = $"{update.AuthorName - ?? update.AgentId + ?? agent.Id ?? update.Role.ToString() ?? ChatRole.Assistant.ToString()}: {update.Text}"; writer.WriteLine(updateText); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestEchoAgent.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestEchoAgent.cs index f9a4309f86..b705cfb8c4 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestEchoAgent.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestEchoAgent.cs @@ -63,7 +63,6 @@ protected override Task RunCoreAsync(IEnumerable mes AgentResponse result = new(this.EchoMessages(messages, session, options).ToList()) { - AgentId = this.Id, CreatedAt = DateTimeOffset.Now, ResponseId = Guid.NewGuid().ToString("N"), }; @@ -80,7 +79,6 @@ protected override async IAsyncEnumerable RunCoreStreamingA yield return new(message.Role, message.Contents) { - AgentId = this.Id, AuthorName = message.AuthorName, ResponseId = responseId, MessageId = message.MessageId, diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestReplayAgent.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestReplayAgent.cs index 82358e1198..cf1b82dd89 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestReplayAgent.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestReplayAgent.cs @@ -68,7 +68,6 @@ protected override async IAsyncEnumerable RunCoreStreamingA { yield return new AgentResponseUpdate() { - AgentId = this.Id, AuthorName = this.Name, MessageId = message.MessageId, ResponseId = responseId,