Skip to content

Conversation

@jviau
Copy link
Member

@jviau jviau commented Dec 10, 2025

Motivation and Context

Resolves #2327

Description

Durable agent framework pipeline was taking a dependency on the precise way the durable worker extension bootstrapped an entity invocation. With a recent change to the durable extension this no longer worked as that bootstrapping was deferred. This PR reduces that dependency by removing usage of TaskEntityDispatcher (which is no longer setup by the time this executor runs) and instead uses GrpcEntityRunner. TaskEntityDispatcher is just a wrapper around GrpcEntityRunner anyways.

Another reason reducing these bootstrapping dependencies is important is that it is inherently fragile. It requires the durable functions worker middleware run first, but there is nothing guaranteeing the middleware order between the extensions today. It works right now because durable tends to be configured from source gen auto-start hooks, but that is not set in stone that it will always work that way. For long term stability it will be better to decouple the durable agent's invocations from these implementation details of the durable function worker extension.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings December 10, 2025 18:22
@github-actions github-actions bot changed the title Use GrpcEntityRunner instead of TaskEntityDispatcher .NET: Use GrpcEntityRunner instead of TaskEntityDispatcher Dec 10, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the durable agent framework to use GrpcEntityRunner directly instead of TaskEntityDispatcher, addressing a compatibility issue with recent changes to the durable worker extension where TaskEntityDispatcher is no longer initialized by the time the agent executor runs.

Key Changes:

  • Replaced TaskEntityDispatcher parameter with string parameter in entity invocation methods
  • Updated implementation to call GrpcEntityRunner.LoadAndRunAsync directly
  • Reordered parameters for consistency with other methods in the codebase

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctions.cs Changed InvokeAgentAsync method signature to accept string instead of TaskEntityDispatcher, removed async keyword, and updated implementation to use GrpcEntityRunner.LoadAndRunAsync directly
dotnet/src/Microsoft.Agents.AI.Hosting.AzureFunctions/BuiltInFunctionExecutor.cs Updated variable type from TaskEntityDispatcher to string, changed type matching in switch statement, and updated call site to match new parameter order

[EntityTrigger] TaskEntityDispatcher dispatcher,
public static Task<string> InvokeAgentAsync(
[DurableClient] DurableTaskClient client,
string dispatcher,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of dispatcher, should we be considering naming this encodedEntityRequest? (That is the parameter name of LoadAndRunAsync method to which we are passing this value to.)

Copy link
Member Author

@jviau jviau Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For binding, the name needed to match the generated function metadata. I could update that though if you want.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have the freedom to update the metadata value. I will leave it up to you to use the readable name for this one since you are more familiar with the durable concepts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed it. Can you do one more round of testing? I still can't get my local environment to work due to lack of permissions.

Copy link
Contributor

@kshyju kshyju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also update the changelogs.md?

@markwallace-microsoft markwallace-microsoft added the documentation Improvements or additions to documentation label Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

None yet

3 participants