Use ML.NET to train, evaluate, or integrate machine-learning models into .NET applications with realistic data preparation, inference, and deployment expectations.
Microsoft Agent Framework
Build .NET AI agents and multi-agent workflows with Microsoft Agent Framework using the right agent type, threads, tools, workflows, hosting protocols, and enterprise guardrails.
Trigger On
- building or reviewing
.NETcode that usesMicrosoft.Agents.*,Microsoft.Extensions.AI,AIAgent,AgentThread,AgentSession, or Agent Framework hosting packages - choosing between
ChatClientAgent, Responses agents, hosted agents, custom agents, Anthropic agents, workflows, or durable agents - authoring preview-era
Microsoft.Agents.AI.Workflows.Declarative*packages or wrapping a workflow withworkflow.AsAIAgent() - adding tools, MCP, A2A, OpenAI-compatible hosting, AG-UI, DevUI, background responses, or OpenTelemetry
- migrating from Semantic Kernel agent APIs or aligning AutoGen-style multi-agent patterns to Agent Framework
- using Anthropic Claude models (haiku, sonnet, opus) via
AnthropicClientor through Azure Foundry withAnthropicFoundryClient
Workflow
- Decide whether the problem should stay deterministic. If plain code or a typed workflow without LLM autonomy is enough, do that instead of adding an agent.
- Choose the execution shape first: single
AIAgent, explicit programmaticWorkflow, workflow-as-agent wrapper, declarative workflow when YAML portability is explicitly required, Azure Functions durable agent, ASP.NET Core hosted agent, AG-UI remote UI, or DevUI local debugging. - Choose the agent type and provider intentionally. Prefer the simplest agent that satisfies the threading, tooling, and hosting requirements.
- Keep agents stateless and keep conversation or long-lived state in provider-owned session objects. Most persistence guidance still centers on
AgentThread, while newer middleware and background-response examples may surfaceAgentSession. Treat both as opaque provider-specific state. - Add only the tools and middleware that the scenario needs. Narrow the tool surface, require approval for side effects, and treat MCP, A2A, and third-party services as trust boundaries.
- For workflows, model executors, edges, request-response ports, checkpoints, shared state, and human-in-the-loop explicitly rather than hiding control flow in prompts.
- Prefer Responses-based protocols for new remote/OpenAI-compatible integrations unless you specifically need Chat Completions compatibility.
- Use durable agents only when you truly need Azure Functions serverless hosting, durable thread storage, or deterministic long-running orchestrations.
- Verify preview status, package maturity, docs recency, and provider-specific limitations before locking a production architecture.
Deliver
- a justified architecture choice: agent vs workflow vs durable orchestration
- the concrete .NET agent type, provider, and package set
- an explicit thread, tool, middleware, and observability strategy
- hosting and protocol decisions for OpenAI-compatible APIs, A2A, AG-UI, or Azure Functions
- migration notes when replacing Semantic Kernel agent APIs or AutoGen-style orchestration
Validate
- the scenario really needs agentic behavior and is not better served by deterministic code
- the selected agent type matches the provider, thread model, and tool model
AgentThreadorAgentSessionlifecycle, serialization, and compatibility boundaries are explicit for the chosen provider surface- tool approval, MCP headers, and third-party trust boundaries are handled safely
- workflows define checkpoints, request-response, shared state, and HITL paths deliberately
- DevUI is treated as a development sample, not a production surface
- docs or packages marked preview are called out, and Python-only docs are not mistaken for guaranteed .NET APIs
When a decision depends on exact wording, long-tail feature coverage, or a less-common integration, check the local official docs snapshot before relying on summaries.
References
- official-docs-index.md - Slim local Microsoft Learn snapshot map with direct links to every mirrored page, live-only support pages, and API-reference pointers
- patterns.md - Architecture routing, agent types, provider and thread model selection, and durable-agent guidance
- providers.md - Provider, SDK, endpoint, package, and Responses-vs-ChatCompletions selection
- tools.md - Function tools, hosted tools, tool approval, agent-as-tool, and service limitations
- sessions.md -
AgentThread, chat history storage, reducers, context providers, and thread serialization - middleware.md - Agent, function-calling, and
IChatClientmiddleware with guardrail patterns - workflows.md - Executors, edges, requests and responses, checkpoints, orchestrations, and declarative workflow notes
- mcp.md - MCP integration, agent-as-MCP, security rules, and MCP-vs-A2A guidance
- hosting.md - ASP.NET Core hosting, OpenAI-compatible APIs, A2A, AG-UI, Azure Functions, and Purview integration
- devui.md - DevUI capabilities, modes, auth, tracing, and safe usage boundaries
- migration.md - Semantic Kernel and AutoGen migration notes, concept mapping, and breaking-model shifts
- support.md - Preview status, official support channels, and recurring troubleshooting checks
- examples.md - Quick-start and tutorial recipe index covering the official docs set
Related skills
Build AI-enabled .NET applications with Semantic Kernel using services, plugins, prompts, and function-calling patterns that remain testable and maintainable.
Build or consume Model Context Protocol (MCP) servers and clients in .NET using the official MCP C# SDK, including stdio, Streamable HTTP, tools, prompts, resources, and…
Related agents
Microsoft Agent Framework Router
Microsoft Agent Framework routing agent for agent-vs-workflow decisions, agent types, AgentThread or AgentSession state, tools, workflows, hosting…
Also works: dotnet agents install agent-framework-router
.NET AI
AI-focused orchestration agent for Microsoft Agent Framework, Microsoft.Extensions.AI, Semantic Kernel, MCP, and ML.NET.
Also works: dotnet agents install ai