{"id":4336,"date":"2025-03-05T09:55:58","date_gmt":"2025-03-05T17:55:58","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/semantic-kernel\/?p=4336"},"modified":"2025-03-07T07:10:28","modified_gmt":"2025-03-07T15:10:28","slug":"semantic-kernel-and-autogen-part-2","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/agent-framework\/semantic-kernel-and-autogen-part-2\/","title":{"rendered":"AutoGen and Semantic Kernel, Part 2"},"content":{"rendered":"<p>Following on from our blog post a couple months ago: <a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/microsofts-agentic-ai-frameworks-autogen-and-semantic-kernel\/\">Microsoft\u2019s Agentic AI Frameworks: AutoGen and Semantic Kernel<\/a>, Microsoft\u2019s agentic AI story is evolving at a steady pace. Both Azure AI Foundry\u2019s <em>Semantic Kernel<\/em> and AI Frontier\u2019s <em>AutoGen<\/em> are designed to empower developers to build advanced multi-agent systems. The AI Frontier\u2019s team is charging ahead pushing the boundaries of multi-agent approaches, building new agentic patterns as well as a growing library of purpose-built agents, such as<a href=\"https:\/\/microsoft.github.io\/autogen\/stable\/user-guide\/agentchat-user-guide\/magentic-one.html\"> Magentic One<\/a>, while the Semantic Kernel team builds on years of enterprise expertise to enable developers to build agents that can be integrated into enterprise applications.<\/p>\n<p>Both teams are working together to move forward to converge these frameworks on a unified runtime and set of design principles that will make it easier to experiment with state-of-the-art agentic patterns\u2014and then transition those experiments into production-grade, enterprise-supported solutions. This blog post outlines the technical details behind that convergence, focusing on common runtime architectures and agent framework enhancements in both <em>AutoGen<\/em> and <em>Semantic Kernel<\/em>.<\/p>\n<p>In out recent roadmap post, <a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/semantic-kernel-roadmap-h1-2025-accelerating-agents-processes-and-integration\/\">Semantic Kernel Roadmap H1 2025: Accelerating Agents, Processes, and Integration<\/a>, we outlined 3 ways in which AutoGen and Semantic Kernel are integrating:<\/p>\n<ul>\n<li><strong>Converging Agent Runtimes:<\/strong> We are actively working together on harmonizing the core components between AutoGen and Semantic Kernel. This convergence will simplify development workflows and enhance the interoperability of multi-agent systems. We are planning a blog post with more technical details on this in the coming week.<\/li>\n<li><strong>Hosting AutoGen agents in Semantic Kernel:<\/strong> You will soon have the flexibility to host AutoGen agents within the Semantic Kernel ecosystem. This means that if you\u2019re already working with AutoGen, you can seamlessly migrate and manage your agents in Semantic Kernel.<\/li>\n<li><strong>AutoGen integrates with Semantic Kernel:<\/strong> AutoGen can now leverage the powerful capabilities of Semantic Kernel, allowing developers to build on their existing investment in Semantic Kernel. This includes an AutoGen adapter for Semantic Kernel\u2019s vast AI connector library as well as a Semantic Kernel based AutoGen assistant agent.<\/li>\n<\/ul>\n<p>Let\u2019s dive into <em>how<\/em> we\u2019re doing this\u2026<\/p>\n<h3>Shared Runtime for AutoGen and Semantic Kernel<\/h3>\n<p>A central design goal of this convergence effort is the adoption of a <strong>common runtime and interfaces<\/strong>. By aligning the execution model, both frameworks can leverage shared abstractions for agent orchestration and process management.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/03\/ag_sk.png\"><img decoding=\"async\" class=\"alignnone  wp-image-4430\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2025\/03\/ag_sk-300x184.png\" alt=\"Image ag sk\" width=\"703\" height=\"431\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/03\/ag_sk-300x184.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/03\/ag_sk-1024x628.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/03\/ag_sk-768x471.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2025\/03\/ag_sk.png 1324w\" sizes=\"(max-width: 703px) 100vw, 703px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Key points include:<\/p>\n<ul>\n<li><strong>Shared Runtime Repository:<\/strong> A dedicated repository (public soon!) is being used to develop packages that work across both frameworks. This initiative simplifies runtime abstractions into a single package consumed by both AutoGen and Semantic Kernel.<\/li>\n<li><strong>Hosting Support:<\/strong> The shared runtime can be hosted in a number of different ways, either in process, for development or simple agentic systems or on top of a distributed system framework like Dapr or Orleans.<\/li>\n<\/ul>\n<h3>Hosting AutoGen Agents within Semantic Kernel<\/h3>\n<p>Semantic Kernel is adding connectors to support integrating agents from other services and libraries (such as OpenAI Assistant agent and Azure AI Agents) and now, with AutoGen agents, starting with v0.2 AutoGen agents. This provides a migration path from AutoGen v0.2 agents into Semantic Kernel. This will work as of SK Python 1.20.0 (and take look at <a href=\"https:\/\/github.com\/microsoft\/semantic-kernel\/blob\/main\/python\/samples\/concepts\/agents\/autogen_conversable_agent\/README.md\">our sample<\/a>).<\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">import asyncio\r\nimport os\r\n\r\nfrom autogen import ConversableAgent\r\nfrom semantic_kernel.agents.autogen.autogen_conversable_agent import AutoGenConversableAgent\r\n\r\nasync def main():\r\n    cathy = ConversableAgent(\r\n        \"cathy\",\r\n        system_message=\"Your name is Cathy and you are a part of a duo of comedians.\",\r\n        llm_config={\r\n            \"config_list\": [\r\n                {\r\n                    \"model\": \"gpt-4o-mini\", \r\n                    \"temperature\": 0.9, \r\n                    \"api_key\": os.environ.get(\"OPENAI_API_KEY\")\r\n                }\r\n            ]\r\n        },\r\n        human_input_mode=\"NEVER\",  # Never ask for human input.\r\n    )\r\n\r\n    joe = ConversableAgent(\r\n        \"joe\",\r\n        system_message=\"Your name is Joe and you are a part of a duo of comedians.\",\r\n        llm_config={\r\n            \"config_list\": [\r\n                {\r\n                    \"model\": \"gpt-4\", \r\n                    \"temperature\": 0.7, \r\n                    \"api_key\": os.environ.get(\"OPENAI_API_KEY\")\r\n                }\r\n            ]\r\n        },\r\n        human_input_mode=\"NEVER\",  # Never ask for human input.\r\n    )\r\n\r\n    # Create the Semantic Kernel AutoGenAgent\r\n    autogen_agent = AutoGenConversableAgent(conversable_agent=cathy)\r\n\r\n    async for content in autogen_agent.invoke(\r\n        recipient=joe, \r\n        message=\"Tell me a joke about NVDA and TESLA stock prices.\", \r\n        max_turns=3\r\n    ):\r\n        print(f\"# {content.role} - {content.name or '*'}: '{content.content}'\")\r\n\r\n\r\nif __name__ == \"__main__\":\r\n    asyncio.run(main())\r\n<\/code><\/pre>\n<h3 class=\"prettyprint language-cs language-csharp\">AutoGen integrates with Semantic Kernel<\/h3>\n<p>AutoGen can now leverage Semantic Kernel connectors to expand functionalities. The following is an example of using Semantic Kernel\u2019s Anthropic AI connector as a model client in AutoGen using the AutoGen.<\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\"><span data-teams=\"true\">#AutoGen (0.4) using Semantic Kernel AI connector\r\nanthropic_client = AnthropicChatCompletion(\r\n\u00a0\u00a0\u00a0 ai_model_id=\"claude-3-5-sonnet-20241022\",\r\n\u00a0\u00a0\u00a0 api_key=os.environ[\"ANTHROPIC_API_KEY\"],\r\n \u00a0\u00a0 service_id=\"my-service-id\",\u00a0 # Optional; for targeting specific services within Semantic Kernel<\/span>\r\n)\r\nsettings = AnthropicChatPromptExecutionSettings(\r\n    temperature=0.2,\r\n)\r\n\r\nsk_kernel = Kernel()\r\n\r\n@sk_kernel.filter(FilterTypes.PROMPT_RENDERING)\r\nasync def prompt_rendering_filter(context: PromptRenderContext, next):\r\n    await next(context)\r\n    \r\n    context = await business_logic.remove_sensitive_data(context)\r\n    rejected, reason = await business_logic.check_prompt(context)\r\n    \r\n    if (rejected):\r\n        raise Exception(\"Prompt rejected: \" + reason)\r\n\r\nsk_client = SKChatCompletionAdapter(\r\n    anthropic_client, kernel=sk_kernel, prompt_settings=settings\r\n)\r\n\r\n# Create an local embedded runtime.\r\nruntime = SingleThreadedAgentRuntime()\r\n\r\nbusiness_logic.ContosoAgent.register(runtime, \"ContosoAgent\", lambda: business_logic.ContosoAgent(sk_client))\r\n\r\ntry:\r\n    runtime.start()\r\n    await runtime.send_message(business_logic.EmployeeMessage(\"Who is Spartacus?\"), AgentId(\"ContosoAgent\", \"default\"))\r\n    await runtime.stop_when_idle()\r\nexcept Exception as e:\r\n    print(e)\r\n<\/code><\/pre>\n<p>By bringing together runtimes, graduating core agent functionalities, and designing for distributed, event-based interactions, the Semantic Kernel and AI Frontiers teams are laying the groundwork for a future where developers can experiment freely with innovative agent patterns\u2014and then smoothly transition those ideas into scalable, supported applications.<\/p>\n<p>You can help! Now is the time to try this functionality out and give us feedback<\/p>\n<p>AutoGen team is on Discord and checkout the <a href=\"https:\/\/github.com\/microsoft\/autogen\/issues\">issue tracker on GitHub<\/a> and the Semantic Kernel team can be found on the <a href=\"https:\/\/github.com\/microsoft\/semantic-kernel\/discussions\/categories\/general\">Semantic Kernel GitHub Discussion Channel<\/a> or join us every week for our <a href=\"https:\/\/aka.ms\/sk-community-calendar\">Community Call<\/a><\/p>\n<p>We look forward to hearing from you. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Following on from our blog post a couple months ago: Microsoft\u2019s Agentic AI Frameworks: AutoGen and Semantic Kernel, Microsoft\u2019s agentic AI story is evolving at a steady pace. Both Azure AI Foundry\u2019s Semantic Kernel and AI Frontier\u2019s AutoGen are designed to empower developers to build advanced multi-agent systems. The AI Frontier\u2019s team is charging ahead [&hellip;]<\/p>\n","protected":false},"author":173663,"featured_media":3718,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[106,9],"class_list":["post-4336","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-semantic-kernel","tag-autogen","tag-semantic-kernel"],"acf":[],"blog_post_summary":"<p>Following on from our blog post a couple months ago: Microsoft\u2019s Agentic AI Frameworks: AutoGen and Semantic Kernel, Microsoft\u2019s agentic AI story is evolving at a steady pace. Both Azure AI Foundry\u2019s Semantic Kernel and AI Frontier\u2019s AutoGen are designed to empower developers to build advanced multi-agent systems. The AI Frontier\u2019s team is charging ahead [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/4336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/users\/173663"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/comments?post=4336"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/4336\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media\/3718"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media?parent=4336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/categories?post=4336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/tags?post=4336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}