January 30th, 2026
0 reactions

Build AI Agents with Claude Agent SDK and Microsoft Agent Framework

Dmytro Struk
Senior Software Engineer

Microsoft Agent Framework now integrates with the Claude Agent SDK, enabling you to build AI agents powered by Claude’s full agentic capabilities. This integration brings together the Agent Framework’s consistent agent abstraction with Claude’s powerful features, including file editing, code execution, function calling, streaming responses, multi-turn conversations, and Model Context Protocol (MCP) server integration — available in Python.

Why Use Agent Framework with Claude Agent SDK?

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:

  • Consistent agent abstraction — Claude agents implement the same BaseAgent interface as every other agent type in the framework. You can swap providers or combine them without restructuring your code.
  • Multi-agent workflows — 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.
  • Ecosystem integration — Access the full Agent Framework ecosystem: declarative agent definitions, A2A protocol support, and consistent patterns for function tools, sessions, and streaming across all providers.

In short, Agent Framework lets you treat Claude as one building block in a larger agentic system rather than a standalone tool.

Install the Claude Agent SDK Integration

Python

pip install agent-framework-claude --pre

Create a Claude Agent

Getting started is straightforward. Create a ClaudeAgent and start interacting with it using the async context manager pattern.

Python

from agent_framework_claude import ClaudeAgent

async def main():
    async with ClaudeAgent(
        instructions="You are a helpful assistant.",
    ) as agent:
        response = await agent.run("What is Microsoft Agent Framework?")
        print(response.text)

Use Built-in Tools

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.

Python

from agent_framework_claude import ClaudeAgent

async def main():
    async with ClaudeAgent(
        instructions="You are a helpful coding assistant.",
        tools=["Read", "Write", "Bash", "Glob"],
    ) as agent:
        response = await agent.run("List all Python files in the current directory")
        print(response.text)

Add Function Tools

Extend your agent with custom function tools to give it domain-specific capabilities.

Python

from typing import Annotated
from pydantic import Field
from agent_framework_claude import ClaudeAgent

def get_weather(
    location: Annotated[str, Field(description="The location to get the weather for.")],
) -> str:
    """Get the weather for a given location."""
    return f"The weather in {location} is sunny with a high of 25C."

async def main():
    async with ClaudeAgent(
        instructions="You are a helpful weather agent.",
        tools=[get_weather],
    ) as agent:
        response = await agent.run("What's the weather like in Seattle?")
        print(response.text)

Stream Responses

For a better user experience, you can stream responses as they are generated instead of waiting for the complete result.

Python

from agent_framework_claude import ClaudeAgent

async def main():
    async with ClaudeAgent(
        instructions="You are a helpful assistant.",
    ) as agent:
        print("Agent: ", end="", flush=True)
        async for chunk in agent.run_stream("Tell me a short story."):
            if chunk.text:
                print(chunk.text, end="", flush=True)
        print()

Multi-Turn Conversations

Maintain conversation context across multiple interactions using threads. The Claude Agent SDK automatically manages session resumption to preserve context.

Python

from agent_framework_claude import ClaudeAgent

async def main():
    async with ClaudeAgent(
        instructions="You are a helpful assistant. Keep your answers short.",
    ) as agent:
        thread = agent.get_new_thread()

        # First turn
        await agent.run("My name is Alice.", thread=thread)

        # Second turn - agent remembers the context
        response = await agent.run("What is my name?", thread=thread)
        print(response.text)  # Should mention "Alice"

Configure Permission Modes

Control how the agent handles permission requests for file operations and command execution using permission modes.

Python

from agent_framework_claude import ClaudeAgent

async def main():
    async with ClaudeAgent(
        instructions="You are a coding assistant that can edit files.",
        tools=["Read", "Write", "Bash"],
        default_options={
            "permission_mode": "acceptEdits",  # Auto-accept file edits
        },
    ) as agent:
        response = await agent.run("Create a hello.py file that prints 'Hello, World!'")
        print(response.text)

Connect MCP Servers

Claude agents support connecting to external MCP servers, giving the agent access to additional tools and data sources.

Python

from agent_framework_claude import ClaudeAgent

async def main():
    async with ClaudeAgent(
        instructions="You are a helpful assistant with access to the filesystem.",
        default_options={
            "mcp_servers": {
                "filesystem": {
                    "command": "npx",
                    "args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
                },
            },
        },
    ) as agent:
        response = await agent.run("List all files in the current directory using MCP")
        print(response.text)

Use Claude in a Multi-Agent Workflow

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 — all orchestrated as a sequential pipeline.

Python

import asyncio
from typing import cast

from agent_framework import ChatMessage, Role, SequentialBuilder, WorkflowOutputEvent
from agent_framework.azure import AzureOpenAIChatClient
from agent_framework_claude import ClaudeAgent
from azure.identity import AzureCliCredential

async def main():
    # Create an Azure OpenAI agent as a copywriter
    chat_client = AzureOpenAIChatClient(credential=AzureCliCredential())

    writer = chat_client.as_agent(
        instructions="You are a concise copywriter. Provide a single, punchy marketing sentence based on the prompt.",
        name="writer",
    )

    # Create a Claude agent as a reviewer
    reviewer = ClaudeAgent(
        instructions="You are a thoughtful reviewer. Give brief feedback on the previous assistant message.",
        name="reviewer",
    )

    # Build a sequential workflow: writer -> reviewer
    workflow = SequentialBuilder().participants([writer, reviewer]).build()

    # Run the workflow
    async for event in workflow.run_stream("Write a tagline for a budget-friendly electric bike."):
        if isinstance(event, WorkflowOutputEvent):
            messages = cast(list[ChatMessage], event.data)
            for msg in messages:
                name = msg.author_name or ("assistant" if msg.role == Role.ASSISTANT else "user")
                print(f"[{name}]: {msg.text}\n")

asyncio.run(main())

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.

More Information

Summary

The Claude Agent SDK integration for Microsoft Agent Framework makes it easy to build AI agents that leverage Claude’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.

We’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 discussion boards on GitHub! We would also love your support, if you’ve enjoyed using Agent Framework, give us a star on GitHub.

Author

Dmytro Struk
Senior Software Engineer

0 comments