{"id":5116,"date":"2026-01-30T11:21:49","date_gmt":"2026-01-30T19:21:49","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/semantic-kernel\/?p=5116"},"modified":"2026-01-30T11:22:28","modified_gmt":"2026-01-30T19:22:28","slug":"build-ai-agents-with-claude-agent-sdk-and-microsoft-agent-framework","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/agent-framework\/build-ai-agents-with-claude-agent-sdk-and-microsoft-agent-framework\/","title":{"rendered":"Build AI Agents with Claude Agent SDK and Microsoft Agent Framework"},"content":{"rendered":"<p>Microsoft Agent Framework now integrates with the <a href=\"https:\/\/github.com\/anthropics\/claude-agent-sdk-python\">Claude Agent SDK<\/a>, enabling you to build AI agents powered by Claude&#8217;s full agentic capabilities. This integration brings together the Agent Framework&#8217;s consistent agent abstraction with Claude&#8217;s powerful features, including file editing, code execution, function calling, streaming responses, multi-turn conversations, and Model Context Protocol (MCP) server integration \u2014 available in Python.<\/p>\n<h2><strong>Why Use Agent Framework with Claude Agent SDK?<\/strong><\/h2>\n<p>You can use the Claude Agent SDK on its own to build agents. So why use it through Agent Framework? Here are the key reasons:<\/p>\n<ul>\n<li><strong>Consistent agent abstraction<\/strong> \u2014 Claude agents implement the same <code>BaseAgent<\/code> interface as every other agent type in the framework. You can swap providers or combine them without restructuring your code.<\/li>\n<li><strong>Multi-agent workflows<\/strong> \u2014 Compose Claude agents with other agents (Azure OpenAI, OpenAI, GitHub Copilot, and more) in sequential, concurrent, handoff, and group chat workflows using built-in orchestrators.<\/li>\n<li><strong>Ecosystem integration<\/strong> \u2014 Access the full Agent Framework ecosystem: declarative agent definitions, A2A protocol support, and consistent patterns for function tools, sessions, and streaming across all providers.<\/li>\n<\/ul>\n<p>In short, Agent Framework lets you treat Claude as one building block in a larger agentic system rather than a standalone tool.<\/p>\n<h2><strong>Install the Claude Agent SDK Integration<\/strong><\/h2>\n<p><strong>Python<\/strong><\/p>\n<pre><code>pip install agent-framework-claude --pre<\/code><\/pre>\n<h2><strong>Create a Claude Agent<\/strong><\/h2>\n<p>Getting started is straightforward. Create a <code>ClaudeAgent<\/code> and start interacting with it using the async context manager pattern.<\/p>\n<p><strong>Python<\/strong><\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">from agent_framework_claude import ClaudeAgent\r\n\r\nasync def main():\r\n    async with ClaudeAgent(\r\n        instructions=\"You are a helpful assistant.\",\r\n    ) as agent:\r\n        response = await agent.run(\"What is Microsoft Agent Framework?\")\r\n        print(response.text)<\/code><\/pre>\n<h2><strong>Use Built-in Tools<\/strong><\/h2>\n<p>Claude Agent SDK provides access to powerful built-in tools for file operations, shell commands, and more. Simply pass tool names as strings to enable them.<\/p>\n<p><strong>Python<\/strong><\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">from agent_framework_claude import ClaudeAgent\r\n\r\nasync def main():\r\n    async with ClaudeAgent(\r\n        instructions=\"You are a helpful coding assistant.\",\r\n        tools=[\"Read\", \"Write\", \"Bash\", \"Glob\"],\r\n    ) as agent:\r\n        response = await agent.run(\"List all Python files in the current directory\")\r\n        print(response.text)<\/code><\/pre>\n<h2><strong>Add Function Tools<\/strong><\/h2>\n<p>Extend your agent with custom function tools to give it domain-specific capabilities.<\/p>\n<p><strong>Python<\/strong><\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">from typing import Annotated\r\nfrom pydantic import Field\r\nfrom agent_framework_claude import ClaudeAgent\r\n\r\ndef get_weather(\r\n    location: Annotated[str, Field(description=\"The location to get the weather for.\")],\r\n) -&gt; str:\r\n    \"\"\"Get the weather for a given location.\"\"\"\r\n    return f\"The weather in {location} is sunny with a high of 25C.\"\r\n\r\nasync def main():\r\n    async with ClaudeAgent(\r\n        instructions=\"You are a helpful weather agent.\",\r\n        tools=[get_weather],\r\n    ) as agent:\r\n        response = await agent.run(\"What's the weather like in Seattle?\")\r\n        print(response.text)<\/code><\/pre>\n<h2><strong>Stream Responses<\/strong><\/h2>\n<p>For a better user experience, you can stream responses as they are generated instead of waiting for the complete result.<\/p>\n<p><strong>Python<\/strong><\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">from agent_framework_claude import ClaudeAgent\r\n\r\nasync def main():\r\n    async with ClaudeAgent(\r\n        instructions=\"You are a helpful assistant.\",\r\n    ) as agent:\r\n        print(\"Agent: \", end=\"\", flush=True)\r\n        async for chunk in agent.run_stream(\"Tell me a short story.\"):\r\n            if chunk.text:\r\n                print(chunk.text, end=\"\", flush=True)\r\n        print()<\/code><\/pre>\n<h2><strong>Multi-Turn Conversations<\/strong><\/h2>\n<p>Maintain conversation context across multiple interactions using threads. The Claude Agent SDK automatically manages session resumption to preserve context.<\/p>\n<p><strong>Python<\/strong><\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">from agent_framework_claude import ClaudeAgent\r\n\r\nasync def main():\r\n    async with ClaudeAgent(\r\n        instructions=\"You are a helpful assistant. Keep your answers short.\",\r\n    ) as agent:\r\n        thread = agent.get_new_thread()\r\n\r\n        # First turn\r\n        await agent.run(\"My name is Alice.\", thread=thread)\r\n\r\n        # Second turn - agent remembers the context\r\n        response = await agent.run(\"What is my name?\", thread=thread)\r\n        print(response.text)  # Should mention \"Alice\"<\/code><\/pre>\n<h2><strong>Configure Permission Modes<\/strong><\/h2>\n<p>Control how the agent handles permission requests for file operations and command execution using permission modes.<\/p>\n<p><strong>Python<\/strong><\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">from agent_framework_claude import ClaudeAgent\r\n\r\nasync def main():\r\n    async with ClaudeAgent(\r\n        instructions=\"You are a coding assistant that can edit files.\",\r\n        tools=[\"Read\", \"Write\", \"Bash\"],\r\n        default_options={\r\n            \"permission_mode\": \"acceptEdits\",  # Auto-accept file edits\r\n        },\r\n    ) as agent:\r\n        response = await agent.run(\"Create a hello.py file that prints 'Hello, World!'\")\r\n        print(response.text)<\/code><\/pre>\n<h2><strong>Connect MCP Servers<\/strong><\/h2>\n<p>Claude agents support connecting to external MCP servers, giving the agent access to additional tools and data sources.<\/p>\n<p><strong>Python<\/strong><\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">from agent_framework_claude import ClaudeAgent\r\n\r\nasync def main():\r\n    async with ClaudeAgent(\r\n        instructions=\"You are a helpful assistant with access to the filesystem.\",\r\n        default_options={\r\n            \"mcp_servers\": {\r\n                \"filesystem\": {\r\n                    \"command\": \"npx\",\r\n                    \"args\": [\"-y\", \"@modelcontextprotocol\/server-filesystem\", \".\"],\r\n                },\r\n            },\r\n        },\r\n    ) as agent:\r\n        response = await agent.run(\"List all files in the current directory using MCP\")\r\n        print(response.text)<\/code><\/pre>\n<h2><strong>Use Claude in a Multi-Agent Workflow<\/strong><\/h2>\n<p>One of the key benefits of using Agent Framework is the ability to combine Claude with other agents in a multi-agent workflow. In this example, an Azure OpenAI agent drafts a marketing tagline and a Claude agent reviews it \u2014 all orchestrated as a sequential pipeline.<\/p>\n<p><strong>Python<\/strong><\/p>\n<pre class=\"prettyprint language-py\"><code class=\"language-py\">import asyncio\r\nfrom typing import cast\r\n\r\nfrom agent_framework import ChatMessage, Role, SequentialBuilder, WorkflowOutputEvent\r\nfrom agent_framework.azure import AzureOpenAIChatClient\r\nfrom agent_framework_claude import ClaudeAgent\r\nfrom azure.identity import AzureCliCredential\r\n\r\nasync def main():\r\n    # Create an Azure OpenAI agent as a copywriter\r\n    chat_client = AzureOpenAIChatClient(credential=AzureCliCredential())\r\n\r\n    writer = chat_client.as_agent(\r\n        instructions=\"You are a concise copywriter. Provide a single, punchy marketing sentence based on the prompt.\",\r\n        name=\"writer\",\r\n    )\r\n\r\n    # Create a Claude agent as a reviewer\r\n    reviewer = ClaudeAgent(\r\n        instructions=\"You are a thoughtful reviewer. Give brief feedback on the previous assistant message.\",\r\n        name=\"reviewer\",\r\n    )\r\n\r\n    # Build a sequential workflow: writer -&gt; reviewer\r\n    workflow = SequentialBuilder().participants([writer, reviewer]).build()\r\n\r\n    # Run the workflow\r\n    async for event in workflow.run_stream(\"Write a tagline for a budget-friendly electric bike.\"):\r\n        if isinstance(event, WorkflowOutputEvent):\r\n            messages = cast(list[ChatMessage], event.data)\r\n            for msg in messages:\r\n                name = msg.author_name or (\"assistant\" if msg.role == Role.ASSISTANT else \"user\")\r\n                print(f\"[{name}]: {msg.text}\\n\")\r\n\r\nasyncio.run(main())<\/code><\/pre>\n<p>This example shows how a single workflow can combine agents from different providers. You can extend this pattern to concurrent, handoff, and group chat workflows as well.<\/p>\n<h2><strong>More Information<\/strong><\/h2>\n<ul>\n<li><a href=\"https:\/\/github.com\/anthropics\/claude-agent-sdk-python\">Claude Agent SDK<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/microsoft\/agent-framework\">Microsoft Agent Framework on GitHub<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/agent-framework\/tutorials\/overview\">Agent Framework Getting Started Tutorials<\/a><\/li>\n<\/ul>\n<h2><strong>Summary<\/strong><\/h2>\n<p>The Claude Agent SDK integration for Microsoft Agent Framework makes it easy to build AI agents that leverage Claude&#8217;s full agentic capabilities. With support for built-in tools, function tools, streaming, multi-turn conversations, permission modes, and MCP servers in Python, you can build powerful agentic applications that interact with code, files, shell commands, and external services.<\/p>\n<p>We&#8217;re always interested in hearing from you. If you have feedback, questions or want to discuss further, feel free to reach out to us and the community on the <a href=\"https:\/\/github.com\/microsoft\/agent-framework\/discussions\">discussion boards<\/a> on GitHub! We would also love your support, if you&#8217;ve enjoyed using Agent Framework, give us a star on <a href=\"https:\/\/github.com\/microsoft\/agent-framework\">GitHub<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Microsoft Agent Framework now integrates with the Claude Agent SDK, enabling you to build AI agents powered by Claude&#8217;s full agentic capabilities. This integration brings together the Agent Framework&#8217;s consistent agent abstraction with Claude&#8217;s powerful features, including file editing, code execution, function calling, streaming responses, multi-turn conversations, and Model Context Protocol (MCP) server integration \u2014 [&hellip;]<\/p>\n","protected":false},"author":156732,"featured_media":5048,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[143,47,34],"tags":[],"class_list":["post-5116","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-agent-framework","category-announcement","category-python-2"],"acf":[],"blog_post_summary":"<p>Microsoft Agent Framework now integrates with the Claude Agent SDK, enabling you to build AI agents powered by Claude&#8217;s full agentic capabilities. This integration brings together the Agent Framework&#8217;s consistent agent abstraction with Claude&#8217;s powerful features, including file editing, code execution, function calling, streaming responses, multi-turn conversations, and Model Context Protocol (MCP) server integration \u2014 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/5116","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\/156732"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/comments?post=5116"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/5116\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media\/5048"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media?parent=5116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/categories?post=5116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/tags?post=5116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}