Skip to content

Remove AI Tool Reduction experimental APIs#7353

Merged
stephentoub merged 7 commits intomainfrom
copilot/remove-tool-reduction-apis
Mar 3, 2026
Merged

Remove AI Tool Reduction experimental APIs#7353
stephentoub merged 7 commits intomainfrom
copilot/remove-tool-reduction-apis

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

  • Delete source files:
    • src/Libraries/Microsoft.Extensions.AI.Abstractions/ToolReduction/IToolReductionStrategy.cs
    • src/Libraries/Microsoft.Extensions.AI/ToolReduction/ToolReducingChatClient.cs
    • src/Libraries/Microsoft.Extensions.AI/ToolReduction/EmbeddingToolReductionStrategy.cs
    • src/Libraries/Microsoft.Extensions.AI/ToolReduction/ChatClientBuilderToolReductionExtensions.cs
  • Delete test file: test/Libraries/Microsoft.Extensions.AI.Integration.Tests/ToolReductionTests.cs
  • Remove tool reduction integration tests and RemoveToolAfterFirstUseStrategy helper class from ChatClientIntegrationTests.cs
  • Remove dead EmbeddingGenerator property, CreateEmbeddingGenerator(), and EnsureEmbeddingGenerator() members (and stale "tool reduction" comment) from ChatClientIntegrationTests.cs
  • Remove AIToolReduction diagnostic ID from DiagnosticIds.cs
  • Remove tool reduction entries from API baseline JSON files (Microsoft.Extensions.AI.json and Microsoft.Extensions.AI.Abstractions.json)
  • Revert CHANGELOG.md changes per reviewer request
  • Restore using System.Diagnostics.CodeAnalysis; needed for [MemberNotNull] on SkipIfNotEnabled
  • Remove orphaned CreateEmbeddingGenerator() override from OpenAIChatClientIntegrationTests (no references in any tests)
  • Add CompatibilitySuppressions.xml for both AI packages to suppress baseline compatibility errors for removed experimental types
Original prompt

This section details on the original issue you should resolve

<issue_title>Remove AI Tool Reduction experimental APIs</issue_title>
<issue_description>> Many of the emerging approaches operate at the agent level rather than the chat client level, so it's unclear that IChatClient middleware is even the right layer for this. Either way, I don't think it makes sense to commit to a first-class MEAI abstraction in this PR. This can still be implemented as custom middleware by anyone who needs it today 🙂

Originally posted by @MackinnonBuck in #6865 (comment)

Per this conclusion, we should remove the experimental APIs related to tool reduction.</issue_description>

<agent_instructions>Remove all tool-reduction related APIs and associated tests, docs, etc. There's an interface, some With methods, etc</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Microsoft Reviewers: Open in CodeFlow

@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Mar 3, 2026
Remove IToolReductionStrategy interface, ToolReducingChatClient,
EmbeddingToolReductionStrategy, UseToolReduction extension method,
associated tests, API baselines, CHANGELOG entry, and diagnostic ID.

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove experimental APIs related to tool reduction Remove AI Tool Reduction experimental APIs Mar 3, 2026
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
@stephentoub
Copy link
Member

@copilot, other than in the changelog, are there any remaining references anywhere in the repo in any kind of file to tool reduction, tool reducers, etc.?

…oval

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot, other than in the changelog, are there any remaining references anywhere in the repo in any kind of file to tool reduction, tool reducers, etc.?

Yes — there was one remaining reference in ChatClientIntegrationTests.cs: a comment mentioning "tool reduction" as a use case, along with the dead EmbeddingGenerator property, CreateEmbeddingGenerator(), and EnsureEmbeddingGenerator() methods that were left behind when the tool-reduction tests were removed (none of them were called or overridden anywhere). All cleaned up in 3b8fd64. The CHANGELOG.md entry is the only remaining reference in the repo.

@stephentoub stephentoub marked this pull request as ready for review March 3, 2026 13:23
@stephentoub stephentoub requested review from a team as code owners March 3, 2026 13:23
@stephentoub stephentoub enabled auto-merge (squash) March 3, 2026 13:23
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 removes the experimental “tool reduction” surface area from the Microsoft.Extensions.AI stack (APIs, middleware, diagnostic ID, and associated integration tests), aligning with the decision to not commit to a first-class MEAI abstraction for tool reduction.

Changes:

  • Deleted the tool reduction abstractions and implementations (IToolReductionStrategy, ToolReducingChatClient, EmbeddingToolReductionStrategy, and builder extensions).
  • Removed tool-reduction-focused integration tests and updated integration test baselines accordingly.
  • Removed the associated experimental diagnostic ID and API baseline entries.

Reviewed changes

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

Show a summary per file
File Description
test/Libraries/Microsoft.Extensions.AI.Integration.Tests/ToolReductionTests.cs Removes unit/integration coverage dedicated to tool reduction strategies and middleware.
test/Libraries/Microsoft.Extensions.AI.Integration.Tests/ChatClientIntegrationTests.cs Deletes tool reduction scenarios and embedding-generator plumbing that existed to support them.
src/Shared/DiagnosticIds/DiagnosticIds.cs Removes the AIToolReduction experiment diagnostic constant.
src/Libraries/Microsoft.Extensions.AI/ToolReduction/ToolReducingChatClient.cs Deletes the tool-reducing delegating chat client middleware.
src/Libraries/Microsoft.Extensions.AI/ToolReduction/EmbeddingToolReductionStrategy.cs Deletes the embedding-based tool reduction strategy implementation.
src/Libraries/Microsoft.Extensions.AI/ToolReduction/ChatClientBuilderToolReductionExtensions.cs Deletes UseToolReduction pipeline extension.
src/Libraries/Microsoft.Extensions.AI/Microsoft.Extensions.AI.json Removes tool reduction types from the AI library API baseline.
src/Libraries/Microsoft.Extensions.AI.Abstractions/ToolReduction/IToolReductionStrategy.cs Deletes the tool reduction strategy abstraction from the abstractions package.
src/Libraries/Microsoft.Extensions.AI.Abstractions/Microsoft.Extensions.AI.Abstractions.json Removes IToolReductionStrategy from the abstractions API baseline.

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
auto-merge was automatically disabled March 3, 2026 13:49

Head branch was pushed to by a user without write access

…ntIntegrationTests

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
auto-merge was automatically disabled March 3, 2026 14:41

Head branch was pushed to by a user without write access

Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot, other than in the changelog, are there any remaining references anywhere in the repo in any kind of file to tool reduction, tool reducers, etc.?

The only remaining reference is in CHANGELOG.md (line 46), which was intentionally kept. No other files in the repo reference tool reduction, tool reducers, IToolReductionStrategy, AIToolReduction, etc.

@stephentoub stephentoub enabled auto-merge (squash) March 3, 2026 15:00
@stephentoub
Copy link
Member

@copilot fix the CI failures by updating the compatibility suppressions

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
auto-merge was automatically disabled March 3, 2026 15:35

Head branch was pushed to by a user without write access

Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

@copilot fix the CI failures by updating the compatibility suppressions

Added auto-generated CompatibilitySuppressions.xml files for both Microsoft.Extensions.AI and Microsoft.Extensions.AI.Abstractions in 916d3f6. These suppress CP0001 baseline compatibility errors for the removed types (IToolReductionStrategy, ToolReducingChatClient, EmbeddingToolReductionStrategy, ChatClientBuilderToolReductionExtensions) across all TFMs.

@stephentoub stephentoub enabled auto-merge (squash) March 3, 2026 16:32
@stephentoub stephentoub merged commit cd82ca1 into main Mar 3, 2026
6 checks passed
@stephentoub stephentoub deleted the copilot/remove-tool-reduction-apis branch March 3, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove AI Tool Reduction experimental APIs

4 participants