Skip to content

Conversation

@philliphoff
Copy link
Member

@philliphoff philliphoff commented Dec 12, 2025

Motivation and Context

Currently, the durable agent entities use an entity method name to invoke the agent that is specific to each supported platform (e.g. RunAgentAsync on .NET but run_agent on Python). This makes it difficult for external tools (such as the Durable Task Scheduler Dashboard) to interact with durable agents in a platform agnostic manner.

This change updates the .NET durable agent infrastructure to use a new, more general Run (case-insensitive) method name. The existing RunAgentAsync method will still be available to accommodate older MAF clients and any pending entity signals, but considered deprecated. After a reasonable time, the RunAgentAsync method will be removed.

Resolves (for .NET) #2234. A corresponding change will be needed for Python.

Description

Adds a new Run method to the AgentEntity that performs the same logic as the existing RunAgentAsync method. The RunAgentAsync method then just delegates to the new method (in preparation for it being removed in the future).

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 12, 2025 22:26
@philliphoff philliphoff requested review from cgillum and removed request for Copilot December 12, 2025 22:39
@github-actions github-actions bot changed the title Switch to new "RunAgent" method name. .NET: Switch to new "RunAgent" method name. Dec 12, 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 introduces a platform-agnostic method name "RunAgent" to replace the .NET-specific "RunAgentAsync" method name for invoking durable agent entities. This enables external tools like the Durable Task Scheduler Dashboard to interact with agents across different platforms (e.g., .NET and Python) in a consistent manner.

Key Changes

  • Introduced new RunAgent method as the primary entity operation name
  • Maintained backward compatibility by keeping RunAgentAsync as a wrapper that delegates to RunAgent
  • Updated all internal callers to use the new method name
  • Added comprehensive integration tests to verify both method names work correctly

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
dotnet/src/Microsoft.Agents.AI.DurableTask/AgentEntity.cs Added new RunAgent method and converted RunAgentAsync to a wrapper for backward compatibility
dotnet/src/Microsoft.Agents.AI.DurableTask/DurableAIAgent.cs Updated entity call to use RunAgent instead of RunAgentAsync
dotnet/src/Microsoft.Agents.AI.DurableTask/DefaultDurableAgentClient.cs Updated entity signal to use RunAgent instead of RunAgentAsync
dotnet/tests/Microsoft.Agents.AI.DurableTask.IntegrationTests/AgentEntityTests.cs Added parameterized test to verify both "RunAgent" and "RunAgentAsync" method names work correctly

Note: According to the repository's coding guidelines for the Durable Task area (CodingGuidelineID: 1000002), this PR should include an entry in the CHANGELOG.md file under an "## [Unreleased]" heading. The CHANGELOG.md file was not modified in this PR.

@cgillum
Copy link
Member

cgillum commented Dec 12, 2025

@philliphoff one thing not mentioned in the PR description - what is the plan for Python?

@philliphoff
Copy link
Member Author

one thing not mentioned in the PR description - what is the plan for Python?

@cgillum I could give it a go (but would rather it be a separate PR)?

@cgillum
Copy link
Member

cgillum commented Dec 13, 2025

@philliphoff sorry I should have been more clear. I'm not asking that we make the Python change in the same PR (though that would be nice). Rather, I'm trying to understand what kind of change we plan on making (now or later) in Python. In the PR description, you call out the name differences as being RunAgentAsync vs run_agent. With your change, it's now RunAgent vs run_agent. Does this mean we plan on changing Python to be RunAgent, which goes against Python method naming conventions?

I originally assumed we'd want to go with a name that works with the conventions of both languages. For example, using Run (.NET) and run in Python, without needing to worry about PascalCase vs. snake_case conventions.

@philliphoff
Copy link
Member Author

I originally assumed we'd want to go with a name that works with the conventions of both languages. For example, using Run (.NET) and run in Python, without needing to worry about PascalCase vs. snake_case conventions.

@cgillum I suggested/chose the case-insensitive runagent for the common name as it's the most basic verb-object form for method naming. (Run, in my opinion, is too terse and generic, but I could go along with that, too.) Since they're just strings passed to the signal method, there's no reason for it to be tied to any platform convention (other than their implementations which happen to directly bind to a method with that name). RunAgent doesn't conform to the .NET guidelines (due to the missing Async suffix). Luckily, the DF SDK treats entity method names as case-insensitive, which allows the .NET implementation to be near idiomatic.

(I was actually surprised that the DF SDK doesn't allow overriding the entity method name via attribute; that would be a bit cleaner.)

@cgillum
Copy link
Member

cgillum commented Dec 13, 2025

@philliphoff okay, that's basically what I wanted to confirm. I'd personally prefer run because then we only have to violate the conventions of one language and not two languages, but it's not a blocker to me as long as the Python folks are also okay with it. As far as verb-object, I'm not worried about that because the object is implied by the fact that this is an "Agent" instance that you're invoking. In that sense, "RunAgent" or "run_agent" is already redundant and renaming to "run" removes the redundancy.

/cc @larohra @gavin-aguiar

@philliphoff
Copy link
Member Author

The corresponding Python change is #2890.

@cgillum cgillum added the azure-functions Issues and PRs related to Azure Functions label Dec 15, 2025
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

Looks good. Can you also update the CHANGELOG.md file with this update? I was hoping Copilot would ask for this, but it seems to not be following the new instructions I added.

@philliphoff philliphoff changed the title .NET: Switch to new "RunAgent" method name. .NET: Switch to new "Run" method name. Dec 16, 2025
@markwallace-microsoft markwallace-microsoft added the documentation Improvements or additions to documentation label Dec 16, 2025
@philliphoff
Copy link
Member Author

Can you also update the CHANGELOG.md file with this update?

Added.

@philliphoff philliphoff added this pull request to the merge queue Dec 16, 2025
Merged via the queue into microsoft:main with commit 03a403d Dec 16, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure-functions Issues and PRs related to Azure Functions documentation Improvements or additions to documentation .NET

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants