Adds support for foundry prompt agents#16353
Open
tommasodotNET wants to merge 13 commits intomicrosoft:mainfrom
Open
Adds support for foundry prompt agents#16353tommasodotNET wants to merge 13 commits intomicrosoft:mainfrom
tommasodotNET wants to merge 13 commits intomicrosoft:mainfrom
Conversation
Implement core infrastructure for Foundry prompt agents and tools: - IFoundryTool interface and FoundryToolResource base class for tool abstraction - AzurePromptAgentResource with pipeline steps, deploy logic, and connection properties - PromptAgentConfiguration wrapping SDK's PromptAgentDefinition - Built-in tool definitions: CodeInterpreter, FileSearch, WebSearch - AzureAISearchToolResource wrapping AzureSearchResource with project connections - PromptAgentBuilderExtensions with AddPromptAgent, WithTool, and convenience methods - Azure AI Search connection overload in ConnectionBuilderExtensions - OPENAI001 diagnostic suppression for OpenAI.Responses types Tools use ResponseTool (OpenAI.Responses) as the common type since PromptAgentDefinition.Tools is IList<ResponseTool>. AgentTool subtypes (like AzureAISearchAgentTool) have implicit conversion to ResponseTool. Part of: microsoft#16263 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests cover: - AddPromptAgent extension method (resource creation, model/instructions, null checks) - WithCodeInterpreter, WithFileSearch, WithWebSearch (built-in tools) - AddAzureAISearchTool (resource-backed tool) - WithTool (adding tools to agents) - WithReference for connection string injection - PromptAgentConfiguration (defaults, metadata, ToAgentVersionCreationOptions) - Interface implementation verification Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
New tools: - BingGroundingToolResource: Resource-backed tool for Bing Search grounding - SharePointToolDefinition: Config-only tool for SharePoint data grounding - FabricToolDefinition: Config-only tool for Microsoft Fabric data agents - AzureFunctionToolDefinition: Azure Functions with queue-based bindings - FunctionToolDefinition: OpenAI function calling (application-defined functions) - ImageGenerationToolDefinition: Image generation (preview, behind [Experimental]) - ComputerToolDefinition: Computer use (preview, behind [Experimental]) Extension methods: - AddBingGroundingTool, WithSharePoint, WithFabric, WithAzureFunction - WithFunction, WithImageGeneration, WithComputerUse Tests: 82 total (all passing), covering all tool types README: Updated with prompt agent usage and tool reference table Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Convert all tool types from IFoundryTool definitions to FoundryToolResource subclasses - Tools are now created at the project level with Add*Tool() methods - Resource-backed tools linked via .WithReference() overloads - AddPromptAgent takes params IResourceBuilder<FoundryToolResource>[] tools - Same-project validation: tools must belong to same project as agent - Keep IFoundryTool as escape hatch via WithCustomTool() on agent - Update all tests (86 passing) and README for new API Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Grounding with Bing Search resource cannot be provisioned via Bicep/ARM — users must create it in the Azure portal and reference the resulting Foundry project connection. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add BingGroundingConnectionProperties with ApiKey auth and category 'GroundingWithBingSearch' matching the ARM template - Add AddBingGroundingConnection() to create connections from a Bing resource ID (Microsoft.Bing/accounts) - Add WithReference(string bingResourceId) overload that auto-creates the correctly-typed connection - Fix duplicate WithRoleAssignments call in AI Search WithReference (AddConnection already handles role assignments) - Update README with simplified Bing examples - Add 3 new tests (89 total, all passing) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- AppHost with two prompt agents: research-agent (Bing + AI Search + code interpreter) and joker-agent (code interpreter + file search) - PromptAgentChat consumer web app using OpenAI Responses API - Added WithReference(IResourceBuilder<ParameterResource>) overload for Bing Grounding tool (supports user secrets for resource ID) - Added AddBingGroundingConnection parameter overload - Added to Aspire.slnx solution - 91 tests passing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16353Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16353" |
…tNET/aspire into features/foundry-prompt-agents
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class Aspire Hosting support for Azure AI Foundry prompt agents (declarative agents + tool catalog), including run-mode deployment via eventing, publish-time deployment via pipeline steps, and a playground sample to demonstrate end-to-end usage.
Changes:
- Introduces
AzurePromptAgentResource, supporting prompt-agent deployment to Foundry and connection-string consumption by services. - Adds a set of project-level Foundry tool resources (built-in, config-only, and resource-backed) plus builder extensions (
Add*Tool,WithReference, etc.). - Updates Foundry project/connection provisioning outputs and bumps Azure AI Projects SDK usage, plus adds tests + a playground sample.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Hosting.Foundry.Tests/PromptAgentTests.cs | New unit tests covering prompt agent + tool resource creation and reference semantics. |
| tests/Aspire.Hosting.Foundry.Tests/PromptAgentConfigurationTests.cs | New unit tests validating prompt-agent configuration conversion to SDK options. |
| tests/Aspire.Hosting.Foundry.Tests/HostedAgentConfigurationTests.cs | Updates tests to the renamed hosted-agent options conversion method. |
| src/Aspire.Hosting.Foundry/README.md | Documents prompt-agent usage and available tools (plus examples). |
| src/Aspire.Hosting.Foundry/PromptAgent/PromptAgentDeployer.cs | Run-mode deployer that provisions prompt agents after Azure provisioning completes. |
| src/Aspire.Hosting.Foundry/PromptAgent/PromptAgentConfiguration.cs | Prompt-agent configuration wrapper around ProjectsAgentVersionCreationOptions. |
| src/Aspire.Hosting.Foundry/PromptAgent/PromptAgentBuilderExtensions.cs | Public builder API for adding prompt agents + tool resources and linking references. |
| src/Aspire.Hosting.Foundry/PromptAgent/IFoundryTool.cs | Tool extensibility interface for deploy-time conversion to SDK tool types. |
| src/Aspire.Hosting.Foundry/PromptAgent/FunctionToolDefinition.cs | Tool resource for function-calling tool definitions. |
| src/Aspire.Hosting.Foundry/PromptAgent/FoundryToolResource.cs | Base resource type for project-level Foundry tool resources. |
| src/Aspire.Hosting.Foundry/PromptAgent/ConfigOnlyToolDefinitions.cs | Tool resources for SharePoint/Fabric grounding via existing project connections. |
| src/Aspire.Hosting.Foundry/PromptAgent/BuiltInToolDefinitions.cs | Tool resources for built-in tools (code interpreter, file search, web search, etc.). |
| src/Aspire.Hosting.Foundry/PromptAgent/BingGroundingToolResource.cs | Tool resource for Bing grounding using a Foundry project connection. |
| src/Aspire.Hosting.Foundry/PromptAgent/AzurePromptAgentResource.cs | Core prompt-agent resource + publish/run deployment hooks + connection string projection. |
| src/Aspire.Hosting.Foundry/PromptAgent/AzureFunctionToolDefinition.cs | Tool resource for Azure Function tool definitions (queue bindings). |
| src/Aspire.Hosting.Foundry/PromptAgent/AzureAISearchToolResource.cs | Tool resource for Azure AI Search grounding via provisioned Foundry connection. |
| src/Aspire.Hosting.Foundry/Project/ProjectBuilderExtension.cs | Adjusts project provisioning outputs (notably the name output format). |
| src/Aspire.Hosting.Foundry/Project/ConnectionResource.cs | Adds connection properties type for Bing grounding connection category override. |
| src/Aspire.Hosting.Foundry/Project/ConnectionBuilderExtensions.cs | Updates connection outputs/sharing defaults and adds AI Search + Bing grounding connections. |
| src/Aspire.Hosting.Foundry/HostedAgent/HostedAgentConfiguration.cs | Migrates hosted-agent configuration to ProjectsAgentVersionCreationOptions SDK surface. |
| src/Aspire.Hosting.Foundry/HostedAgent/AzureHostedAgentResource.cs | Updates hosted-agent deployment path to the new AgentAdministrationClient API shape. |
| src/Aspire.Hosting.Foundry/Aspire.Hosting.Foundry.csproj | Adds additional warning suppressions needed for new preview/evaluation SDK types. |
| playground/FoundryPromptAgents/aspire.config.json | New playground configuration pointing to the prompt-agent AppHost. |
| playground/FoundryPromptAgents/PromptAgentChat/PromptAgentChat.csproj | New consumer service sample that calls prompt agents via Azure AI Projects/OpenAI APIs. |
| playground/FoundryPromptAgents/PromptAgentChat/Program.cs | Sample HTTP endpoints invoking prompt agents using Aspire-injected connection strings. |
| playground/FoundryPromptAgents/FoundryPromptAgents.AppHost/appsettings.Production.json | Playground AppHost production settings stub. |
| playground/FoundryPromptAgents/FoundryPromptAgents.AppHost/appsettings.Development.json | Playground AppHost dev settings for Azure provisioning. |
| playground/FoundryPromptAgents/FoundryPromptAgents.AppHost/Properties/launchSettings.json | Playground launch profiles for local AppHost runs. |
| playground/FoundryPromptAgents/FoundryPromptAgents.AppHost/FoundryPromptAgents.AppHost.csproj | New AppHost project wiring up Foundry prompt agents + tools + consumer project. |
| playground/FoundryPromptAgents/FoundryPromptAgents.AppHost/AppHost.cs | Full sample demonstrating prompt agents with Bing + AI Search + code interpreter tools. |
| Directory.Packages.props | Updates Azure AI Projects dependency versions and adds Azure.AI.Extensions.OpenAI. |
| Aspire.slnx | Adds the new FoundryPromptAgents playground projects to the solution. |
Comments suppressed due to low confidence (1)
playground/FoundryPromptAgents/FoundryPromptAgents.AppHost/appsettings.Development.json:9
- This playground
appsettings.Development.jsonincludes what appear to be real tenant/subscription identifiers and a specific resource group/location. Even if not secrets, committing real tenant/subscription details is typically treated as sensitive and can cause accidental billing/resource conflicts for others running the playground. Replace with placeholders (e.g.,{tenantId},{subscriptionId}) and/or move these values to user-secrets/documentation so the repo doesn’t contain personal/environment-specific Azure identifiers.
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
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.
Description
Adds support for Foundry Prompt Agents — declarative agents defined in the AppHost that are provisioned on Azure AI Foundry with configurable tools. Agents are deployed during both aspire run and aspire publish, and consumer services can invoke them via the Azure.AI.Projects SDK using standard Aspire connection strings.
AzurePromptAgentResource— resource representing a prompt agent (model + instructions + tools) that deploys to Foundry via the data-plane APIPromptAgentDeployer— lifecycle hook (IDistributedApplicationEventingSubscriber) that deploys agents duringaspire runafter Azure provisioning completesPromptAgentConfiguration— wrapsDeclarativeAgentDefinition/ProjectsAgentVersionCreationOptionsfrom the SDKAs documented in the README and in the playground sample comments, there is currently no way to deploy a Bing resource on Azure via bicep. Therefore, there is a manual step involved that we cannot avoid if using Bing Grounding Tool.
Running the playground project, the resources tools need will be provisioned on azure and configured on foundry. The prompt agents will be provisioned as well and will provide a link to the agent on Foundry and a quick action button to invoke them from the dashboard (like we do for Hosted Agents):

I've tested both
aspire runandaspire deploycommands.Fixes #16263
Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: