Use ML.NET to train, evaluate, or integrate machine-learning models into .NET applications with realistic data preparation, inference, and deployment expectations.
Microsoft.Extensions.AI
Build provider-agnostic .NET AI integrations with `Microsoft.Extensions.AI`, `IChatClient`, embeddings, middleware, structured output, vector search, and evaluation.
Trigger On
- building or reviewing
.NETcode that usesMicrosoft.Extensions.AI,Microsoft.Extensions.AI.Abstractions,IChatClient,IEmbeddingGenerator,ChatOptions, orAIFunction - adding
IImageGenerator, local-model chat via Ollama, AI app templates, or the.NET AIquickstarts for assistants and MCP - choosing between low-level AI abstractions, provider SDKs, vector-search composition, evaluation libraries, and a fuller agent framework
- adding streaming chat, structured output, embeddings, tool calling, telemetry, caching, or DI-based AI middleware
- wiring
Microsoft.Extensions.VectorData,Microsoft.Extensions.DataIngestion, MCP tooling, or evaluation packages around a provider-agnostic AI app
Workflow
- Classify the request first: plain model access, tool calling, embeddings/vector search, evaluation, image generation, local-model prototyping, MCP bootstrap, or true agent orchestration.
- Default to
Microsoft.Extensions.AIfor application and service code that needs provider-agnostic chat, embeddings, middleware, structured output, and testability. - Reference
Microsoft.Extensions.AI.Abstractionsdirectly only when authoring provider libraries or lower-level reusable integration packages. - Model
IChatClientandIEmbeddingGeneratorcomposition explicitly in DI. Keep options, caching, telemetry, logging, and tool invocation inspectable in the pipeline. - Treat chat state deliberately. For stateless providers, resend history. For stateful providers, propagate
ConversationIdrather than assuming all providers behave the same way. - Use
Microsoft.Extensions.VectorDataandMicrosoft.Extensions.DataIngestionas adjacent building blocks for RAG instead of hand-rolling store abstractions prematurely. Treat the embedding model, vector dimensions, and collection schema as one owned contract: changing any of them means reindexing rather than reusing old vector data. Indotnet/extensionsv10.5.0, update any named-argument usage ofVectorStoreVectorAttributefromDimensions:todimensions:; this is source-breaking only. - Treat the
.NET AIquickstarts as bootstrap paths, not finished architecture. They now cover minimal assistants, MCP client/server flows, local models, app templates, and image generation. Start there for a vertical slice, then harden the DI, telemetry, and evaluation story here. - Escalate to
microsoft-agent-frameworkwhen the requirement becomes agent threads, multi-agent orchestration, higher-order workflows, durable execution, or remote agent hosting. - Validate with real providers, realistic prompts, and evaluation gates so the abstraction layer actually buys portability and reliability.
Deliver
- a justified package and abstraction choice:
Abstractionsonly vs fullMicrosoft.Extensions.AI - a concrete
IChatClient/IEmbeddingGeneratorcomposition strategy - explicit tool-calling, options, state, caching, logging, and telemetry decisions
- vector-search, evaluation, or MCP integration guidance when the scenario needs it
- a clear escalation path to Agent Framework when the problem exceeds provider abstraction
Validate
- the abstraction layer solves a real portability, testability, or composition problem
- provider registration and middleware order stay explicit in DI
- chat state management matches whether the provider is stateless or stateful
- structured output, tool invocation, and embedding flows are typed and observable
- vector store, embedding model, and chunking strategy are consistent
- evaluation or safety gates exist for important prompts and agent-like behaviors
- agentic requirements are not being under-modeled as a simple
IChatClientintegration
When exact wording, edge-case API behavior, or less-common examples matter, check the local official docs snapshot before relying on summaries.
References
- official-docs-index.md - Slim local snapshot map with direct links to every mirrored
.NET AIdocs page plus API-reference pointers - patterns.md - Package choice,
IChatClient, embeddings, DI pipelines, tool-calling, and Agent Framework escalation guidance - examples.md - Quickstart-to-task map covering chat, structured output, function calling, vector search, local models, MCP, and assistants
- evaluation.md - Quality, NLP, safety, caching, reporting, and CI-oriented evaluation guidance
Related skills
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.
Build AI-enabled .NET applications with Semantic Kernel using services, plugins, prompts, and function-calling patterns that remain testable and maintainable.
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