From 8559a844667edb63b1bbdc9fb4ad23d9607e4301 Mon Sep 17 00:00:00 2001 From: Phillip Hoff Date: Fri, 12 Dec 2025 14:16:35 -0800 Subject: [PATCH 1/5] Switch to new "RunAgent" method name. --- .../AgentEntity.cs | 9 ++- .../DefaultDurableAgentClient.cs | 2 +- .../DurableAIAgent.cs | 2 +- .../AgentEntityTests.cs | 57 +++++++++++++++++++ 4 files changed, 67 insertions(+), 3 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs index 166799a124..2ed502ae96 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs @@ -20,7 +20,14 @@ internal class AgentEntity(IServiceProvider services, CancellationToken cancella ? cancellationToken : services.GetService()?.ApplicationStopping ?? CancellationToken.None; - public async Task RunAgentAsync(RunRequest request) + public Task RunAgentAsync(RunRequest request) + { + return this.RunAgent(request); + } + +#pragma warning disable VSTHRD200 + public async Task RunAgent(RunRequest request) +#pragma warning restore VSTHRD200 { AgentSessionId sessionId = this.Context.Id; IReadOnlyDictionary> agents = diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DefaultDurableAgentClient.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DefaultDurableAgentClient.cs index 2086a00ecb..ad2b5b204f 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/DefaultDurableAgentClient.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DefaultDurableAgentClient.cs @@ -22,7 +22,7 @@ public async Task RunAgentAsync( await this._client.Entities.SignalEntityAsync( sessionId, - nameof(AgentEntity.RunAgentAsync), + nameof(AgentEntity.RunAgent), request, cancellation: cancellationToken); diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs index 021c8f22c7..fc5eab70fd 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs @@ -107,7 +107,7 @@ public override async Task RunAsync( { return await this._context.Entities.CallEntityAsync( durableThread.SessionId, - nameof(AgentEntity.RunAgentAsync), + nameof(AgentEntity.RunAgent), request); } catch (EntityOperationFailedException e) when (e.FailureDetails.ErrorType == "EntityTaskNotFound") diff --git a/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/AgentEntityTests.cs b/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/AgentEntityTests.cs index 98e40ad4fb..220116ccb5 100644 --- a/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/AgentEntityTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/AgentEntityTests.cs @@ -81,6 +81,63 @@ await simpleAgentProxy.RunAsync( Assert.Null(request.OrchestrationId); } + [Theory] + [InlineData("RunAgent")] + [InlineData("RunAgentAsync")] + public async Task RunAgentMethodNamesAllWorkAsync(string runAgentMethodName) + { + // Setup + AIAgent simpleAgent = TestHelper.GetAzureOpenAIChatClient(s_configuration).CreateAIAgent( + name: "TestAgent", + instructions: "You are a helpful assistant that always responds with a friendly greeting." + ); + + using TestHelper testHelper = TestHelper.Start([simpleAgent], this._outputHelper); + + // A proxy agent is needed to call the hosted test agent + AIAgent simpleAgentProxy = simpleAgent.AsDurableAgentProxy(testHelper.Services); + + AgentThread thread = simpleAgentProxy.GetNewThread(); + + DurableTaskClient client = testHelper.GetClient(); + + AgentSessionId sessionId = thread.GetService(); + EntityInstanceId expectedEntityId = new($"dafx-{simpleAgent.Name}", sessionId.Key); + + EntityMetadata? entity = await client.Entities.GetEntityAsync(expectedEntityId, false, this.TestTimeoutToken); + + Assert.Null(entity); + + // Act: send a prompt to the agent + await client.Entities.SignalEntityAsync( + expectedEntityId, + runAgentMethodName, + new RunRequest("Hello!"), + cancellation: this.TestTimeoutToken); + + while (!this.TestTimeoutToken.IsCancellationRequested) + { + await Task.Delay(500, this.TestTimeoutToken); + + // Assert: verify the agent state was stored with the correct entity name prefix + entity = await client.Entities.GetEntityAsync(expectedEntityId, true, this.TestTimeoutToken); + + if (entity is not null) + { + break; + } + } + + Assert.NotNull(entity); + Assert.True(entity.IncludesState); + + DurableAgentState state = entity.State.ReadAs(); + + DurableAgentStateRequest request = Assert.Single(state.Data.ConversationHistory.OfType()); + + Assert.Null(request.OrchestrationId); + } + [Fact] public async Task OrchestrationIdSetDuringOrchestrationAsync() { From 7b6945e23396985eef0d5eaa6ca462daf799f2d4 Mon Sep 17 00:00:00 2001 From: Phillip Hoff Date: Fri, 12 Dec 2025 14:52:34 -0800 Subject: [PATCH 2/5] Try to disable false positive naming warning. --- dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs index 2ed502ae96..0a1f35001b 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs @@ -25,9 +25,11 @@ public Task RunAgentAsync(RunRequest request) return this.RunAgent(request); } +#pragma warning disable IDE1006 #pragma warning disable VSTHRD200 public async Task RunAgent(RunRequest request) #pragma warning restore VSTHRD200 +#pragma warning restore IDE1006 { AgentSessionId sessionId = this.Context.Id; IReadOnlyDictionary> agents = From 9786b811b9544720b2a97f03fd8fbe0471a1f79c Mon Sep 17 00:00:00 2001 From: Phillip Hoff Date: Fri, 12 Dec 2025 15:42:51 -0800 Subject: [PATCH 3/5] Add comment about disabled warnings. --- dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs index 0a1f35001b..f6daa1ca31 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs @@ -25,6 +25,7 @@ public Task RunAgentAsync(RunRequest request) return this.RunAgent(request); } + // IDE1006 and VSTHRD200 disabled to allow method name to match the common cross-platform entity operation name. #pragma warning disable IDE1006 #pragma warning disable VSTHRD200 public async Task RunAgent(RunRequest request) From 6d9fee9be4b50e349c00a3b56c62736b396fba56 Mon Sep 17 00:00:00 2001 From: Phillip Hoff Date: Fri, 12 Dec 2025 16:34:22 -0800 Subject: [PATCH 4/5] Rename `RunAgent` to just `Run`. --- dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs | 4 ++-- .../DefaultDurableAgentClient.cs | 2 +- dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs | 2 +- .../AgentEntityTests.cs | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs index f6daa1ca31..b3dfb40c34 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs @@ -22,13 +22,13 @@ internal class AgentEntity(IServiceProvider services, CancellationToken cancella public Task RunAgentAsync(RunRequest request) { - return this.RunAgent(request); + return this.Run(request); } // IDE1006 and VSTHRD200 disabled to allow method name to match the common cross-platform entity operation name. #pragma warning disable IDE1006 #pragma warning disable VSTHRD200 - public async Task RunAgent(RunRequest request) + public async Task Run(RunRequest request) #pragma warning restore VSTHRD200 #pragma warning restore IDE1006 { diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DefaultDurableAgentClient.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DefaultDurableAgentClient.cs index ad2b5b204f..9005641860 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/DefaultDurableAgentClient.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DefaultDurableAgentClient.cs @@ -22,7 +22,7 @@ public async Task RunAgentAsync( await this._client.Entities.SignalEntityAsync( sessionId, - nameof(AgentEntity.RunAgent), + nameof(AgentEntity.Run), request, cancellation: cancellationToken); diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs index fc5eab70fd..2035b792fd 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs @@ -107,7 +107,7 @@ public override async Task RunAsync( { return await this._context.Entities.CallEntityAsync( durableThread.SessionId, - nameof(AgentEntity.RunAgent), + nameof(AgentEntity.Run), request); } catch (EntityOperationFailedException e) when (e.FailureDetails.ErrorType == "EntityTaskNotFound") diff --git a/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/AgentEntityTests.cs b/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/AgentEntityTests.cs index 220116ccb5..b615bf1cd6 100644 --- a/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/AgentEntityTests.cs +++ b/dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/AgentEntityTests.cs @@ -82,7 +82,8 @@ await simpleAgentProxy.RunAsync( } [Theory] - [InlineData("RunAgent")] + [InlineData("run")] + [InlineData("Run")] [InlineData("RunAgentAsync")] public async Task RunAgentMethodNamesAllWorkAsync(string runAgentMethodName) { From 62fef49b02aaaeb0eb0a501def1f3d5ac96f698d Mon Sep 17 00:00:00 2001 From: Phillip Hoff Date: Tue, 16 Dec 2025 09:08:43 -0800 Subject: [PATCH 5/5] Update CHANGELOG. --- dotnet/src/Microsoft.Agents.AI.DurableTask/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/CHANGELOG.md b/dotnet/src/Microsoft.Agents.AI.DurableTask/CHANGELOG.md index d2cdc7cd41..770fd2f800 100644 --- a/dotnet/src/Microsoft.Agents.AI.DurableTask/CHANGELOG.md +++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## [Unreleased] + +### Changed + +- Switch to new "Run" method name ([#2843](https://github.com/microsoft/agent-framework/pull/2843)) + ## v1.0.0-preview.251204.1 - Added orchestration ID to durable agent entity state ([#2137](https://github.com/microsoft/agent-framework/pull/2137))