Microsoft Agent Framework
Open-source, multi-language SDK for AI agents and graph-based workflows — the direct
successor to both Semantic Kernel and AutoGen, built by the same teams. AutoGen's simple
agent abstractions + SK's enterprise features (sessions, type safety, middleware,
telemetry), plus typed workflows. Docs: https://learn.microsoft.com/agent-framework/overview/
· Repo: github.com/microsoft/agent-framework (Go: agent-framework-go).
Status (mid-2026): C#/.NET core is stable v1.x; Python is primary alongside it. Many
provider/integration packages are still preview (Mem0/Redis/Neo4j providers, AG-UI, Dev UI).
Go is public preview. Check package status before promising GA to a user.
Packages
| Language |
Install |
| .NET |
Microsoft.Agents.AI (core), .Abstractions, .OpenAI, .Foundry, .A2A (NuGet) |
| Python |
pip install agent-framework (meta) → agent-framework-core + providers: agent-framework-foundry, agent-framework-openai, agent-framework-copilotstudio, agent-framework-mem0, agent-framework-foundry-hosting |
| Go |
go get github.com/microsoft/agent-framework-go (preview) |
Python imports come from agent_framework (e.g. from agent_framework.foundry import FoundryChatClient).
Core abstractions
- .NET:
AIAgent (base), ChatClientAgent (wraps any Microsoft.Extensions.AI.IChatClient),
AgentSession for multi-turn state, RunAsync / RunAsync<T> (structured output →
AgentResponse<T>).
- Python:
Agent, BaseAgent, SupportsAgentRun, AgentSession, @tool decorator.
- Special agents:
CopilotStudioAgent (call a Copilot Studio agent from code),
A2AAgent (remote agent over the A2A protocol).
- Three pillars: Agents (single agent loop), Harness (opinionated long-task agent:
planning/todo tracking, context compaction, file access/memory, don't-ask-again tool
approval), Workflows (typed graphs).
from agent_framework import Agent
from agent_framework.foundry import FoundryChatClient
from azure.identity import AzureCliCredential
agent = Agent(
client=FoundryChatClient(credential=AzureCliCredential()),
instructions="You are a helpful assistant",
)
result = await agent.run("Help me with this task")
using Azure.AI.Projects;
using Azure.Identity;
using Microsoft.Agents.AI;
AIAgent agent = new AIProjectClient(new Uri("<project-endpoint>"), new DefaultAzureCredential())
.AsAIAgent(model: "gpt-4o-mini", name: "Joker", instructions: "You are good at telling jokes.");
AgentSession session = await agent.CreateSessionAsync();
Console.WriteLine(await agent.RunAsync("Tell me a joke.", session));
Workflows and orchestration
Typed graphs of executors connected by edges (direct, conditional, switch-case,
fan-out, fan-in), with checkpointing and human-in-the-loop pauses. High-level builders in
agent_framework.orchestrations / the .NET equivalents:
| Pattern |
Builder |
Use when |
| Sequential |
SequentialBuilder |
Pipeline: research → write → review |
| Concurrent |
fan-out/fan-in edges |
Independent subtasks in parallel |
| Handoff |
HandoffBuilder |
Triage agent routes to specialists |
| Group Chat |
GroupChatBuilder |
Agents debate/collaborate on shared thread |
| Magentic |
Magentic orchestration |
Manager dynamically plans and coordinates specialists |
A workflow can itself be exposed as an agent: workflow.as_agent(name="Content Pipeline Agent").
from agent_framework.orchestrations import SequentialBuilder
workflow = SequentialBuilder(participants=[researcher, writer, reviewer]).build()
Middleware, memory, tools
- Middleware (function- or class-based) intercepts agent actions — logging, guardrails,
caching, tool-call gating. Prefer middleware over prompt hacks for policy enforcement.
- Memory: context providers (chat-history memory is released; Mem0/Redis/Neo4j are
preview) and chat-history providers (Cosmos DB, Redis) for persistence.
- Tools: native functions (
@tool / AIFunctionFactory), plus MCP clients —
MCPStreamableHTTPTool, MCPStdioTool, MCPWebsocketTool — and hosted MCP via
get_mcp_tool(...) on Foundry/OpenAI/Anthropic chat clients.
Observability
OpenTelemetry per the GenAI semantic conventions — configure_otel_providers() in Python;
exports to Azure Monitor or the Aspire Dashboard. MCP trace context propagates automatically
via _meta. Instrument from day one; agent bugs are trace-shaped.
Practices
- Wrap any
IChatClient-compatible model — the framework is provider-agnostic; don't hard-code
a single vendor path when the user needs flexibility.
- Use
AgentSession for multi-turn state instead of hand-rolled history lists.
- Structured outputs via
RunAsync<T> beat string parsing for machine-consumed results.
- Migrating from Semantic Kernel or AutoGen? Agent Framework is the successor — map SK
planners/agents and AutoGen group chats onto the orchestration builders above
(see
/msagent-migrate).
- Deploy targets: self-host (any ASP.NET/ASGI app), inside the M365 Agents SDK for
channel reach (
skills/m365-agents-sdk), or as a Foundry hosted agent
(agent-framework-foundry-hosting, ResponsesHostServer — see skills/microsoft-foundry).
1---2name: agent-framework3description: Build agents and multi-agent workflows with Microsoft Agent Framework — the open-source successor to Semantic Kernel and AutoGen. Covers agents, sessions, tools, orchestration patterns, middleware, memory, MCP, and observability in C#, Python, and Go.4---56# Microsoft Agent Framework78Open-source, multi-language SDK for AI agents and graph-based workflows — the **direct9successor to both Semantic Kernel and AutoGen**, built by the same teams. AutoGen's simple10agent abstractions + SK's enterprise features (sessions, type safety, middleware,11telemetry), plus typed workflows. Docs: https://learn.microsoft.com/agent-framework/overview/12· Repo: github.com/microsoft/agent-framework (Go: agent-framework-go).1314**Status (mid-2026):** C#/.NET core is stable v1.x; Python is primary alongside it. Many15provider/integration packages are still preview (Mem0/Redis/Neo4j providers, AG-UI, Dev UI).16Go is public preview. Check package status before promising GA to a user.1718## Packages1920| Language | Install |21|---|---|22| .NET | `Microsoft.Agents.AI` (core), `.Abstractions`, `.OpenAI`, `.Foundry`, `.A2A` (NuGet) |23| Python | `pip install agent-framework` (meta) → `agent-framework-core` + providers: `agent-framework-foundry`, `agent-framework-openai`, `agent-framework-copilotstudio`, `agent-framework-mem0`, `agent-framework-foundry-hosting` |24| Go | `go get github.com/microsoft/agent-framework-go` (preview) |2526Python imports come from `agent_framework` (e.g. `from agent_framework.foundry import FoundryChatClient`).2728## Core abstractions2930- **.NET:** `AIAgent` (base), `ChatClientAgent` (wraps any `Microsoft.Extensions.AI.IChatClient`),31 `AgentSession` for multi-turn state, `RunAsync` / `RunAsync<T>` (structured output →32 `AgentResponse<T>`).33- **Python:** `Agent`, `BaseAgent`, `SupportsAgentRun`, `AgentSession`, `@tool` decorator.34- **Special agents:** `CopilotStudioAgent` (call a Copilot Studio agent from code),35 `A2AAgent` (remote agent over the A2A protocol).36- **Three pillars:** *Agents* (single agent loop), *Harness* (opinionated long-task agent:37 planning/todo tracking, context compaction, file access/memory, don't-ask-again tool38 approval), *Workflows* (typed graphs).3940```python41from agent_framework import Agent42from agent_framework.foundry import FoundryChatClient43from azure.identity import AzureCliCredential4445agent = Agent(46 client=FoundryChatClient(credential=AzureCliCredential()),47 instructions="You are a helpful assistant",48)49result = await agent.run("Help me with this task")50```5152```csharp53using Azure.AI.Projects;54using Azure.Identity;55using Microsoft.Agents.AI;5657AIAgent agent = new AIProjectClient(new Uri("<project-endpoint>"), new DefaultAzureCredential())58 .AsAIAgent(model: "gpt-4o-mini", name: "Joker", instructions: "You are good at telling jokes.");59AgentSession session = await agent.CreateSessionAsync();60Console.WriteLine(await agent.RunAsync("Tell me a joke.", session));61```6263## Workflows and orchestration6465Typed graphs of **executors** connected by **edges** (direct, conditional, switch-case,66fan-out, fan-in), with checkpointing and human-in-the-loop pauses. High-level builders in67`agent_framework.orchestrations` / the .NET equivalents:6869| Pattern | Builder | Use when |70|---|---|---|71| Sequential | `SequentialBuilder` | Pipeline: research → write → review |72| Concurrent | fan-out/fan-in edges | Independent subtasks in parallel |73| Handoff | `HandoffBuilder` | Triage agent routes to specialists |74| Group Chat | `GroupChatBuilder` | Agents debate/collaborate on shared thread |75| Magentic | Magentic orchestration | Manager dynamically plans and coordinates specialists |7677A workflow can itself be exposed as an agent: `workflow.as_agent(name="Content Pipeline Agent")`.7879```python80from agent_framework.orchestrations import SequentialBuilder81workflow = SequentialBuilder(participants=[researcher, writer, reviewer]).build()82```8384## Middleware, memory, tools8586- **Middleware** (function- or class-based) intercepts agent actions — logging, guardrails,87 caching, tool-call gating. Prefer middleware over prompt hacks for policy enforcement.88- **Memory:** context providers (chat-history memory is released; Mem0/Redis/Neo4j are89 preview) and chat-history providers (Cosmos DB, Redis) for persistence.90- **Tools:** native functions (`@tool` / `AIFunctionFactory`), plus **MCP** clients —91 `MCPStreamableHTTPTool`, `MCPStdioTool`, `MCPWebsocketTool` — and hosted MCP via92 `get_mcp_tool(...)` on Foundry/OpenAI/Anthropic chat clients.9394## Observability9596OpenTelemetry per the GenAI semantic conventions — `configure_otel_providers()` in Python;97exports to Azure Monitor or the Aspire Dashboard. MCP trace context propagates automatically98via `_meta`. Instrument from day one; agent bugs are trace-shaped.99100## Practices101102- Wrap any `IChatClient`-compatible model — the framework is provider-agnostic; don't hard-code103 a single vendor path when the user needs flexibility.104- Use `AgentSession` for multi-turn state instead of hand-rolled history lists.105- Structured outputs via `RunAsync<T>` beat string parsing for machine-consumed results.106- Migrating from Semantic Kernel or AutoGen? Agent Framework is the successor — map SK107 planners/agents and AutoGen group chats onto the orchestration builders above108 (see `/msagent-migrate`).109- Deploy targets: self-host (any ASP.NET/ASGI app), inside the **M365 Agents SDK** for110 channel reach (`skills/m365-agents-sdk`), or as a **Foundry hosted agent**111 (`agent-framework-foundry-hosting`, `ResponsesHostServer` — see `skills/microsoft-foundry`).