-
Notifications
You must be signed in to change notification settings - Fork 790
.NET: Fix workflow lookup with AddAsAIAgent(name) when name differs from workflow name #1925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lokitoth
merged 1 commit into
microsoft:main
from
jeffhandley:jeffhandley/addasaiagent-name
Nov 5, 2025
Merged
.NET: Fix workflow lookup with AddAsAIAgent(name) when name differs from workflow name #1925
lokitoth
merged 1 commit into
microsoft:main
from
jeffhandley:jeffhandley/addasaiagent-name
Nov 5, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
There was a problem hiding this 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 fixes a bug in the AddAsAIAgent extension method where the workflow was being retrieved using the agent name instead of the workflow name, causing failures when they differ.
- Fixed workflow retrieval to use the workflow name consistently
- Added comprehensive test coverage for various
AddAsAIAgentscenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 21 comments.
| File | Description |
|---|---|
| HostedWorkflowBuilderExtensions.cs | Fixed bug where workflow was retrieved using agent key instead of workflow name |
| HostApplicationBuilderWorkflowExtensionsTests.cs | Added 8 new test methods covering different AddAsAIAgent scenarios including name parameter variations |
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
...tests/Microsoft.Agents.AI.Hosting.UnitTests/HostApplicationBuilderWorkflowExtensionsTests.cs
Show resolved
Hide resolved
DeagleGross
approved these changes
Nov 5, 2025
lokitoth
approved these changes
Nov 5, 2025
rogerbarreto
added a commit
that referenced
this pull request
Nov 5, 2025
* .NET: [BREAKING] Simplify TextSearchProvider construction and improve Mem0Provider scoping. (#1905) * Simplify TextSearchProvider construction and improve Mem0Provider scoping * Fixing indentation. * .NET: [Breaking Change] Moving MAAI.AzureAI V1 Package -> MAAI.AzureAI.Persistent (V1) (#1902) * Update AzureAI -> AzureAI.Persistent * Fix sample reference * Fix workflow lookup with AddAsAIAgent(name) when name differs from workflow name (#1925) * .NET: AG-UI support for .NET (#1776) * Initial plan * Infrastructure setup * Plan for minimal client * Plan update * Basic agentic chat * cleanup * Cleanups * More cleanups * Cleanups * More cleanups * Test plan * Sample * Fix streaming and error handling * Fix notifications * Cleanups * cleanup sample * Additional tests * Additional tests * Run dotnet format * Remove unnecessary files * Mark packages as non packable * Fix build * Address feedback * Fix build * Fix remaining warnings * Feedback * Feedback and cleanup * Cleanup * Cleanups * Cleanups * Cleanups * Retrieve existing messages from the store to send them along the way and update the sample client * Run dotnet format * Add ADR for AG-UI * Switch to use the SG and use a convention for run ids * Cleanup MapAGUI API * Fix formatting * Fix solution * Fix solution * Python: Added parameter to disable agent cleanup in AzureAIAgentClient (#1882) * Removed automatic agent cleanup in AzureAIAgentClient * Revert "Removed automatic agent cleanup in AzureAIAgentClient" This reverts commit 89846c7. * Exposed boolean flag to control deletion behavior * Update sample * [BREAKING] refactor: Fix unintuitive binding of StreamAsync (#1930) In #1551 we added a mechanism to open a Streaming workflow run without providing any input. This caused unintuitive behaviour when passing a string as input without providing a runId, resulting in the input being misinterpreted as the runId and the workflow not executing. As well, the name caused confusion about why the Workflow was not running when using the input-less StreamAsync (since the Workflow cannot run without any messages to drive its execution). * Python: fix missing packaging dependency (#1929) * fix missing packaging dependency * add aiohttp to azureai * Bring back files * Address merge conflict * Address merge conflict+ --------- Co-authored-by: westey <[email protected]> Co-authored-by: Jeff Handley <[email protected]> Co-authored-by: Javier Calvarro Nelson <[email protected]> Co-authored-by: Dmytro Struk <[email protected]> Co-authored-by: Jacob Alber <[email protected]> Co-authored-by: Eduard van Valkenburg <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1924
Description
The call to
GetRequiredKeyedService<Workflow>was using the specified agent name rather than the workflow name.Contribution Checklist
AddAsAIAgentand the newAddAsAIAgent_WithDifferentName_RetrievesWorkflowCorrectlyfailed before the fix was applied