-
Notifications
You must be signed in to change notification settings - Fork 273
feat: add azure agent code gen best practice tool #1031
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
feat: add azure agent code gen best practice tool #1031
Conversation
d9f9db4 to
8ef5e3a
Compare
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 adds a new Azure Agent Best Practices toolset that provides comprehensive guidance for building AI agents with Azure AI Foundry and Microsoft Agent Framework. The implementation follows the existing pattern of best practices tools in the codebase (similar to AzureBestPractices and AzureTerraformBestPractices).
Key changes:
- New tool command that returns best practices text from an embedded resource file covering model selection, SDK recommendations, and implementation patterns
- Integration of the new tool into the server's area registration and consolidated tools list
- Comprehensive test coverage for the new command
- Documentation updates including commands reference, E2E test prompts, and CHANGELOG
Reviewed Changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/Azure.Mcp.Tools.AzureAgentBestPractices/src/Commands/AzureAgentBestPracticesGetCommand.cs | Implements the command to retrieve agent best practices from embedded resource |
| tools/Azure.Mcp.Tools.AzureAgentBestPractices/src/AzureAgentBestPracticesSetup.cs | Registers the command group and configures dependency injection |
| tools/Azure.Mcp.Tools.AzureAgentBestPractices/src/Resources/agent-best-practices-for-azure.txt | Contains 413 lines of detailed best practices guidance text |
| tools/Azure.Mcp.Tools.AzureAgentBestPractices/tests/Azure.Mcp.Tools.AzureAgentBestPractices.UnitTests/AzureAgentBestPracticesGetCommandTests.cs | Unit test validating command execution and response content |
| servers/Azure.Mcp.Server/src/Program.cs | Registers the new area setup in the server |
| core/Azure.Mcp.Core/src/Areas/Server/Resources/consolidated-tools.json | Adds the tool to the consolidated Azure best practices group |
| core/Azure.Mcp.Core/src/Areas/Server/Resources/azure-rules.txt | Documents when to invoke the agent best practices tool |
| servers/Azure.Mcp.Server/docs/*.md | Updates command documentation and E2E test prompts |
| .github/CODEOWNERS | Adds code ownership for the new tool |
| AzureMcp.sln | Adds projects to the solution file |
| eng/tools/ToolDescriptionEvaluator/*.json | Updates tool metadata and test prompts |
tools/Azure.Mcp.Tools.AzureAgentBestPractices/src/Commands/AzureAgentBestPracticesGetCommand.cs
Outdated
Show resolved
Hide resolved
tools/Azure.Mcp.Tools.AzureAIBestPractices/src/Commands/AzureAIBestPracticesGetCommand.cs
Show resolved
Hide resolved
...s/Azure.Mcp.Tools.AzureAgentBestPractices/src/Commands/AzureAgentBestPracticesJsonContext.cs
Outdated
Show resolved
Hide resolved
865dfb5 to
e68e797
Compare
|
I agree we should consolidate best practices tools. We spent a lot of effort condensing the 5-6 previous best practices into 2. I'd expect us to have test results with the two different namespace designs and take a data driven approach here. |
|
I would suggest try using the existing |
Our initial version of the code is integrated with the existing best practices tool / new tool under the existing namespace, and we have tested it in VS with GitHub Copilot using the following test cases:
We found it is difficult to trigger the agent best practice
|
|
@JasonYeMSFT Test Report
Main Issues Identified
While Azure rules help reduce confusion between tools, providing a clear and distinct namespace description can further improve accuracy and avoid miscalls. Why we need a new namespaceThe new tool provide an end-to-end agent solution in Azure, not just generate code for a single resource like Azure AI Foundry. When the user’s goal is to design, scaffold, or ship an LLM/agent solution on Azure (for example, “I want to leverage an LLM to do X in Azure”). The new agent best practice tool should be called. The tool will recommend Azure AI Foundry as the platform and use the Microsoft Agent SDK to help the user build the app. When the request is about Azure AI Foundry data-plane operations and resource management, the existing best practice namespace should be used. Therefore, routing should be intent-based, not keyword(Azure resource name) based. The presence of “Azure AI Foundry” alone should not trigger this tool. Sample Failure Cases
Our future planAnother reason we need a new namespace is our future plan. Right now, the best-practices namespace only supports code generation. We plan to add AI feature evaluation and AI app tracing in Foundry—capabilities the current namespace can’t support because it’s built to trigger on Azure resource keywords rather than on user intent. |
e68e797 to
e982be6
Compare
|
Thanks for performing these detailed tests. Were they performed with server instructions? Can you share the test results with these? Also was this new namespace tested in conjunction with the AI Foundry namespace prompts as well? Just want to make sure we don't regress calling of existing tools in AI Foundry. Thanks! |
Yes, the above tests were performed using the server instructions specified in azure-rules.txt. Both the existing and new namespaces were tested with almost same server instructions—the only differences were the namespace and command references. Actually, if there are no server instructions, using the existing namespace will not work at all in GPT-5. |
fe6d600 to
ec33bf0
Compare
What we tested
Test Result
Baseline failures (no new namespace)
New failures introduced after adding the new namespace
|
43d3a8d to
f6cf9f1
Compare
.../tests/Azure.Mcp.Tools.AzureAIBestPractices.UnitTests/AzureAIBestPracticesGetCommandTests.cs
Outdated
Show resolved
Hide resolved
f6cf9f1 to
4382fe0
Compare
4382fe0 to
220e90d
Compare
fanyang-mono
left a comment
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.
Thanks for conducting the test and providing detailed information about your test results.
|
/azp run mcp - pullrequest - live |
|
Commenter does not have sufficient privileges for PR 1031 in repo microsoft/mcp |
|
/azp run mcp - pullrequest - live |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Added tracking issue: #1110 |
What does this PR do?
Azure.Mcp.Tools.AzureAgentBestPractices(AzureAgentBestPractices namespace)This namespace provides best practices guidance for building AI applications and agents in Azure.
azureagentbestpractices_getThe associated tool offers actionable recommendations for developers before generating code for any AI apps/agents in Azure. It recommends developing with Azure AI Foundry models, working with the Microsoft Agent Framework, or implementing AI agents within Azure AI Foundry. It is intended to be used when users are coding AI apps/agents in Azure.
Microsoft Agent Framework: https://learn.microsoft.com/en-us/agent-framework/user-guide/agents/agent-types/azure-ai-foundry-agent?pivots=programming-language-csharp
GitHub issue number?
#960
Pre-merge Checklist
servers/Azure.Mcp.Server/CHANGELOG.mdand/orservers/Fabric.Mcp.Server/CHANGELOG.mdfor product changes (features, bug fixes, UI/UX, updated dependencies)servers/Azure.Mcp.Server/README.mdand/orservers/Fabric.Mcp.Server/README.mddocumentationeng/scripts/Process-PackageReadMe.ps1. See Package README/servers/Azure.Mcp.Server/docs/azmcp-commands.mdand/or/docs/fabric-commands.md.\eng\scripts\Update-AzCommandsMetadata.ps1to update tool metadata in azmcp-commands.md (required for CI)ToolDescriptionEvaluatorand obtained a score of0.4or more and a top 3 ranking for all related test prompts/servers/Azure.Mcp.Server/docs/e2eTestPrompts.mdcrypto mining, spam, data exfiltration, etc.)/azp run mcp - pullrequest - liveto run Live Test Pipeline