Agent Framework: Agents vs Workflows & Getting Started | Microsoft Learn
- Microsoft has unveiled the Agent Framework, a new open-source development kit designed to simplify the creation of AI agents and multi-agent workflows for both .NET and Python environments.
- The framework offers two primary categories of capabilities: individual Agents and Workflows.
- According to Microsoft, the Agent Framework provides foundational building blocks including model clients for handling LLM interactions, agent sessions for state management, context providers for agent memory, middleware...
Microsoft has unveiled the Agent Framework, a new open-source development kit designed to simplify the creation of AI agents and multi-agent workflows for both .NET and Python environments. Building on the foundations laid by Semantic Kernel and AutoGen, the Agent Framework aims to provide a more robust and enterprise-ready platform for developers looking to integrate AI into their applications.
The framework offers two primary categories of capabilities: individual Agents and Workflows. Agents, powered by Large Language Models (LLMs) such as those from Azure OpenAI, OpenAI, Anthropic, and Ollama, are designed to process inputs, utilize tools, and generate responses. Workflows, provide a graph-based approach to orchestrating complex tasks involving multiple agents and functions, offering type-safe routing, checkpointing, and human-in-the-loop integration.
According to Microsoft, the Agent Framework provides foundational building blocks including model clients for handling LLM interactions, agent sessions for state management, context providers for agent memory, middleware for intercepting and modifying agent actions, and MCP clients for tool integration. These components are intended to give developers the flexibility and power to build interactive, robust, and secure AI applications.
Agents vs. Workflows: Choosing the Right Approach
Microsoft distinguishes between agents and workflows based on the nature of the task. Agents are best suited for open-ended or conversational tasks where autonomous tool use and planning are required. They excel when a single LLM call (potentially with tool assistance) is sufficient. Workflows, conversely, are ideal for processes with well-defined steps, requiring explicit control over execution order, and coordination between multiple agents or functions. The guidance is clear: “If you can write a function to handle the task, do so instead of using an AI agent.”
A Successor to Semantic Kernel and AutoGen
The Agent Framework isn’t a completely new undertaking. Microsoft positions it as the direct successor to both Semantic Kernel and AutoGen, inheriting strengths from both projects. AutoGen contributed the simplicity of agent abstractions, while Semantic Kernel provided enterprise-level features like session-based state management, type safety, middleware, and extensive model and embedding support. The new framework combines these elements and adds graph-based workflows for explicit multi-agent orchestration.
For developers already invested in Semantic Kernel or AutoGen, Microsoft provides migration guides to facilitate a transition to the Agent Framework. The company emphasizes that the Agent Framework builds upon the concepts pioneered by these earlier projects, offering a more comprehensive and integrated solution.
Technical Implementation: .NET and Python
The Agent Framework supports both .NET and Python, offering consistent APIs across both implementations. Here’s a basic example of how to get started in each language:
dotnet add package Azure.AI.OpenAI --prerelease dotnet add package Azure.Identity dotnet add package Microsoft.Agents.AI.OpenAI --prerelease
using System; using Azure.AI.OpenAI; using Azure.Identity; using Microsoft.Agents.AI; AIAgent agent = new AzureOpenAIClient( new Uri(Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!), new AzureCliCredential()) .GetChatClient("gpt-4o-mini") .AsAIAgent(instructions: "You are a friendly assistant. Keep your answers brief."); Console.WriteLine(await agent.RunAsync("What is the largest city in France?"));
pip install agent-framework --pre
credential = AzureCliCredential() client = AzureOpenAIResponsesClient( project_endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"], deployment_name=os.environ["AZURE_OPENAI_RESPONSES_DEPLOYMENT_NAME"], credential=credential, ) agent = client.as_agent( name="HelloAgent", instructions="You are a friendly assistant. Keep your answers brief.", )
# Non-streaming: get the complete response at once result = await agent.run("What is the largest city in France?") print(f"Agent: {result}")
These examples demonstrate the basic process of creating an agent, providing instructions, and executing a simple query. From this starting point, developers can integrate tools, implement multi-turn conversations, and leverage middleware and workflows to build more sophisticated applications.
Key Features and Observability
Beyond the core agent and workflow capabilities, the Agent Framework emphasizes observability. Built-in OpenTelemetry integration enables distributed tracing, monitoring, and debugging, crucial for understanding and optimizing complex AI-powered systems. The framework also highlights graph-based workflows with features like streaming, checkpointing, and human-in-the-loop capabilities.
The Agent Framework is currently in public preview. Microsoft encourages users to provide feedback and report issues through the GitHub repository. Users should be aware that, as a preview release, the framework is subject to change and may not be suitable for production environments without careful evaluation.
Microsoft also includes a disclaimer regarding the use of third-party servers and agents, advising users to carefully review data sharing practices and understand the implications for data location and compliance.
