⚠️ This blog post was created with the help of AI tools. Yes, I used a bit of magic from language models to organize my thoughts and automate the boring parts, but the geeky fun and the 🤖 in C# are 100% mine.

GitHub Copilot just crossed a very interesting line.

It’s no longer “just” helping you write code — it can now run as an agent, with goals, tools, and autonomy, using Microsoft Agent Framework (MAF).

🎥 Watch the full video here:

In the video, I walk through three simple C# samples showing how Copilot can be used as an agent, not just a coding assistant.


From autocomplete to autonomy

The mental model shift is simple:

  • ❌ Copilot as a tool → prompt → suggestion
  • ✅ Copilot as an agent → goal → plan → act

With Microsoft Agent Framework, GitHub Copilot becomes part of your agent runtime, not just your editor UI.


Sample 1 – Creating a Copilot-backed agent

At its core, you define an agent and tell it what it is allowed to do.

using GitHub.Copilot.SDK;
using Microsoft.Agents.AI;
await using CopilotClient copilotClient = new();
await copilotClient.StartAsync();
AIAgent agent = copilotClient.AsAIAgent(
instructions: "You are a helpful agent.");

No hacks.
No wrappers.
This agent is powered directly by GitHub Copilot.


Sample 2 – Giving the agent a goal

Instead of prompting, you assign tasks.

await agent.RunAsync("""
Review this C# project and explain what it does.
Focus on architecture and main responsibilities.
""");

This is where Copilot stops responding and starts working.


Sample 3 – Applying it to real dev workflows

In the video, I show how the same agent can be used for things like:

  • Understanding unfamiliar repositories
  • Explaining legacy code
  • Supporting real developer workflows
await agent.RunAsync("""
Analyze this repository and suggest improvements.
Create a summary suitable for a pull request description.
Run the analisys using CODEX and OPUS.
""");

This feels much closer to a junior developer teammate than a chat window.


Why this matters for .NET developers

If you’re building in C# today:

  • You already know GitHub Copilot
  • You already write .NET services
  • You already work with repositories and PRs

Microsoft Agent Framework + Copilot is the shortest path from AI ideas to real systems.


Resources

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.

More info in https://beacons.ai/elbruno


6 responses to “Building GitHub Copilot Agents in C# with Microsoft Agent Framework”

  1. shrayrastogi Avatar
    shrayrastogi

    El Bruno, the MAF and Copilot SDK integration still does not support workflows which are an important feature of MAF? Any thoughts on this?

    Like

  2. shrayrastogi Avatar
    shrayrastogi

    Workflows are still not supported by GitHub Copilot provider in MAF, any thoughts on this since workflows are USP of MAF and very useful in multi agent orchestration scenarios.

    Like

    1. Hi
      Are you planning to use a Copilot SDK Agent in a workflow with MAF?
      Is that the scenario that you are targeting?

      Like

      1. shrayrastogi Avatar
        shrayrastogi

        yes, copilot Sdk currently supports inference based orchestration only for Multi agent systems. Hence , I was combining it with MAF to have deterministic workflows. I have traced it down to the GitHubCopilotAgent implementation in MAF which currently does not use AgentRunOptions while creating session config. Something, I believe should be coming up in future.

        Like

        1. shrayrastogi Avatar
          shrayrastogi

          this is because that’s how handoff workflow is built in MAF which uses AI Function Factory tool calls while sequential workflow works with copilot Sdk.

          Like

Leave a comment

Discover more from El Bruno

Subscribe now to keep reading and get access to the full archive.

Continue reading