From 0a4e3eb593eff50f5d30fdf1ea6c1bcf807a0182 Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Wed, 10 Dec 2025 10:16:27 -0800 Subject: [PATCH 1/5] Use GrpcEntityRunner instead of TaskEntityDispatcher --- .../BuiltInFunctionExecutor.cs | 6 +++--- .../BuiltInFunctions.cs | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs index 10b1bc54ff..baaf85cf4b 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs @@ -32,7 +32,7 @@ public async ValueTask ExecuteAsync(FunctionContext context) } HttpRequestData? httpRequestData = null; - TaskEntityDispatcher? dispatcher = null; + string? dispatcher = null; DurableTaskClient? durableTaskClient = null; ToolInvocationContext? mcpToolInvocationContext = null; @@ -43,7 +43,7 @@ public async ValueTask ExecuteAsync(FunctionContext context) case HttpRequestData request: httpRequestData = request; break; - case TaskEntityDispatcher entityDispatcher: + case string entityDispatcher: dispatcher = entityDispatcher; break; case DurableTaskClient client: @@ -84,8 +84,8 @@ public async ValueTask ExecuteAsync(FunctionContext context) } await BuiltInFunctions.InvokeAgentAsync( - dispatcher, durableTaskClient, + dispatcher, context); return; } diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs index ebd378ac3b..1c5fff45ca 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs @@ -7,6 +7,7 @@ using Microsoft.Azure.Functions.Worker.Extensions.Mcp; using Microsoft.Azure.Functions.Worker.Http; using Microsoft.DurableTask.Client; +using Microsoft.DurableTask.Worker.Grpc; using Microsoft.Extensions.AI; using Microsoft.Extensions.DependencyInjection; @@ -22,14 +23,14 @@ internal static class BuiltInFunctions internal static readonly string RunAgentMcpToolFunctionEntryPoint = $"{typeof(BuiltInFunctions).FullName!}.{nameof(RunMcpToolAsync)}"; // Exposed as an entity trigger via AgentFunctionsProvider - public static async Task InvokeAgentAsync( - [EntityTrigger] TaskEntityDispatcher dispatcher, + public static Task InvokeAgentAsync( [DurableClient] DurableTaskClient client, + string dispatcher, FunctionContext functionContext) { // This should never be null except if the function trigger is misconfigured. - ArgumentNullException.ThrowIfNull(dispatcher); ArgumentNullException.ThrowIfNull(client); + ArgumentNullException.ThrowIfNull(dispatcher); ArgumentNullException.ThrowIfNull(functionContext); // Create a combined service provider that includes both the existing services @@ -38,7 +39,8 @@ public static async Task InvokeAgentAsync( // This method is the entry point for the agent entity. // It will be invoked by the Azure Functions runtime when the entity is called. - await dispatcher.DispatchAsync(new AgentEntity(combinedServiceProvider, functionContext.CancellationToken)); + AgentEntity entity = new(combinedServiceProvider, functionContext.CancellationToken); + return GrpcEntityRunner.LoadAndRunAsync(dispatcher, entity, combinedServiceProvider); } public static async Task RunAgentHttpAsync( From a6481252ee0a26ba295719f2acd08311a8e7a02a Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Wed, 10 Dec 2025 15:07:19 -0800 Subject: [PATCH 2/5] Pin to Durable worker 1.11.0 --- dotnet/Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index 6aace8b254..78ee024fc3 100644 --- a/dotnet/Directory.Packages.props +++ b/dotnet/Directory.Packages.props @@ -121,7 +121,7 @@ - + From 8aafdd80af1e230d1a34f6d37540a7f79a4bec49 Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Wed, 10 Dec 2025 15:54:59 -0800 Subject: [PATCH 3/5] Set the invocation result --- .../BuiltInFunctionExecutor.cs | 2 +- .../BuiltInFunctions.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs index baaf85cf4b..1487c0e9c5 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs @@ -83,7 +83,7 @@ public async ValueTask ExecuteAsync(FunctionContext context) throw new InvalidOperationException($"Task entity dispatcher binding is missing for the invocation {context.InvocationId}."); } - await BuiltInFunctions.InvokeAgentAsync( + context.GetInvocationResult().Value = await BuiltInFunctions.InvokeAgentAsync( durableTaskClient, dispatcher, context); diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs index 1c5fff45ca..d430a47735 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs @@ -23,7 +23,7 @@ internal static class BuiltInFunctions internal static readonly string RunAgentMcpToolFunctionEntryPoint = $"{typeof(BuiltInFunctions).FullName!}.{nameof(RunMcpToolAsync)}"; // Exposed as an entity trigger via AgentFunctionsProvider - public static Task InvokeAgentAsync( + public static Task InvokeAgentAsync( [DurableClient] DurableTaskClient client, string dispatcher, FunctionContext functionContext) From 2515fc087fa963c9f9b9d585ee92dec48734178c Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Thu, 11 Dec 2025 08:50:26 -0800 Subject: [PATCH 4/5] Update all Durable packages --- dotnet/Directory.Packages.props | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props index 78ee024fc3..3da6ee2511 100644 --- a/dotnet/Directory.Packages.props +++ b/dotnet/Directory.Packages.props @@ -114,15 +114,15 @@ - - - - + + + + - + From 8206b4037ecea3ea31152248a5aec4b563d54e93 Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Tue, 16 Dec 2025 12:40:37 -0800 Subject: [PATCH 5/5] Update changelog, rename dispatcher to encondedEntityRequest --- .../BuiltInFunctionExecutor.cs | 10 +++++----- .../BuiltInFunctions.cs | 6 +++--- .../CHANGELOG.md | 4 ++++ .../DurableAgentFunctionMetadataTransformer.cs | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs index 1487c0e9c5..fa0b9ef287 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs @@ -32,7 +32,7 @@ public async ValueTask ExecuteAsync(FunctionContext context) } HttpRequestData? httpRequestData = null; - string? dispatcher = null; + string? encodedEntityRequest = null; DurableTaskClient? durableTaskClient = null; ToolInvocationContext? mcpToolInvocationContext = null; @@ -43,8 +43,8 @@ public async ValueTask ExecuteAsync(FunctionContext context) case HttpRequestData request: httpRequestData = request; break; - case string entityDispatcher: - dispatcher = entityDispatcher; + case string entityRequest: + encodedEntityRequest = entityRequest; break; case DurableTaskClient client: durableTaskClient = client; @@ -78,14 +78,14 @@ public async ValueTask ExecuteAsync(FunctionContext context) if (context.FunctionDefinition.EntryPoint == BuiltInFunctions.RunAgentEntityFunctionEntryPoint) { - if (dispatcher is null) + if (encodedEntityRequest is null) { throw new InvalidOperationException($"Task entity dispatcher binding is missing for the invocation {context.InvocationId}."); } context.GetInvocationResult().Value = await BuiltInFunctions.InvokeAgentAsync( durableTaskClient, - dispatcher, + encodedEntityRequest, context); return; } diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs index d430a47735..3d824994e9 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs @@ -25,12 +25,12 @@ internal static class BuiltInFunctions // Exposed as an entity trigger via AgentFunctionsProvider public static Task InvokeAgentAsync( [DurableClient] DurableTaskClient client, - string dispatcher, + string encodedEntityRequest, FunctionContext functionContext) { // This should never be null except if the function trigger is misconfigured. ArgumentNullException.ThrowIfNull(client); - ArgumentNullException.ThrowIfNull(dispatcher); + ArgumentNullException.ThrowIfNull(encodedEntityRequest); ArgumentNullException.ThrowIfNull(functionContext); // Create a combined service provider that includes both the existing services @@ -40,7 +40,7 @@ public static Task InvokeAgentAsync( // This method is the entry point for the agent entity. // It will be invoked by the Azure Functions runtime when the entity is called. AgentEntity entity = new(combinedServiceProvider, functionContext.CancellationToken); - return GrpcEntityRunner.LoadAndRunAsync(dispatcher, entity, combinedServiceProvider); + return GrpcEntityRunner.LoadAndRunAsync(encodedEntityRequest, entity, combinedServiceProvider); } public static async Task RunAgentHttpAsync( diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/CHANGELOG.md b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/CHANGELOG.md index d32f4bb0e2..a606629dc2 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/CHANGELOG.md +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## + +- Addressed incompatibility issue with `Microsoft.Azure.Functions.Worker.Extensions.DurableTask` >= 1.11.0 ([#2759](https://github.com/microsoft/agent-framework/pull/2759)) + ## v1.0.0-preview.251125.1 - Added support for .NET 10 ([#2128](https://github.com/microsoft/agent-framework/pull/2128)) diff --git a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/DurableAgentFunctionMetadataTransformer.cs b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/DurableAgentFunctionMetadataTransformer.cs index cce8fbd1b0..f626db2a90 100644 --- a/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/DurableAgentFunctionMetadataTransformer.cs +++ b/dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/DurableAgentFunctionMetadataTransformer.cs @@ -73,7 +73,7 @@ private static DefaultFunctionMetadata CreateAgentTrigger(string name) Language = "dotnet-isolated", RawBindings = [ - """{"name":"dispatcher","type":"entityTrigger","direction":"In"}""", + """{"name":"encodedEntityRequest","type":"entityTrigger","direction":"In"}""", """{"name":"client","type":"durableClient","direction":"In"}""" ], EntryPoint = BuiltInFunctions.RunAgentEntityFunctionEntryPoint,