GitHub Copilot SDK Meets Agent Framework: Building Multi-Agent Orchestration Systems

GitHub Copilot SDK Meets Agent Framework: Building Multi-Agent Orchestration Systems

Microsoft Agent Framework now integrates with the GitHub Copilot SDK, enabling you to build AI agents powered by GitHub Copilot. This integration brings together the Agent Framework's consistent agent abstraction with GitHub Copilot's capabilities, including function calling, streaming responses, multi-turn conversations, shell command execution, file operations, URL fetching, and Model Context Protocol (MCP) server integration.


Why Use Agent Framework with GitHub Copilot SDK?

You can use the GitHub Copilot SDK on its own to build agents. So why use it through Agent Framework? Here are the key reasons:

  • Consistent agent abstraction — GitHub Copilot 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 GitHub Copilot agents with other agents (Azure OpenAI, OpenAI, Anthropic, 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 GitHub Copilot as one building block in a larger agentic system rather than a standalone tool.


Install the GitHub Copilot Integration

pip install agent-framework-github-copilot --pre
        

Create a GitHub Copilot Agent

Getting started is straightforward. Create a GitHubCopilotAgent and start interacting with the agent.

from agent_framework.github import GitHubCopilotAgent

async def main():
    agent = GitHubCopilotAgent(
        default_options={
            "instructions": """
You are a senior Python engineer.
1. Find Python files using asyncio.get_event_loop().
2. Refactor them to asyncio.run().
3. Update README files if mentioned.
4. Run tests and summarize failures.
""",
        }
    )

    async with agent:
        result = await agent.run(
            "Please refactor the repo and validate the changes."
        )
        print(result)        

Connect MCP Servers

GitHub Copilot agents support connecting to local (stdio) and remote (HTTP) MCP servers, giving the agent access to external tools and data sources.

from agent_framework.github import GitHubCopilotAgent

mcp_servers = {
    "filesystem": {
        "type": "stdio",
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
        "tools": ["*"],
    },
    "microsoft-learn": {
        "type": "http",
        "url": "https://learn.microsoft.com/api/mcp",
        "tools": ["*"],
    },
}

agent = GitHubCopilotAgent(
    default_options={
        "instructions": "You are a helpful assistant.",
        "mcp_servers": mcp_servers,
    },
)
        

Use GitHub Copilot in a Multi-Agent Workflow

One of the key benefits of using Agent Framework is the ability to combine GitHub Copilot with other agents in a multi-agent workflow. In this example, an Azure OpenAI agent drafts a marketing tagline and a GitHub Copilot agent reviews it — all orchestrated as a sequential pipeline.

import asyncio
from typing import cast

from agent_framework import ChatMessage, Role, SequentialBuilder, WorkflowOutputEvent
from agent_framework.azure import AzureOpenAIChatClient
from agent_framework.github import GitHubCopilotAgent
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.",
        name="writer",
    )

    # Create a GitHub Copilot agent as a reviewer
    reviewer = GitHubCopilotAgent(
        default_options={"instructions": "You are a thoughtful reviewer."},
        name="reviewer",
    )

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

    # Execute the workflow
    async for event in workflow.run_stream("Write a tagline for an AI product"):
        if isinstance(event, WorkflowOutputEvent):
            messages = cast(list[ChatMessage], event.data)
            for msg in messages:
                name = msg.author_name or "assistant"
                print(f"[{name}]: {msg.text}")

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 GitHub Copilot SDK integration for Microsoft Agent Framework makes it easy to build AI agents that leverage GitHub Copilot's capabilities. With support for function tools, streaming, multi-turn conversations, permissions, and MCP servers, you can build powerful agentic applications that interact with code, files, shell commands, and external services.

To view or add a comment, sign in

Others also viewed

Explore content categories