{"id":40855,"date":"2025-04-07T06:00:00","date_gmt":"2025-04-07T00:30:00","guid":{"rendered":"https:\/\/debuggercafe.com\/?p=40855"},"modified":"2025-02-20T06:31:37","modified_gmt":"2025-02-20T01:01:37","slug":"microsoft-autogen","status":"publish","type":"post","link":"https:\/\/debuggercafe.com\/microsoft-autogen\/","title":{"rendered":"Microsoft Autogen &#8211; An Introduction"},"content":{"rendered":"\n<p><strong><em>What is Microsoft Autogen?<\/em><\/strong> Microsoft Autogen is a framework for creating agentic AI applications that can work with humans. These can be single or multi-agent AI applications powered by LLMs. <\/p>\n\n\n\n<p>In this article, we will cover the most important aspects of getting started with Microsoft Autogen. Although, the framework contains detailed documentation and sample code, the default LLM used in the docs is powered by OpenAI API. Furthermore, the code given is meant to be run in Jupyter Notebooks (nothing wrong with that). So, we will tackle two primary issues here: Cover the most important aspects of getting up and running with Microsoft Autogen in Python scripts (yes, there is a slight change compared to running on Jupyter Notebooks) along with using Claude models from Anthropic API.<\/p>\n\n\n\n<div class=\"wp-block-buttons is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-499968f5 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button is-style-outline is-style-outline--1\"><a class=\"wp-block-button__link has-black-color has-luminous-vivid-orange-background-color has-text-color has-background wp-element-button\" href=\"#download-code\"><strong>Jump to Download Code<\/strong><\/a><\/div>\n<\/div>\n\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/microsoft-autogen-teams-chat.gif\" target=\"_blank\" rel=\" noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"600\" src=\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/microsoft-autogen-teams-chat.gif\" alt=\"A team of agents chatting with each other using Microsoft Autogen.\" class=\"wp-image-40935\"\/><\/a><figcaption class=\"wp-element-caption\">Figure 1. A team of agents chatting with each other using Microsoft Autogen.<\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><em>What will we cover in this Microsoft Autogen introductory article?<\/em><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>How do we set up Microsoft Autogen locally?<\/li>\n\n\n\n<li>How to use Claude Models with Anthropic API key for:\n<ul class=\"wp-block-list\">\n<li>Simple model chat.<\/li>\n\n\n\n<li>Creating a single agent.<\/li>\n\n\n\n<li>Creating teams of multiple agents and terminating &amp; resuming their workflow.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p>This article will be the fastest way to start with Microsoft Autogen with an API key other than OpenAI and in Python scripts.<\/p>\n\n\n\n<p><strong><em>What will this article not cover? <\/em><\/strong><em>Creating a useful agent. That&#8217;s for future articles, we will create many agents that can be used for serious stuff, but not in this article.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Microsoft Autogen<\/h2>\n\n\n\n<p><strong><a href=\"https:\/\/github.com\/microsoft\/autogen\" target=\"_blank\" rel=\"noreferrer noopener\">Microsoft Autogen<\/a><\/strong> is a framework for building autonomous agents.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/microsoft-autogen-logo.jpeg\" target=\"_blank\" rel=\" noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1080\" height=\"1080\" src=\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/microsoft-autogen-logo.jpeg\" alt=\"Microsoft Autogen logo.\" class=\"wp-image-40938\" srcset=\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/microsoft-autogen-logo.jpeg 1080w, https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/microsoft-autogen-logo-300x300.jpeg 300w, https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/microsoft-autogen-logo-150x150.jpeg 150w, https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/microsoft-autogen-logo-768x768.jpeg 768w\" sizes=\"auto, (max-width: 1080px) 100vw, 1080px\" \/><\/a><figcaption class=\"wp-element-caption\">Figure 2. Microsoft Autogen logo (soruce: https:\/\/github.com\/microsoft\/autogen?tab=readme-ov-file).<\/figcaption><\/figure>\n<\/div>\n\n\n<p>The GitHub repository states the following: the framework is for building agents that can work alongside humans.<\/p>\n\n\n\n<p>However, creating useful agents is not a simple task, even with well-defined frameworks such as Microsoft Autogen.<\/p>\n\n\n\n<p>If you explore the framework, you can right away feel that the developers are creating mature agentic-AI framework. But making it work, creating useful agents using it, that&#8217;s the hard part.<\/p>\n\n\n\n<p>Even as we start covering the basics in this article, we will get a feeling that the process of creating agents requires a lot of thoughtful coding and &#8220;control&#8221;. To make these agents &#8220;autonomous&#8221; we have to define constraints and &#8220;rules&#8221; of how they should act and behave. From the outset, this is counter-intuitive. Because we are creating something that is autonomous by defining rules. <\/p>\n\n\n\n<p>Nonetheless, whether AI agents take off or not (most probably they will, maybe not in the current format as we define them now), learning these basics will never hurt.<\/p>\n\n\n\n<p><strong>Spoiler<\/strong>: <em>Building AI agents feels more like software engineering code with API calls unless you are trying to work with local LLMs.<\/em><\/p>\n\n\n\n<p>In case you are interested in a more basic and simpler library, the <strong><a href=\"https:\/\/debuggercafe.com\/smolagents\/\" target=\"_blank\" rel=\"noreferrer noopener\">Hugging Face Smolagents<\/a><\/strong> can be a great starting point.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Setting Up Autogen<\/h2>\n\n\n\n<p>Let&#8217;s install all the libraries needed to work with the Autogen framework, there are quite a few.<\/p>\n\n\n\n<p>You can also install these libraries using the requirements file after downloading the zip file that comes with the article.<\/p>\n\n\n\n<p><strong>For agentic chat completions<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pip install autogen-agentchat<\/pre>\n\n\n\n<p><strong>To connect with OpenAI chat APIs<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pip install autogen-ext[openai]\npip install openai<\/pre>\n\n\n\n<p><strong>To connect to Anthropic Chat APIs<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pip install autogen-ext[semantic-kernel-anthropic]\npip install anthropic<\/pre>\n\n\n\n<p>By default, all the documentation and code work seamlessly with OpenAI APIs. For other API providers such as Anthropic, Autogen provides Semantic Kernels which requires slightly more code to set up. We will go the Anthropic route here as that&#8217;s more nuanced compared to the OpenAI one which is easily found in the docs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Directory Structure<\/h2>\n\n\n\n<p>The following is the directory structure.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u251c\u2500\u2500 assistant_agent.py\n\u251c\u2500\u2500 requirements.txt\n\u251c\u2500\u2500 teams_chat.py\n\u251c\u2500\u2500 teams_resume.py\n\u251c\u2500\u2500 teams_stopping.py\n\u2514\u2500\u2500 chat_completion.py<\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>We have several Python files, the details of which we will tackle in the coding section.<\/li>\n\n\n\n<li>The <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">requirements.txt<\/code> file contains all the requirements that we covered above. You can install them using <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">pip install requirements.txt<\/code>.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading has-text-align-center\" id=\"download-code\">Download Code<\/h3>\n\n\n\n<div class=\"wp-block-button is-style-outline center\"><a data-sumome-listbuilder-id=\"11dc54bb-57e1-44f7-b36c-bafc5ee79e33\" class=\"wp-block-button__link has-black-color has-luminous-vivid-orange-background-color has-text-color has-background\"><b>Download the Source Code for this Tutorial<\/b><\/a><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Final Setup<\/h3>\n\n\n\n<p>One final setup before moving ahead. We need an Anthropic API key and some credits to follow through this article.<\/p>\n\n\n\n<p>You can generate an API key from the <a href=\"https:\/\/console.anthropic.com\/settings\/keys\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Anthropic dashboard<\/strong><\/a>.<\/p>\n\n\n\n<p>Finally, in the project directory, create a <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">.env<\/code> file and add the following:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">CLAUDE_API_KEY=YOUR_API_KEY<\/pre>\n\n\n\n<p>Replace <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">YOUR_API_KEY<\/code> with the API key you just generated.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting Started with Microsoft Autogen<\/h2>\n\n\n\n<p>Most of the code here has been adapted from the <a href=\"https:\/\/microsoft.github.io\/autogen\/stable\/user-guide\/agentchat-user-guide\/tutorial\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Autogen tutorials<\/strong><\/a> with simple changes such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using Anthropic API instead of OpenAI.<\/li>\n\n\n\n<li>Catering to Python scripts instead of Jupyter Notebooks.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p>In this article, we will cover some of the most basic components of Microsoft Autogen.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Chat Completion using Autogen<\/h3>\n\n\n\n<p>We will start with the most basic component, chat completion. <em>How do we make an API call using Microsoft Autogen for chat completion?<\/em><\/p>\n\n\n\n<p>The <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">chat_completion.py<\/code> file contains the code for this.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import os\nimport asyncio\n\nfrom dotenv import load_dotenv\nfrom autogen_core.models import UserMessage\nfrom autogen_ext.models.semantic_kernel import SKChatCompletionAdapter\nfrom semantic_kernel import Kernel\nfrom semantic_kernel.connectors.ai.anthropic import AnthropicChatCompletion, AnthropicChatPromptExecutionSettings\nfrom semantic_kernel.memory.null_memory import NullMemory\n\nload_dotenv()\n\nsk_client = AnthropicChatCompletion(\n    ai_model_id=\"claude-3-5-haiku-20241022\",\n    api_key=os.getenv('CLAUDE_API_KEY'),\n    service_id=\"my-service-id\",\n)\nsettings = AnthropicChatPromptExecutionSettings(\n    temperature=0.2,\n)\n\nanthropic_model_client = SKChatCompletionAdapter(\n    sk_client, kernel=Kernel(memory=NullMemory()), prompt_settings=settings\n)\n\nasync def call_llm():\n    # Call the model directly.\n    model_result = await anthropic_model_client.create(\n        messages=[UserMessage(content=\"What is the capital of France?\", source=\"User\")]\n    )\n    print(model_result)\n\nasyncio.run(call_llm())<\/pre>\n\n\n\n<p>Before jumping into the code, let&#8217;s answer <em><strong>what semantic kernel is?<\/strong><\/em><\/p>\n\n\n\n<p><em><strong><a href=\"https:\/\/pypi.org\/project\/semantic-kernel\/\" target=\"_blank\" rel=\"noreferrer noopener\">Semantic Kernel (SK)<\/a><\/strong> is a lightweight SDK that allows us to connect LLMs from different providers with the software we are building in any programming language. It allows plugins in different languages such as Python, C#, and Java to integrate language models from providers like OpenAI, Azure, Anthropic, and Hugging Face. Semantic Kernel is also a part of Autogen Extensions (<code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">autogen_ext<\/code>) allowing us to seamlessly connect LLMs with our programs.<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Important Imports<\/h4>\n\n\n\n<p>Here are some of the important imports from the above:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">UserMessage<\/code>: This allows us to provide messages as end users to LLMs for chat completion.<\/li>\n\n\n\n<li><code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">SKChatCompletionAdapter<\/code>: This is an adapter allowing us to use model clients from Semantic Kernel and integrate them seamlessly with our applications.<\/li>\n\n\n\n<li><code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">AnthropicChatCompletion<\/code>, <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">AnthropicChatPromptExecutionSettings<\/code>: The former is for initializing the model that we want to use and the latter is for providing the settings.<\/li>\n\n\n\n<li><code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">NullMemory<\/code>: Each text is usually associated with a memory. However, if not, then we pass the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">NullMemory<\/code> class.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Loading the Model Client<\/h4>\n\n\n\n<p>From <strong>lines 13 to 20<\/strong> we initialize the Claude Haiku model and set the temperature. You can experiment with other models as well. However, this is the cheapest model from the latest Claude 3.5 family of models.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Chat Completion Client<\/h4>\n\n\n\n<p>Then we initialize the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">SKChatCompletionAdapter<\/code> client for chat completion. We provide the model client instance and settings along with the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">NullMemory<\/code> as Semantic Kernel instance.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Making An Async Call <\/h4>\n\n\n\n<p>Finally, we define an <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">async<\/code> function called <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">call_llm<\/code> which awaits the result from the LLM provider before printing the result. As we are running this is a script, the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">async<\/code> function and <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">asyncio.run<\/code> call is mandatory to make it work.<\/p>\n\n\n\n<p>We can execute the code and get the output.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">python chat_completion.py<\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">finish_reason='stop' content='The capital of France is Paris.' usage=RequestUsage(prompt_tokens=0, completion_tokens=0) cached=False logprobs=None thought=None<\/pre>\n\n\n\n<p>The final result contains the content (response) from the LLM, the reason for stopping the response, and other information about the tokens and logprobs.<\/p>\n\n\n\n<p>This is the general workflow that we will use for initializing the Claude model in rest of the examples as well.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">A Dummy Tool Use Assistant<\/h3>\n\n\n\n<p>Although we will not be creating any real assistants in this article, it is still good to know how to create a dummy tool use assistant. This assistant will simply call a function that returns a string without doing any complex operations.<\/p>\n\n\n\n<p>The code for this is present in <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">assistant_agent.py<\/code> file.<\/p>\n\n\n\n<p>The following code block includes the import statements, initializes the Claude model client, and defines a dummy web search tool.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"assistant_agent.py\" data-enlighter-group=\"assistant_agent_1\">import os\nimport asyncio\n\nfrom dotenv import load_dotenv\nfrom autogen_agentchat.agents import AssistantAgent\nfrom autogen_core.models import ModelFamily\nfrom autogen_ext.models.semantic_kernel import SKChatCompletionAdapter\nfrom semantic_kernel import Kernel\nfrom semantic_kernel.connectors.ai.anthropic import AnthropicChatCompletion, AnthropicChatPromptExecutionSettings\nfrom semantic_kernel.memory.null_memory import NullMemory\nfrom autogen_core import CancellationToken\nfrom autogen_agentchat.messages import TextMessage\n\nload_dotenv()\n\n# Define a tool that searches the web for information.\nasync def web_search(query: str) -> str:\n    \"\"\"Find information on the web\"\"\"\n    return \"AutoGen is a programming framework for building multi-agent applications.\"\n\nsk_client = AnthropicChatCompletion(\n    ai_model_id=\"claude-3-5-haiku-20241022\",\n    api_key=os.getenv('CLAUDE_API_KEY'),\n    service_id=\"my-service-id\",\n)\nsettings = AnthropicChatPromptExecutionSettings(\n    temperature=0.2,\n)\n\nanthropic_model_client = SKChatCompletionAdapter(\n    sk_client, \n    kernel=Kernel(memory=NullMemory()), \n    prompt_settings=settings,\n    model_info={\n        \"function_calling\": True,\n        \"json_output\": True,\n        \"vision\": True,\n        \"family\": ModelFamily.CLAUDE_3_5_SONNET,\n    },\n)\n\nagent = AssistantAgent(\n    name=\"assistant\",\n    model_client=anthropic_model_client,\n    tools=[web_search],\n    system_message=\"Use tools to solve tasks.\",\n)<\/pre>\n\n\n\n<p>Let&#8217;s go through the above code block:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">web_search<\/code> function accepts a query as a parameter. However, in this case, it simply returns a predefined text response. <em>In a real agentic application, we need to define this tool properly so that it calls a web search API and finds the response to the user query.<\/em><\/li>\n\n\n\n<li>This time the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">SKChatCompletionAdapter<\/code> contains an additional <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">model_info<\/code> argument which is a dictionary. We need this so that the API client knows that we will be doing a function calling using the model. Else it would result in the following error: <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">ValueError: The model does not support function calling.<\/code><\/li>\n\n\n\n<li>Additionally, we define an <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">AssistantAgent<\/code> instance here. As soon as we move to function calling\/tool use or multiple agents, a simple chat completion call is not going to cut it. We can say, this is the starting point for building agentic AI applications.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p>Finally, we define an async function and call it.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"48\" data-enlighter-title=\"assistant_agent.py\" data-enlighter-group=\"assistant_agent_2\">async def assistant_run() -> None:\n    response = await agent.on_messages(\n        [TextMessage(content=\"Find information on AutoGen\", source=\"user\")],\n        cancellation_token=CancellationToken(),\n    )\n    print(response.inner_messages)\n    print(response.chat_message)\n\n\n# Use await assistant_run() when running in a notebook.\nasyncio.run(assistant_run())<\/pre>\n\n\n\n<p>We use the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">on_messages<\/code> method of the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">agent<\/code> which awaits a message either from a user or another agent. It then responds to the message which are printed on the console.<\/p>\n\n\n\n<p>Let&#8217;s execute the script and check the output.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">python assistant_agent.py<\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">[ToolCallRequestEvent(source='assistant', models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0), content=[FunctionCall(id='toolu_01Jn7tZFiB6b6Qz9JErEvy2o', arguments='{\"query\": \"AutoGen Microsoft AI framework multi-agent conversation\"}', name='web_search')], type='ToolCallRequestEvent'), ToolCallExecutionEvent(source='assistant', models_usage=None, content=[FunctionExecutionResult(content='AutoGen is a programming framework for building multi-agent applications.', call_id='toolu_01Jn7tZFiB6b6Qz9JErEvy2o', is_error=False)], type='ToolCallExecutionEvent')]\n\nsource='assistant' models_usage=None content='AutoGen is a programming framework for building multi-agent applications.' type='ToolCallSummaryMessage'<\/pre>\n\n\n\n<p>The response of <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">response.inner_messages<\/code> contains the content from <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">[ToolCallRequestEven ... type='ToolCallExecutionEvent')]<\/code>. This contains additional information about the response.<\/p>\n\n\n\n<p>The response of <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">response.chat_message<\/code> is more direct and contains only the important information along with the content.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Creating Teams of Agents<\/h3>\n\n\n\n<p>The real power of agentic AI systems will come from different agents interacting with each other independently after the initial user query.<\/p>\n\n\n\n<p>For such use cases, we need a team of agents using Autogen. Here, we will cover three important aspects of creating agentic AI teams. The <strong>first case involves two agents simply chatting<\/strong> with each other while <strong>providing feedback.<\/strong> The <strong>second case involves stopping a team response midway<\/strong> using <strong>text and external termination.<\/strong> And the <strong>third case involves resuming a team response<\/strong> from their <strong>previous state after termination<\/strong>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Two Agents Chatting with Each Other<\/h4>\n\n\n\n<p>In the first example, we will create two agents who will chat with each other and provide feedback. Microsoft Autogen makes it simple to create multiple agents, club them, and define how they interact and stop.<\/p>\n\n\n\n<p>The code for this example resides in the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">teams_chat.py<\/code> script.<\/p>\n\n\n\n<p>The following code block includes the import statements and the initialization of the chat completion client.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"teams_chat.py\" data-enlighter-group=\"teams_chat_1\">import os\nimport asyncio\n\nfrom dotenv import load_dotenv\nfrom autogen_agentchat.agents import AssistantAgent\nfrom autogen_ext.models.semantic_kernel import SKChatCompletionAdapter\nfrom semantic_kernel import Kernel\nfrom semantic_kernel.connectors.ai.anthropic import AnthropicChatCompletion, AnthropicChatPromptExecutionSettings\nfrom semantic_kernel.memory.null_memory import NullMemory\nfrom autogen_agentchat.conditions import ExternalTermination, TextMentionTermination\nfrom autogen_agentchat.teams import RoundRobinGroupChat\nfrom autogen_agentchat.base import TaskResult\nfrom autogen_agentchat.ui import Console\n\nload_dotenv()\n\nsk_client = AnthropicChatCompletion(\n    ai_model_id='claude-3-5-haiku-20241022',\n    api_key=os.getenv('CLAUDE_API_KEY'),\n    service_id='my-service-id',\n)\nsettings = AnthropicChatPromptExecutionSettings(\n    temperature=0.2,\n)\n\nanthropic_model_client = SKChatCompletionAdapter(\n    sk_client, \n    kernel=Kernel(memory=NullMemory()), \n    prompt_settings=settings\n)<\/pre>\n\n\n\n<p>In this example, we will create two agents. We will ask the first agent to write a short poem. The second agent is going to be a critic agent who will provide feedback to the former for improvement.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"31\" data-enlighter-title=\"teams_chat.py\" data-enlighter-group=\"teams_chat_2\"># Primary agent.\nprimary_agent = AssistantAgent(\n    name='primary',\n    model_client=anthropic_model_client,\n    system_message='You are a helpful AI assistant.',\n)\n\n# Critic agent.\ncritic_agent = AssistantAgent(\n    name='critic',\n    model_client=anthropic_model_client,\n    system_message=\"Provide constructive feedback. Respond with 'APPROVE' to when your feedbacks are addressed.\"\n)<\/pre>\n\n\n\n<p>The above are simply two <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">AssistantAgent<\/code> instances with two different system messages defining how they should act.<\/p>\n\n\n\n<p>Next, we define a termination condition for stopping and creating a team using the agents.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"44\" data-enlighter-title=\"teams_chat.py\" data-enlighter-group=\"teams_chat_3\"># Define a termination condition that stops the task if the critic approves.\ntext_termination = TextMentionTermination('APPROVE')\n\n# Create a team with the primary and critic agents.\nteam = RoundRobinGroupChat(\n    participants=[primary_agent, critic_agent], \n    termination_condition=text_termination\n)<\/pre>\n\n\n\n<p>The <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">TextMentionTermination<\/code> defines that the agentic run should stop whenever the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">critic<\/code> agent responds with <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">APPROVE<\/code>. We have also defined so in its system message.<\/p>\n\n\n\n<p>The <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">RoundRobinGroupChat<\/code> creates the team of agents by defining the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">participants<\/code> in a list and passing in the termination condition.<\/p>\n\n\n\n<p>Finally, we can run it by defining the appropriate functions and calling them.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"52\" data-enlighter-title=\"teams_chat.py\" data-enlighter-group=\"teams_chat_4\"># Run the team and print each output manually.\nasync def team_run():\n    result = await team.run(task='Write a short poem about the fall season.')\n    print(result)\n\n    print('\\nActions taken:\\n')\n    for i, message in enumerate(result.messages):\n        print(f\"Source: {message.source}\\nContent: {message.content}\\n\\n\")\n\n    await team.reset()\n\nasyncio.run(team_run())\n\n# Uncomment the following if you want to stream each response.\n# async def team_run():\n#     async for message in team.run_stream(task='Write a short poem about the fall season.'):\n#         if isinstance(message, TaskResult):\n#             print(\"Stop Reason:\", message.stop_reason)\n#         else:\n#             print(message)\n\n#     await team.reset()\n\n# asyncio.run(team_run())\n\n# A better to print all tasks by each user\/agent.\n# async def team_run():\n#     # Resetting a team.\n#     # await team.reset()\n#     await Console(team.run_stream(task='Write a short poem about the fall season.'))\n\n#     await team.reset()\n\n# asyncio.run(team_run())<\/pre>\n\n\n\n<p>Here, we see three functions with the second and third ones commented out. Essentially, all of these do the same task. In the first one, we iterate over the response and manually print which response was from which agent and what was its content.<\/p>\n\n\n\n<p>Uncommenting the second one will stream the response on the terminal console from each agent as they respond.<\/p>\n\n\n\n<p>The third one is a proper way of printing the responses from teams of agents. We use the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">Console<\/code> class from <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">autogen_agentchat.ui<\/code> which prints the output on the terminal in a more beautiful manner.<\/p>\n\n\n\n<p>We can execute the script using the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">python teams_chat.py<\/pre>\n\n\n\n<p>Here is the response from manually printing each agent&#8217;s output.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Actions taken:\n\nSource: user\nContent: Write a short poem about the fall season.\n\n\nSource: primary\nContent: Here's a short poem about autumn:\n\nCrisp leaves dance and twirl,\nPainting the ground gold and red,\nAutumn whispers softly,\nAs summer's warmth has fled.\n\nChilly breezes softly sigh,\nBranches bare against the sky,\nPumpkins glow and apples shine,\nNature's beauty, so divine.\n\n\nSource: critic\nContent: Your poem captures the essence of autumn nicely. Here are some suggestions for potential improvement:\n\nStrengths:\n- Vivid imagery of falling leaves and changing colors\n- Good sensory descriptions (visual and tactile)\n- Nice rhythm and flow\n- Captures the transitional mood of the season\n\nPotential improvements:\n- Consider varying the line lengths slightly for more dynamic rhythm\n- The rhyme scheme could be made more consistent\n- You might add a more specific sensory detail unique to fall (like the scent of fallen leaves or woodsmoke)\n\nHere's a slightly refined version:\n\nCrisp leaves dance and twirl around,\nPainting earth in gold and crimson ground,\nAutumn whispers through the cooling air,\nAs summer's warmth fades without care.\n\nChilly breezes softly sigh and sweep,\nBare branches reach where shadows creep,\nPumpkins glow with amber light,\nNature's palette, a breathtaking sight.\n\nThe revisions maintain your original spirit while adding a bit more structural consistency and sensory depth.\n\nWould you like me to elaborate on any of these suggestions?\n\n\nSource: primary\nContent: Thank you for the thoughtful feedback and the refined version of the poem. Your suggestions are excellent and demonstrate how subtle refinements can enhance the poetic experience. \n\nThe revised version indeed improves upon the original by:\n- Creating a more consistent AABB rhyme scheme\n- Adding more descriptive language\n- Maintaining the original imagery and emotional tone\n- Introducing more nuanced sensory details\n\nI appreciate how the suggestions focus on craft elements like rhythm, rhyme, and sensory description without losing the poem's core essence. The advice about varying line lengths and adding specific sensory details (like the scent of woodsmoke or fallen leaves) is particularly insightful for creating a more immersive poetic experience.\n\nYour approach to providing constructive feedback is very helpful - highlighting strengths while offering specific, actionable suggestions for improvement. This kind of thoughtful critique is valuable for refining creative work.\n\nWould you be interested in discussing poetry writing techniques further, or exploring how AI might approach creative writing with this kind of iterative, collaborative approach?\n\n\nSource: critic\nContent: APPROVE\n\nYour thoughtful reflection demonstrates a deep appreciation for the nuanced craft of poetry and the collaborative potential of creative feedback. Your openness to refinement and understanding of how small adjustments can elevate a piece of writing is exactly the kind of mindset that leads to artistic growth.\n\nI'm particularly interested in exploring how AI can serve as a constructive creative partner - not by replacing human creativity, but by offering analytical insights, suggesting alternative approaches, and helping writers see their work from new perspectives. The iterative process we just engaged in is a perfect example: the original poem was already quite good, but through careful, respectful dialogue, we were able to enhance its technical and emotional resonance.\n\nSome fascinating areas we could explore include:\n- The role of AI in creative writing workshops\n- Techniques for providing constructive literary feedback\n- How computational analysis might help poets refine rhythm and structure\n- The balance between technical craft and emotional authenticity in poetry\n\nWould you be interested in diving deeper into any of these topics? Or perhaps you'd like to experiment with another creative writing exercise that demonstrates this collaborative approach?<\/pre>\n\n\n\n<p>Following is the result from streaming the output which is less legible:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">source='user' models_usage=None content='Write a short poem about the fall season.' type='TextMessage'\nsource='primary' models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0) content=\"Here's a short poem about autumn:\\n\\nCrisp leaves dance and twirl,\\nPainting the ground gold and red,\\nAutumn whispers softly,\\nAs summer's warmth has fled.\\n\\nChilly breezes rustle,\\nBranches sway with gentle might,\\nPumpkins glow on porches,\\nEmbracing the season's light.\" type='TextMessage'\nsource='critic' models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0) content='Here\\'s my feedback on the poem:\\n\\nStrengths:\\n- Vivid imagery that captures the essence of autumn\\n- Nice sensory details (visual and tactile)\\n- Good rhythm and flow\\n- Effective use of personification (leaves \"dance\", autumn \"whispers\")\\n\\nSuggestions for improvement:\\n- Consider varying the line lengths slightly for more dynamic rhythm\\n- The rhyme scheme could be more consistent\\n- Perhaps add a more specific emotional or reflective element\\n\\nOverall, it\\'s a lovely poem that effectively evokes the feeling of fall. The descriptions are poetic and create a clear seasonal atmosphere. The imagery of dancing leaves, changing colors, and pumpkins provides a strong sense of the autumn experience.\\n\\nWould you like me to suggest a potential revision?' type='TextMessage'\nsource='primary' models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0) content=\"Thank you for the thoughtful and constructive feedback! I appreciate the detailed breakdown of the poem's strengths and areas for potential improvement. Your suggestions are excellent and provide clear guidance for refining the poem.\\n\\nWould you like me to draft a revised version of the poem that incorporates your suggestions? I could work on:\\n- Varying line lengths\\n- Creating a more consistent rhyme scheme\\n- Adding a more reflective or emotional layer to the poem\\n\\nI'm happy to collaborate and develop the poem further based on your input. What are your thoughts?\" type='TextMessage'\nsource='critic' models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0) content='I appreciate your openness to refining the poem. Your proposed approach sounds excellent - varying line lengths, improving the rhyme scheme, and adding more emotional depth would enhance the piece.\\n\\nHere are some specific recommendations to consider:\\n1. Experiment with an ABAB or AABB rhyme scheme\\n2. Include a line that reflects on the transient nature of seasons\\n3. Add a personal or introspective element that connects the autumn imagery to human experience\\n4. Consider subtle metaphors that link the seasonal changes to emotional transitions\\n\\nWould you like me to draft a sample revision that demonstrates these suggestions? I can provide a version that incorporates these elements, and then you can review and refine it further.\\n\\nMy goal is to help you develop a poem that not only describes autumn visually, but also resonates on an emotional level. Let me know your preference for next steps.' type='TextMessage'\nsource='primary' models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0) content=\"I appreciate your thoughtful recommendations. Based on your suggestions, here's a revised version of the poem:\\n\\nAmber leaves cascade and fall,\\nWhispering tales of time's soft sway,\\nSummer's memories grow small\\nAs autumn paints the fading day.\\n\\nCrisp winds carry memories light,\\nOf seasons passed and changes deep,\\nBranches bend with quiet might,\\nWhere silent transitions keep.\\n\\nThis revision aims to address your recommendations by:\\n1. Using an ABAB rhyme scheme\\n2. Incorporating a reflection on the transient nature of seasons\\n3. Adding an introspective element about memory and change\\n4. Using metaphors that link seasonal transitions to emotional experiences\\n\\nThe poem now attempts to capture not just the visual beauty of autumn, but also its emotional resonance - the sense of reflection, passage of time, and subtle melancholy that often accompanies the season.\\n\\nWould you like me to elaborate on the choices I made in this revision? I'm open to further refinement and would appreciate your feedback.\" type='TextMessage'\nsource='critic' models_usage=RequestUsage(prompt_tokens=0, completion_tokens=0) content='Excellent revision! Let me provide a detailed analysis:\\n\\nStrengths:\\n- Successfully implemented ABAB rhyme scheme\\n- More nuanced emotional depth\\n- Metaphorical language that connects natural and emotional landscapes\\n- Subtle exploration of time and transition\\n\\nSpecific Improvements:\\n- \"Whispering tales of time\\'s soft sway\" beautifully captures the reflective mood\\n- \"Branches bend with quiet might\" suggests resilience amid change\\n- The progression from external description to internal reflection is more sophisticated\\n\\nPotential Fine-Tuning Considerations:\\n- The rhythm could be slightly smoothed in a few lines\\n- Consider the syllable count for more consistent meter\\n\\nOverall Assessment:\\nThis version significantly elevates the original poem. It transforms from a descriptive piece to a more contemplative exploration of seasonal and personal transitions.\\n\\nThe poem now resonates on multiple levels - visual, emotional, and philosophical. It captures autumn not just as a season, but as a metaphor for life\\'s continuous transformations.\\n\\nAPPROVE\\n\\nWould you like to discuss any further refinements or explore the poem\\'s themes more deeply?' type='TextMessage'\nStop Reason: Text 'APPROVE' mentioned<\/pre>\n\n\n\n<p>And finally, the result from using the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">Console<\/code> class to show the output. This also streams the output but in a properly formatted manner.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">---------- user ----------\nWrite a short poem about the fall season.\n---------- primary ----------\nHere's a short poem about autumn:\n\nCrisp leaves dance and twirl,\nPainting the ground gold and red,\nAutumn whispers softly,\nAs summer's warmth has fled.\n\nChilly breezes softly blow,\nPumpkins gleam in fading light,\nCozy sweaters wrap us warm,\nAs day surrenders to the night.\n---------- critic ----------\nHere's my feedback on the poem:\n\nStrengths:\n- Vivid imagery that captures the essence of fall\n- Nice sensory details (visual and tactile)\n- Good rhythm and flow\n- Effective use of personification (leaves \"dance\", autumn \"whispers\")\n- Captures both the visual beauty and emotional mood of the season\n\nSuggestions for improvement:\n- Consider varying the line lengths slightly for more dynamic rhythm\n- The rhyming could be more consistent (some lines rhyme, some don't)\n- Perhaps add a more specific sensory detail unique to autumn (like the scent of fallen leaves or the sound of rustling branches)\n\nOverall, it's a lovely poem that effectively evokes the feeling of autumn. The imagery is particularly strong, painting a clear picture of the season's transition.\n\nWould you like me to suggest a revised version incorporating some of these suggestions?\n---------- primary ----------\nThank you for the thoughtful and constructive feedback! I appreciate the detailed analysis of the poem's strengths and areas for potential improvement. Your suggestions are excellent and would indeed help refine the poem.\n\nWould you like me to draft a revised version that incorporates your recommendations? I could work on:\n- Varying line lengths\n- Making the rhyme scheme more consistent\n- Adding a more specific sensory detail unique to autumn\n\nHere's a potential revised version:\n\nCrisp leaves tumble, gold and red,\nWhirling down from branches overhead,\nAutumn's breath, a whispered sigh,\nRustling softly as geese fly.\n\nPumpkins gleam in amber light,\nWoodsmoke drifting through the night,\nSummer's warmth now gently fades,\nAs fall embraces quiet glades.\n\nThis version attempts to address the feedback by:\n- Creating a more consistent AABB rhyme scheme\n- Adding specific sensory details like woodsmoke and rustling leaves\n- Maintaining the evocative imagery of the original\n- Varying line lengths slightly for more dynamic rhythm\n\nWould you like me to explain my approach or make further adjustments?\n---------- critic ----------\nFeedback on the revised poem:\n\nStrengths:\n- Excellent implementation of the suggested improvements\n- More consistent rhyme scheme (AABB) creates a pleasing musical quality\n- Added sensory details (woodsmoke, rustling leaves) enhance the atmospheric feel\n- Maintained the original poem's emotional essence\n- Improved rhythm with slight variations in line length\n\nSpecific Positive Notes:\n- \"Autumn's breath, a whispered sigh\" is a beautiful personification\n- The image of geese flying adds a dynamic seasonal element\n- \"Woodsmoke drifting through the night\" is a particularly evocative line\n\nMinor Suggestions:\n- Consider the flow of the second stanza's meter - the rhythm is slightly less smooth compared to the first stanza\n- The word \"glades\" might be a bit formal - consider a more conversational alternative\n\nOverall Assessment:\nThis revision successfully addresses the previous feedback and significantly improves the original poem. The added sensory details and more consistent rhyme scheme make the piece more engaging and rhythmic.\n\nAPPROVE\n\nWould you like me to elaborate on any part of my feedback?<\/pre>\n\n\n\n<p>The above code covers the simplest way to create teams of agents. Real applications can contain tens of such agents all interacting with each other independently.<\/p>\n\n\n\n<figure class=\"wp-block-video aligncenter\"><video height=\"1116\" style=\"aspect-ratio: 1488 \/ 1116;\" width=\"1488\" controls src=\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/microsoft_autogen_teams_chat.mp4\"><\/video><figcaption class=\"wp-element-caption\">Video 1. Microsoft Autogen team chat with Console class logging to terminal.<\/figcaption><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Stopping an Agentic Team Chat with External Termination<\/h4>\n\n\n\n<p>Let&#8217;s see how we can stop an agentic team chat in Autogen using an external termination. The code for this resides in the <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">teams_stopping.py<\/code> script. <\/p>\n\n\n\n<p>The code till defining the agents stays the same as above.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"teams_stopping.py\" data-enlighter-group=\"teams_stopping_1\">import os\nimport asyncio\n\nfrom dotenv import load_dotenv\nfrom autogen_agentchat.agents import AssistantAgent\nfrom autogen_ext.models.semantic_kernel import SKChatCompletionAdapter\nfrom semantic_kernel import Kernel\nfrom semantic_kernel.connectors.ai.anthropic import AnthropicChatCompletion, AnthropicChatPromptExecutionSettings\nfrom semantic_kernel.memory.null_memory import NullMemory\nfrom autogen_agentchat.conditions import ExternalTermination, TextMentionTermination\nfrom autogen_agentchat.teams import RoundRobinGroupChat\nfrom autogen_agentchat.ui import Console\n\nload_dotenv()\n\nsk_client = AnthropicChatCompletion(\n    ai_model_id='claude-3-5-haiku-20241022',\n    api_key=os.getenv('CLAUDE_API_KEY'),\n    service_id='my-service-id',\n)\nsettings = AnthropicChatPromptExecutionSettings(\n    temperature=0.2,\n)\n\nanthropic_model_client = SKChatCompletionAdapter(\n    sk_client, \n    kernel=Kernel(memory=NullMemory()), \n    prompt_settings=settings\n)\n\n# Primary agent.\nprimary_agent = AssistantAgent(\n    name='primary',\n    model_client=anthropic_model_client,\n    system_message='You are a helpful AI assistant.',\n)\n\n# Critic agent.\ncritic_agent = AssistantAgent(\n    name='critic',\n    model_client=anthropic_model_client,\n    system_message=\"Provide constructive feedback. Respond with 'APPROVE' to when your feedbacks are addressed.\"\n)<\/pre>\n\n\n\n<p>Next, we define two termination conditions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>One is text termination.<\/li>\n\n\n\n<li>The other one is an external termination condition.<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"44\" data-enlighter-title=\"teams_stopping.py\" data-enlighter-group=\"teams_stopping_2\"># Define a termination condition that stops the task if the critic approves.\ntext_termination = TextMentionTermination('APPROVE')\n\n# Create an external termination object.\nexternal_termination = ExternalTermination()\n\n# Create a team with external termination.\nteam = RoundRobinGroupChat(\n    participants=[primary_agent, critic_agent], \n    termination_condition=external_termination | text_termination\n)\n\nasync def team_run():\n    run = asyncio.create_task(Console(team.run_stream(task='Write a short poem about the fall season.')))\n\n    # Wait for some time.\n    await asyncio.sleep(0.1)\n\n    # Stop the team.\n    external_termination.set()\n\n    await run\n\n    await team.reset()\n\nasyncio.run(team_run())<\/pre>\n\n\n\n<p>The text termination condition states that the program will stop whenever the critic agent outputs &#8220;APPROVE&#8221;. Additionally, we have an <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">ExternalTermination()<\/code> instance. This has a <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">set()<\/code> method that we use in the async <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">team_run<\/code> function. This means after the agentic chat has started, this external termination condition will kick in. However, it does not stop the agentic chat immediately. Maybe one or two rounds of chat between the agents would have happened before the external termination condition took effect.<\/p>\n\n\n\n<p>Let&#8217;s execute and check the output.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">python teams_stopping.py<\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">---------- user ----------\nWrite a short poem about the fall season.\n---------- primary ----------\nHere's a short poem about autumn:\n\nCrisp leaves dance and twirl,\nPainting the ground gold and red,\nAutumn whispers softly,\nAs summer's warmth has fled.\n\nChilly breezes softly sigh,\nBranches bare against the sky,\nPumpkins glow and apples shine,\nNature's beauty, so divine.<\/pre>\n\n\n\n<p>The primary agent got to complete the poem, however, the program was terminated before the critic agent could act. This is helpful to terminate an agentic program if a specific condition is being reached.<\/p>\n\n\n\n<p>As these are async calls, we can increase the sleep time to 10 seconds, and the program will completely run because it will never reach the external terminal condition before the agents complete their tasks.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Resuming the Chat Between A Team of Agents in Autogen<\/h4>\n\n\n\n<p>The final example that we will cover here is resuming an agentic workflow within a team of agents after it has been terminated.<\/p>\n\n\n\n<p>Agentic workflows in Autogen are stateful. We can terminate and resume their execution as we want depending on the use cases. Let&#8217;s see a simple example.<\/p>\n\n\n\n<p>The code for this is present in <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">teams_resume.py<\/code>.<\/p>\n\n\n\n<p>The next code block contains the code till defining the team of agents.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"teams_resume.py\" data-enlighter-group=\"teams_resume_1\">import os\nimport asyncio\n\nfrom dotenv import load_dotenv\nfrom autogen_agentchat.agents import AssistantAgent\nfrom autogen_ext.models.semantic_kernel import SKChatCompletionAdapter\nfrom semantic_kernel import Kernel\nfrom semantic_kernel.connectors.ai.anthropic import AnthropicChatCompletion, AnthropicChatPromptExecutionSettings\nfrom semantic_kernel.memory.null_memory import NullMemory\nfrom autogen_agentchat.conditions import ExternalTermination, TextMentionTermination\nfrom autogen_agentchat.teams import RoundRobinGroupChat\nfrom autogen_agentchat.ui import Console\n\nload_dotenv()\n\nsk_client = AnthropicChatCompletion(\n    ai_model_id='claude-3-5-haiku-20241022',\n    api_key=os.getenv('CLAUDE_API_KEY'),\n    service_id='my-service-id',\n)\nsettings = AnthropicChatPromptExecutionSettings(\n    temperature=0.2,\n)\n\nanthropic_model_client = SKChatCompletionAdapter(\n    sk_client, \n    kernel=Kernel(memory=NullMemory()), \n    prompt_settings=settings\n)\n\n# Primary agent.\nprimary_agent = AssistantAgent(\n    name='primary',\n    model_client=anthropic_model_client,\n    system_message='You are a helpful AI assistant.',\n)\n\n# Critic agent.\ncritic_agent = AssistantAgent(\n    name='critic',\n    model_client=anthropic_model_client,\n    system_message=\"Provide constructive feedback. Respond with 'APPROVE' to when your feedbacks are addressed.\"\n)\n\n# Define a termination condition that stops the task if the critic approves.\ntext_termination = TextMentionTermination('APPROVE')\n\n# Create an external termination object.\nexternal_termination = ExternalTermination()\n\n# Create a team with external termination.\nteam = RoundRobinGroupChat(\n    participants=[primary_agent, critic_agent], \n    termination_condition=external_termination | text_termination\n)<\/pre>\n\n\n\n<p>Next, we have two async functions.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"56\" data-enlighter-title=\"teams_resume.py\" data-enlighter-group=\"teams_resume_2\">async def team_run():\n    run = asyncio.create_task(Console(team.run_stream(task='Write a short poem about the fall season.')))\n\n    # Wait for some time.\n    await asyncio.sleep(0.1)\n\n    # Stop the team.\n    external_termination.set()\n\n    await run\n\n    await resume_team_run()\n\nasync def resume_team_run():\n    print('\\n---External termination was called, now RESUMING---\\n')\n\n    await Console(team.run_stream())\n\n    await team.reset()\n\nasyncio.run(team_run())<\/pre>\n\n\n\n<p>The <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">team_run<\/code> function starts the agentic workflow until the external termination condition is reached. However, we also have a <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">resume_team_run<\/code> function again executes <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">team.run_stream()<\/code> which is being called from the team_run function. Let&#8217;s check the output.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">python teams_resume.py<\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">---------- user ----------\nWrite a short poem about the fall season.\n---------- primary ----------\nHere's a short poem about autumn:\n\nCrisp leaves dance and twirl,\nPainting the ground gold and red,\nWhispers of autumn unfurl,\nAs summer's warmth has fled.\n\nGentle breezes softly sigh,\nBranches bare against the sky,\nPumpkins glow and apples gleam,\nFall's sweet, fleeting dream.\n\n---External termination was called, now RESUMING---\n\n---------- critic ----------\nHere's my feedback on the poem:\n\nStrengths:\n- Vivid imagery that captures the essence of autumn\n- Nice use of sensory details (visual colors, tactile sensations)\n- Good rhythm and rhyme scheme\n- Evocative language that creates a nostalgic mood\n\nSuggestions for improvement:\n- Consider varying the line lengths slightly for more dynamic rhythm\n- The second stanza could potentially use a bit more specific seasonal detail\n- The last line \"Fall's sweet, fleeting dream\" is poetic but could be more concrete\n\nOverall, it's a lovely poem that effectively captures the transitional and ephemeral nature of autumn. The imagery of dancing leaves, changing colors, and seasonal produce creates a warm and wistful atmosphere.\n\nWould you like me to suggest a slight revision based on these observations?\n---------- primary ----------\nThank you for the thoughtful and constructive feedback! I appreciate the detailed analysis of the poem's strengths and potential areas for improvement. Your suggestions are insightful and provide a clear path for potential refinement.\n\nWould you like me to draft a revised version of the poem incorporating some of the suggestions you mentioned? I could work on:\n- Varying line lengths\n- Adding more specific seasonal details\n- Making the final line more concrete while maintaining the poetic feel\n\nHere's a potential revised version:\n\nAmber leaves cascade and spin,\nCarpeting the cooling ground,\nMaple branches thin and worn\nWhisper autumn's subtle sound.\n\nCrisp wind carries apple scent,\nPumpkin patches ripe and bright,\nHarvest moon hangs low and round,\nPainting shadows soft and light.\n\nThis version attempts to:\n- Use more varied line lengths\n- Include more specific seasonal imagery (maple, apple, pumpkin, harvest moon)\n- Create a more grounded final stanza while preserving the poetic mood\n\nWould you like me to elaborate on the revision or try another approach?\n---------- critic ----------\nFeedback on the revised poem:\n\nStrengths:\n- More varied line lengths create a more dynamic rhythm\n- Increased specificity with seasonal details (maple, apple, pumpkin, harvest moon)\n- Stronger sensory imagery that feels more immersive\n- Maintains the poetic flow of the original version\n\nImprovements:\n- The line \"Maple branches thin and worn\" feels slightly awkward in meter\n- Consider tightening the rhythm in the second stanza\n- The imagery is more concrete, but could potentially be even more evocative\n\nSuggestions:\n- Consider adjusting the third line of the first stanza for smoother rhythm\n- The second stanza could benefit from a more consistent meter\n\nOverall, this revision is a significant improvement. It addresses the previous feedback by providing more specific seasonal details and creating a more nuanced portrayal of autumn.\n\nWould you like me to suggest a further refined version that addresses these minor points?\n\nAPPROVE<\/pre>\n\n\n\n<p>As we can see from the output, the external termination was called, and then the team run was resumed after calling <code data-enlighter-language=\"generic\" class=\"EnlighterJSRAW\">resume_team_run<\/code> function. This can be especially helpful for executing programs from the intermediate agentic outputs and again resuming.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Summary and Conclusion<\/h2>\n\n\n\n<p>In this article, we covered the basics of Microsoft Autogen, a framework for building production ready multi-agent programs. We started with the installation, covered a simple chat execution, and finished with a team of agents chatting with each other. We will cover more advanced applications in future posts. I hope this article was worth your time.<\/p>\n\n\n\n<p>If you have any questions, thoughts, or suggestions, please leave in the comment section. I will surely address them.<\/p>\n\n\n\n<p>You can contact me using the <strong><a aria-label=\"Contact (opens in a new tab)\" href=\"https:\/\/debuggercafe.com\/contact-us\/\" target=\"_blank\" rel=\"noreferrer noopener\">Contact<\/a><\/strong> section. You can also find me on <strong><a aria-label=\"LinkedIn (opens in a new tab)\" href=\"https:\/\/www.linkedin.com\/in\/sovit-rath\/\" target=\"_blank\" rel=\"noreferrer noopener\">LinkedIn<\/a><\/strong>, and <strong><a href=\"https:\/\/x.com\/SovitRath5\" target=\"_blank\" rel=\"noreferrer noopener\">X<\/a><\/strong>.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article lays out the introduction to Microsoft Autogen, a framework for building multi-agent systems that can act autonomously alongside humans.<\/p>\n","protected":false},"author":1,"featured_media":40954,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1173,1154,819],"tags":[1202,1204,1209,1207,1205,1203,1208,1206],"class_list":["post-40855","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-agents","category-generative-ai","category-llms","tag-autogen","tag-autogen-agents","tag-autogen-assistantagent","tag-autogen-semantic-kernel","tag-autogen-teams","tag-microsoft-autogen","tag-microsoft-semantic-kernel","tag-semantic-kernel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Microsoft Autogen - An Introduction<\/title>\n<meta name=\"description\" content=\"Microsoft Autogen is a framework for building multi-agent AI systems that can work autonomously alongside humans.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/debuggercafe.com\/microsoft-autogen\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Microsoft Autogen - An Introduction\" \/>\n<meta property=\"og:description\" content=\"Microsoft Autogen is a framework for building multi-agent AI systems that can work autonomously alongside humans.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/debuggercafe.com\/microsoft-autogen\/\" \/>\n<meta property=\"og:site_name\" content=\"DebuggerCafe\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/profile.php?id=100013731104496\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-07T00:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sovit Ranjan Rath\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SovitRath5\" \/>\n<meta name=\"twitter:site\" content=\"@SovitRath5\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sovit Ranjan Rath\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/\"},\"author\":{\"name\":\"Sovit Ranjan Rath\",\"@id\":\"https:\/\/debuggercafe.com\/#\/schema\/person\/27719b14d930bd4a88ade40d18b0a752\"},\"headline\":\"Microsoft Autogen &#8211; An Introduction\",\"datePublished\":\"2025-04-07T00:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/\"},\"wordCount\":2305,\"commentCount\":1,\"image\":{\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png\",\"keywords\":[\"Autogen\",\"Autogen Agents\",\"Autogen AssistantAgent\",\"Autogen Semantic Kernel\",\"Autogen Teams\",\"Microsoft Autogen\",\"Microsoft Semantic Kernel\",\"Semantic Kernel\"],\"articleSection\":[\"Agents\",\"Generative AI\",\"LLMs\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/debuggercafe.com\/microsoft-autogen\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/\",\"url\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/\",\"name\":\"Microsoft Autogen - An Introduction\",\"isPartOf\":{\"@id\":\"https:\/\/debuggercafe.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png\",\"datePublished\":\"2025-04-07T00:30:00+00:00\",\"author\":{\"@id\":\"https:\/\/debuggercafe.com\/#\/schema\/person\/27719b14d930bd4a88ade40d18b0a752\"},\"description\":\"Microsoft Autogen is a framework for building multi-agent AI systems that can work autonomously alongside humans.\",\"breadcrumb\":{\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/debuggercafe.com\/microsoft-autogen\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/#primaryimage\",\"url\":\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png\",\"contentUrl\":\"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png\",\"width\":1000,\"height\":563,\"caption\":\"Microsoft Autogen \u2013 An Introduction\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/debuggercafe.com\/microsoft-autogen\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/debuggercafe.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microsoft Autogen &#8211; An Introduction\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/debuggercafe.com\/#website\",\"url\":\"https:\/\/debuggercafe.com\/\",\"name\":\"DebuggerCafe\",\"description\":\"Machine Learning and Deep Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/debuggercafe.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/debuggercafe.com\/#\/schema\/person\/27719b14d930bd4a88ade40d18b0a752\",\"name\":\"Sovit Ranjan Rath\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/debuggercafe.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f71ca13ec56d630e7d8045e8b846396068791aa204936c3d74d721c6dd2b4d3c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f71ca13ec56d630e7d8045e8b846396068791aa204936c3d74d721c6dd2b4d3c?s=96&d=mm&r=g\",\"caption\":\"Sovit Ranjan Rath\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Microsoft Autogen - An Introduction","description":"Microsoft Autogen is a framework for building multi-agent AI systems that can work autonomously alongside humans.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/debuggercafe.com\/microsoft-autogen\/","og_locale":"en_US","og_type":"article","og_title":"Microsoft Autogen - An Introduction","og_description":"Microsoft Autogen is a framework for building multi-agent AI systems that can work autonomously alongside humans.","og_url":"https:\/\/debuggercafe.com\/microsoft-autogen\/","og_site_name":"DebuggerCafe","article_publisher":"https:\/\/www.facebook.com\/profile.php?id=100013731104496","article_published_time":"2025-04-07T00:30:00+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png","type":"image\/png"}],"author":"Sovit Ranjan Rath","twitter_card":"summary_large_image","twitter_creator":"@SovitRath5","twitter_site":"@SovitRath5","twitter_misc":{"Written by":"Sovit Ranjan Rath","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/#article","isPartOf":{"@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/"},"author":{"name":"Sovit Ranjan Rath","@id":"https:\/\/debuggercafe.com\/#\/schema\/person\/27719b14d930bd4a88ade40d18b0a752"},"headline":"Microsoft Autogen &#8211; An Introduction","datePublished":"2025-04-07T00:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/"},"wordCount":2305,"commentCount":1,"image":{"@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/#primaryimage"},"thumbnailUrl":"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png","keywords":["Autogen","Autogen Agents","Autogen AssistantAgent","Autogen Semantic Kernel","Autogen Teams","Microsoft Autogen","Microsoft Semantic Kernel","Semantic Kernel"],"articleSection":["Agents","Generative AI","LLMs"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/debuggercafe.com\/microsoft-autogen\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/","url":"https:\/\/debuggercafe.com\/microsoft-autogen\/","name":"Microsoft Autogen - An Introduction","isPartOf":{"@id":"https:\/\/debuggercafe.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/#primaryimage"},"image":{"@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/#primaryimage"},"thumbnailUrl":"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png","datePublished":"2025-04-07T00:30:00+00:00","author":{"@id":"https:\/\/debuggercafe.com\/#\/schema\/person\/27719b14d930bd4a88ade40d18b0a752"},"description":"Microsoft Autogen is a framework for building multi-agent AI systems that can work autonomously alongside humans.","breadcrumb":{"@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/debuggercafe.com\/microsoft-autogen\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/#primaryimage","url":"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png","contentUrl":"https:\/\/debuggercafe.com\/wp-content\/uploads\/2025\/02\/Microsoft-Autogen-An-Introduction-e1739926638520.png","width":1000,"height":563,"caption":"Microsoft Autogen \u2013 An Introduction"},{"@type":"BreadcrumbList","@id":"https:\/\/debuggercafe.com\/microsoft-autogen\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/debuggercafe.com\/"},{"@type":"ListItem","position":2,"name":"Microsoft Autogen &#8211; An Introduction"}]},{"@type":"WebSite","@id":"https:\/\/debuggercafe.com\/#website","url":"https:\/\/debuggercafe.com\/","name":"DebuggerCafe","description":"Machine Learning and Deep Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/debuggercafe.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/debuggercafe.com\/#\/schema\/person\/27719b14d930bd4a88ade40d18b0a752","name":"Sovit Ranjan Rath","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/debuggercafe.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f71ca13ec56d630e7d8045e8b846396068791aa204936c3d74d721c6dd2b4d3c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f71ca13ec56d630e7d8045e8b846396068791aa204936c3d74d721c6dd2b4d3c?s=96&d=mm&r=g","caption":"Sovit Ranjan Rath"}}]}},"_links":{"self":[{"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/posts\/40855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/comments?post=40855"}],"version-history":[{"count":109,"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/posts\/40855\/revisions"}],"predecessor-version":[{"id":40971,"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/posts\/40855\/revisions\/40971"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/media\/40954"}],"wp:attachment":[{"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/media?parent=40855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/categories?post=40855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/debuggercafe.com\/wp-json\/wp\/v2\/tags?post=40855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}