-
-
Notifications
You must be signed in to change notification settings - Fork 14
MicrosoftFoundry
Rasmus Wulff Jensen edited this page Jul 17, 2026
·
2 revisions
- AgentFactory (
MicrosoftFoundryAgentFactory) - Declarative agent creation and management (
MicrosoftFoundryDeclarativeAgentFactory) - AIToolsFactory integration (tools in
AgentOptions.Tools) - ChatClient and Responses API support
- Azure RBAC authentication
dotnet add package AgentFrameworkToolkit.MicrosoftFoundry
MicrosoftFoundryAgentFactory agentFactory = new("<projectEndpoint>", new AzureCliCredential());
MicrosoftFoundryAgent agent = agentFactory.CreateAgent(new AgentOptions
{
Model = "gpt-5",
Instructions = "You are a nice AI"
});
AgentResponse response = await agent.RunAsync("Hello World");
Console.WriteLine(response);Declarative agents persist in the Microsoft Foundry project. Creating an agent with an existing name and a changed definition creates a new version.
MicrosoftFoundryAgentFactory agentFactory = new("<projectEndpoint>", new AzureCliCredential());
MicrosoftFoundryDeclarativeAgentFactory declarativeFactory = agentFactory.DeclarativeAgentFactory;
MicrosoftFoundryAgent agent = declarativeFactory.CreateAgent(new DeclarativeAgentOptions
{
Name = "my-agent",
Model = "gpt-5-nano",
Instructions = "You are a concise assistant.",
Tools = [],
McpTools = [],
WebSearchTool = false,
CodeInterpreterTool = false
});
AgentResponse response = await agent.RunAsync("Hello World");The declarative factory can also retrieve agents and versions with GetAgent, GetAgents, and GetAgentVersions, or remove an agent with DeleteAgent.
-
Endpoint(required Microsoft Foundry project endpoint) -
AuthenticationTokenProvider(optional, defaults toDefaultAzureCredential) NetworkTimeout-
DefaultClientType(Responses API by default) AdditionalProjectClientOptions
builder.Services.AddMicrosoftFoundryAgentFactory("<projectEndpoint>", new AzureCliCredential());
builder.Services.AddMicrosoftFoundryAgentFactory(new MicrosoftFoundryConnection
{
Endpoint = "<projectEndpoint>",
AuthenticationTokenProvider = new AzureCliCredential()
});-
MicrosoftFoundryAgentFactorycreates model-backed agents without persisting an agent definition. - Declarative agents persist in the Foundry project; delete temporary agents when they are no longer needed.
- See AgentFactories for shared agent options and middleware.
- See AIToolsFactory for tool creation and MCP support.