Skip to content

.NET: Allow agents to opt into concurrent tool invocation - #7650

Merged
westey (westey-m) merged 2 commits into
microsoft:mainfrom
ump45nose:fix/7640-concurrent-tool-invocation
Aug 17, 2026
Merged

.NET: Allow agents to opt into concurrent tool invocation#7650
westey (westey-m) merged 2 commits into
microsoft:mainfrom
ump45nose:fix/7640-concurrent-tool-invocation

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Motivation & Context

AsAIAgent() always left its default FunctionInvokingChatClient in serial invocation mode, even when the model returned multiple independent tool calls. This adds an explicit, backward-compatible opt-in for concurrent execution while preserving the current serial default.

Description & Review Guide

  • What are the major changes? Add ChatClientAgentOptions.AllowConcurrentInvocation, pass it to the default function-invocation middleware, preserve it when cloning options, and cover both paths with focused unit tests.
  • What is the impact of these changes? Existing agents remain serial by default; callers may opt in when their tools are safe to execute concurrently.
  • What do you want reviewers to focus on? The separation between model-side AllowMultipleToolCalls and runtime function-invocation concurrency.

Related Issue

Fixes#7640

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

CopilotAI balanced review requested due to automatic review settings August 13, 2026 15:41
@agent-framework-automationagent-framework-automationBot added the .NET Usage: [Issues, PRs], Target: .Net label Aug 13, 2026

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds opt-in concurrent tool invocation for .NET chat-client agents while retaining serial execution by default.

Changes:

  • Adds and clones AllowConcurrentInvocation.
  • Configures default function-invocation middleware.
  • Adds focused option and middleware tests.

Reviewed changes

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

FileDescription
ChatClientExtensions.csApplies concurrency configuration to new middleware.
ChatClientAgentOptions.csExposes and clones the new option.
ChatClientExtensionsTests.csTests enabling concurrent invocation.
ChatClientAgentOptionsTests.csTests defaults and cloning.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@ump45nose

Copy link
Copy Markdown
ContributorAuthor

@microsoft-github-policy-service agree

ump45nose please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@ump45nose
ump45noseforce-pushed the fix/7640-concurrent-tool-invocation branch from 1afb1b3 to 2f32adfCompareAugust 17, 2026 02:59
@ump45nose

Copy link
Copy Markdown
ContributorAuthor

Roger Barreto (@rogerbarreto) — The CLA is complete, both review threads are resolved, and the branch is now rebased onto current main. The focused option/middleware suite passes all 15 tests on the final head. When you have time, I would appreciate a review.

@westey-mwestey (westey-m) self-assigned this Aug 17, 2026
@westey-m
westey (westey-m) added this pull request to the merge queueAug 17, 2026
@westey-m

Copy link
Copy Markdown
Contributor

Thanks for the contribution ump45nose

Merged via the queue into microsoft:main with commit 047ec7eAug 17, 2026
25 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NETUsage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: [Bug]: AsAIAgent serializes parallel tool calls returned in one Responses result

5 participants

@ump45nose@westey-m@rogerbarreto@SergeyMenshykh