How microsoft/agents-for-net works
Project Type & Purpose
• This is a multi-package .NET SDK (not a single executable) designed to help developers build enterprise-grade “agents” (bots/workflows) that run on M365, Teams, Copilot Studio, Webchat, and third-party channels.
• It delivers a layered set of NuGet libraries (core, auth, builder, client, hosting, storage, extensions) plus samples and tests.
High-Level Layers & Main Components
● Core Foundation
– Microsoft.Agents.Core & Microsoft.Agents.Core.Analyzers
· Models (Activity, Card, Conversation, etc.)
· Serialization & converters (ProtocolJsonSerializer, source generators)
· Telemetry & validation
● Authentication
– Microsoft.Agents.Authentication (interfaces, connection settings)
– Microsoft.Agents.Authentication.Msal (MSAL provider, HTTP client factory)
● Builder & Dialog Engine
– Microsoft.Agents.Builder (agent host, middleware pipeline, state management)
– Microsoft.Agents.Builder.Dialogs (DialogContainer, Prompts, WaterfallDialog)
● Client & Connector
– Microsoft.Agents.Client (IAgentClient, streaming responses)
– Microsoft.Agents.Connector (REST clients for conversations, attachments, tokens)
– Microsoft.Agents.CopilotStudio.Client (Copilot Studio API wrapper)
● Hosting Adapters
– Microsoft.Agents.Hosting.AspNetCore (ASP.NET Core adapter, controllers, background queue)
– Microsoft.Agents.Hosting.A2A (agent-to-agent JSON-RPC protocol adapter)
● Storage & Transcript
– Microsoft.Agents.Storage (IStorage abstractions)
· MemoryStorage
· Blob storage (Azure Blob)
· Cosmos DB partitioned storage
– Microsoft.Agents.Storage.Transcript (ITranscriptStore, file & blob transcript stores)
● Channel & AI Extensions
– Microsoft.Agents.Extensions.SharePoint
– Microsoft.Agents.Extensions.Teams
– Microsoft.Agents.Extensions.Teams.AI (LLM clients, tools & planner modules)
Relationships & Interactions
• Layered dependency:
Samples → Extensions/Hosting → Client/Connector → Builder/Dialog → Auth → Core
• Storage modules plug into Builder via DI (IStorage, ITranscriptStore).
• Hosting adapters (AspNetCore/A2A) receive incoming HTTP or JSON-RPC, call into Builder.
• Builder uses Auth to acquire tokens, then uses Connector/Client to call external channels or Copilot Studio.
• Extensions augment the Builder pipeline to handle channel-specific events (Teams messages, SharePoint actions) or AI workflows.
Architectural Patterns & Principles
• Layered architecture (Core → Auth → Builder → Client → Hosting/Extensions)
• Dependency injection (IServiceCollection extensions in every module)
• Adapter pattern (IChannelAdapter implementations for Webchat, Teams, A2A)
• Middleware pipeline for cross-cutting concerns (logging, error handling, header propagation)
• Source generators for high-performance serialization (analyzers)
• Package-per-component monorepo with shared Directory.Build.props & global.json
Technologies & External Services
• .NET 7 (global.json)
• Azure AD / MSAL for authentication
• Azure Blob & Cosmos DB for storage
• Microsoft Graph / Teams API / SharePoint REST
• Azure OpenAI & Azure Content Safety
• JSON-RPC for A2A
• NuGet for package distribution