Skip to content

Commit 7db93a7

Browse files
Copilotsunbrye
andauthored
Add Copilot SDK Integrations map category and Microsoft Agent Framework article (#60448)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sunbrye <56200261+sunbrye@users.noreply.github.com> Co-authored-by: sunbrye <sunbrye@github.com>
1 parent 8d76521 commit 7db93a7

3 files changed

Lines changed: 333 additions & 0 deletions

File tree

content/copilot/how-tos/copilot-sdk/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ children:
1111
- /use-copilot-sdk
1212
- /use-hooks
1313
- /observability
14+
- /integrations
1415
- /troubleshooting
1516
contentType: how-tos
1617
---
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Copilot SDK integrations
3+
shortTitle: Integrations
4+
intro: Integrate {% data variables.copilot.copilot_sdk_short %} with third-party agent frameworks and orchestration platforms.
5+
versions:
6+
feature: copilot
7+
contentType: how-tos
8+
children:
9+
- /microsoft-agent-framework
10+
---
Lines changed: 322 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,322 @@
1+
---
2+
title: Microsoft Agent Framework integration
3+
shortTitle: Microsoft Agent Framework
4+
intro: Use {% data variables.copilot.copilot_sdk_short %} as an agent provider inside the Microsoft Agent Framework to build and orchestrate multi-agent workflows alongside other AI providers.
5+
versions:
6+
feature: copilot
7+
product: '{% data reusables.gated-features.copilot-sdk %}'
8+
contentType: how-tos
9+
---
10+
11+
> [!NOTE]
12+
> {% data variables.copilot.copilot_sdk_short %} is currently in {% data variables.release-phases.technical_preview %}. Functionality and availability are subject to change.
13+
14+
Use {% data variables.copilot.copilot_sdk_short %} as an agent provider inside the [Microsoft Agent Framework](https://devblogs.microsoft.com/semantic-kernel/build-ai-agents-with-github-copilot-sdk-and-microsoft-agent-framework/) (MAF) to compose multi-agent workflows alongside Azure OpenAI, Anthropic, and other providers.
15+
16+
## Overview
17+
18+
The Microsoft Agent Framework is the unified successor to Semantic Kernel and AutoGen. It provides a standard interface for building, orchestrating, and deploying AI agents. Dedicated integration packages let you wrap a {% data variables.copilot.copilot_sdk_short %} client as a first-class MAF agent—interchangeable with any other agent provider in the framework.
19+
20+
| Concept | Description |
21+
|---------|-------------|
22+
| Microsoft Agent Framework | Open-source framework for single- and multi-agent orchestration in .NET and Python |
23+
| Agent provider | A backend that powers an agent (Copilot, Azure OpenAI, Anthropic, etc.) |
24+
| Orchestrator | A MAF component that coordinates agents in sequential, concurrent, or handoff workflows |
25+
| A2A protocol | Agent-to-Agent communication standard supported by the framework |
26+
27+
> [!NOTE]
28+
> MAF integration packages are available for .NET and Python. For TypeScript and Go, use the {% data variables.copilot.copilot_sdk_short %} directly—the standard SDK APIs provide tool calling, streaming, and custom agents.
29+
30+
## Prerequisites
31+
32+
Before you begin, make sure you have:
33+
34+
* A working {% data variables.copilot.copilot_sdk_short %} setup in your language of choice. See [AUTOTITLE](/copilot/how-tos/copilot-sdk/sdk-getting-started).
35+
* A {% data variables.product.prodname_copilot %} subscription (Individual, Business, or Enterprise).
36+
* {% data variables.copilot.copilot_cli_short %} installed or available via the SDK's bundled CLI.
37+
38+
## Installation
39+
40+
Install the {% data variables.copilot.copilot_sdk_short %} alongside the MAF integration package:
41+
42+
```shell
43+
dotnet add package GitHub.Copilot.SDK
44+
dotnet add package Microsoft.Agents.AI.GitHub.Copilot --prerelease
45+
```
46+
47+
For examples in Python, see the [`microsoft-agent-framework`](https://github.com/github/copilot-sdk/blob/main/docs/integrations/microsoft-agent-framework.md) article in the `github/copilot-sdk` repository.
48+
49+
## Basic usage
50+
51+
Wrap the {% data variables.copilot.copilot_sdk_short %} client as a MAF agent with a single method call. The resulting agent conforms to the framework's standard interface and can be used anywhere a MAF agent is expected.
52+
53+
```csharp
54+
using GitHub.Copilot.SDK;
55+
using Microsoft.Agents.AI;
56+
57+
await using var copilotClient = new CopilotClient();
58+
await copilotClient.StartAsync();
59+
60+
// Wrap as a MAF agent
61+
AIAgent agent = copilotClient.AsAIAgent();
62+
63+
// Use the standard MAF interface
64+
string response = await agent.RunAsync("Explain how dependency injection works in ASP.NET Core");
65+
Console.WriteLine(response);
66+
```
67+
68+
For examples in Python, see the [`microsoft-agent-framework`](https://github.com/github/copilot-sdk/blob/main/docs/integrations/microsoft-agent-framework.md) article in the `github/copilot-sdk` repository.
69+
70+
## Adding custom tools
71+
72+
Extend your {% data variables.product.prodname_copilot_short %} agent with custom function tools. Tools defined through the standard {% data variables.copilot.copilot_sdk_short %} are automatically available when the agent runs inside MAF.
73+
74+
```csharp
75+
using GitHub.Copilot.SDK;
76+
using Microsoft.Extensions.AI;
77+
using Microsoft.Agents.AI;
78+
79+
// Define a custom tool
80+
AIFunction weatherTool = AIFunctionFactory.Create(
81+
(string location) => $"The weather in {location} is sunny with a high of 25°C.",
82+
"GetWeather",
83+
"Get the current weather for a given location."
84+
);
85+
86+
await using var copilotClient = new CopilotClient();
87+
await copilotClient.StartAsync();
88+
89+
// Create agent with tools
90+
AIAgent agent = copilotClient.AsAIAgent(new AIAgentOptions
91+
{
92+
Tools = new[] { weatherTool },
93+
});
94+
95+
string response = await agent.RunAsync("What's the weather like in Seattle?");
96+
Console.WriteLine(response);
97+
```
98+
99+
You can also use the {% data variables.copilot.copilot_sdk_short %}'s native tool definition alongside MAF tools:
100+
101+
```typescript
102+
import { CopilotClient, DefineTool } from "@github/copilot-sdk";
103+
104+
const getWeather = DefineTool({
105+
name: "GetWeather",
106+
description: "Get the current weather for a given location.",
107+
parameters: { location: { type: "string", description: "City name" } },
108+
execute: async ({ location }) => `The weather in ${location} is sunny, 25°C.`,
109+
});
110+
111+
const client = new CopilotClient();
112+
const session = await client.createSession({
113+
model: "gpt-4.1",
114+
tools: [getWeather],
115+
onPermissionRequest: async () => ({ kind: "approved" }),
116+
});
117+
118+
await session.sendAndWait({ prompt: "What's the weather like in Seattle?" });
119+
```
120+
121+
> [!WARNING]
122+
> Setting `onPermissionRequest` to always return `{ kind: "approved" }` can allow prompt injections without approval. For production use, implement policy-based approval that evaluates the requested tool and its parameters before granting permission.
123+
124+
For examples in Python, see the [`microsoft-agent-framework`](https://github.com/github/copilot-sdk/blob/main/docs/integrations/microsoft-agent-framework.md) article in the `github/copilot-sdk` repository.
125+
126+
## Multi-agent workflows
127+
128+
The primary benefit of MAF integration is composing {% data variables.product.prodname_copilot_short %} alongside other agent providers in orchestrated workflows. Use the framework's built-in orchestrators to create pipelines where different agents handle different steps.
129+
130+
### Sequential workflow
131+
132+
Run agents one after another, passing output from one to the next:
133+
134+
```csharp
135+
using GitHub.Copilot.SDK;
136+
using Microsoft.Agents.AI;
137+
using Microsoft.Agents.AI.Orchestration;
138+
139+
await using var copilotClient = new CopilotClient();
140+
await copilotClient.StartAsync();
141+
142+
// Copilot agent for code review
143+
AIAgent reviewer = copilotClient.AsAIAgent(new AIAgentOptions
144+
{
145+
Instructions = "You review code for bugs, security issues, and best practices. Be thorough.",
146+
});
147+
148+
// Azure OpenAI agent for generating documentation
149+
AIAgent documentor = AIAgent.FromOpenAI(new OpenAIAgentOptions
150+
{
151+
Model = "gpt-4.1",
152+
Instructions = "You write clear, concise documentation for code changes.",
153+
});
154+
155+
// Compose in a sequential pipeline
156+
var pipeline = new SequentialOrchestrator(new[] { reviewer, documentor });
157+
158+
string result = await pipeline.RunAsync(
159+
"Review and document this pull request: added retry logic to the HTTP client"
160+
);
161+
Console.WriteLine(result);
162+
```
163+
164+
For examples in Python, see the [`microsoft-agent-framework`](https://github.com/github/copilot-sdk/blob/main/docs/integrations/microsoft-agent-framework.md) article in the `github/copilot-sdk` repository.
165+
166+
### Concurrent workflow
167+
168+
Run multiple agents in parallel and aggregate their results:
169+
170+
```csharp
171+
using GitHub.Copilot.SDK;
172+
using Microsoft.Agents.AI;
173+
using Microsoft.Agents.AI.Orchestration;
174+
175+
await using var copilotClient = new CopilotClient();
176+
await copilotClient.StartAsync();
177+
178+
AIAgent securityReviewer = copilotClient.AsAIAgent(new AIAgentOptions
179+
{
180+
Instructions = "Focus exclusively on security vulnerabilities and risks.",
181+
});
182+
183+
AIAgent performanceReviewer = copilotClient.AsAIAgent(new AIAgentOptions
184+
{
185+
Instructions = "Focus exclusively on performance bottlenecks and optimization opportunities.",
186+
});
187+
188+
// Run both reviews concurrently
189+
var concurrent = new ConcurrentOrchestrator(new[] { securityReviewer, performanceReviewer });
190+
191+
string combinedResult = await concurrent.RunAsync(
192+
"Analyze this database query module for issues"
193+
);
194+
Console.WriteLine(combinedResult);
195+
```
196+
197+
## Streaming responses
198+
199+
When building interactive applications, stream agent responses to show real-time output. The MAF integration preserves the {% data variables.copilot.copilot_sdk_short %}'s streaming capabilities.
200+
201+
```csharp
202+
using GitHub.Copilot.SDK;
203+
using Microsoft.Agents.AI;
204+
205+
await using var copilotClient = new CopilotClient();
206+
await copilotClient.StartAsync();
207+
208+
AIAgent agent = copilotClient.AsAIAgent(new AIAgentOptions
209+
{
210+
Streaming = true,
211+
});
212+
213+
await foreach (var chunk in agent.RunStreamingAsync("Write a quicksort implementation in C#"))
214+
{
215+
Console.Write(chunk);
216+
}
217+
Console.WriteLine();
218+
```
219+
220+
You can also stream directly through the {% data variables.copilot.copilot_sdk_short %} without MAF:
221+
222+
```typescript
223+
import { CopilotClient } from "@github/copilot-sdk";
224+
225+
const client = new CopilotClient();
226+
const session = await client.createSession({
227+
model: "gpt-4.1",
228+
streaming: true,
229+
onPermissionRequest: async () => ({ kind: "approved" }),
230+
});
231+
232+
session.on("assistant.message_delta", (event) => {
233+
process.stdout.write(event.data.delta ?? "");
234+
});
235+
236+
await session.sendAndWait({ prompt: "Write a quicksort implementation in TypeScript" });
237+
```
238+
239+
For examples in Python, see the [`microsoft-agent-framework`](https://github.com/github/copilot-sdk/blob/main/docs/integrations/microsoft-agent-framework.md) article in the `github/copilot-sdk` repository.
240+
241+
## Configuration reference
242+
243+
### MAF agent options
244+
245+
| Property | Type | Description |
246+
|----------------|------------------|-------------|
247+
| `Instructions` | string | System prompt for the agent |
248+
| `Tools` | AIFunction[] or list | Custom function tools available to the agent |
249+
| `Streaming` | bool | Enable streaming responses |
250+
| `Model` | string | Override the default model |
251+
252+
### Copilot SDK options (passed through)
253+
254+
All standard `SessionConfig` options are available when creating the underlying {% data variables.product.prodname_copilot_short %} client. The MAF wrapper delegates to the SDK under the hood.
255+
256+
| SDK feature | MAF support |
257+
|-----------------------------------------------------|-------------|
258+
| Custom tools (`DefineTool` and `AIFunctionFactory`) | Merged with MAF tools |
259+
| MCP servers | Configured on the SDK client |
260+
| Custom agents and sub-agents | Available within the Copilot agent |
261+
| Infinite sessions | Configured on the SDK client |
262+
| Model selection | Overridable per agent or per call |
263+
| Streaming | Full delta event support |
264+
265+
## Best practices
266+
267+
### Choose the right level of integration
268+
269+
Use the MAF wrapper when you need to compose {% data variables.product.prodname_copilot_short %} with other providers in orchestrated workflows. If your application only uses {% data variables.product.prodname_copilot_short %}, the standalone SDK is simpler and gives you full control:
270+
271+
```typescript
272+
// Standalone SDK — full control, simpler setup
273+
import { CopilotClient } from "@github/copilot-sdk";
274+
275+
const client = new CopilotClient();
276+
const session = await client.createSession({
277+
model: "gpt-4.1",
278+
onPermissionRequest: async () => ({ kind: "approved" }),
279+
});
280+
const response = await session.sendAndWait({ prompt: "Explain this code" });
281+
```
282+
283+
### Keep agents focused
284+
285+
When building multi-agent workflows, give each agent a specific role with clear instructions. Avoid overlapping responsibilities:
286+
287+
```typescript
288+
// Too vague — overlapping roles
289+
const agents = [
290+
{ instructions: "Help with code" },
291+
{ instructions: "Assist with programming" },
292+
];
293+
294+
// Focused — clear separation of concerns
295+
const agents = [
296+
{ instructions: "Review code for security vulnerabilities. Flag SQL injection, XSS, and auth issues." },
297+
{ instructions: "Optimize code performance. Focus on algorithmic complexity and memory usage." },
298+
];
299+
```
300+
301+
### Handle errors at the orchestration level
302+
303+
Wrap agent calls in error handling, especially in multi-agent workflows where one agent's failure shouldn't block the entire pipeline:
304+
305+
```csharp
306+
try
307+
{
308+
string result = await pipeline.RunAsync("Analyze this module");
309+
Console.WriteLine(result);
310+
}
311+
catch (AgentException ex)
312+
{
313+
Console.Error.WriteLine($"Agent {ex.AgentName} failed: {ex.Message}");
314+
// Fall back to single-agent mode or retry
315+
}
316+
```
317+
318+
## Further reading
319+
320+
* [AUTOTITLE](/copilot/how-tos/copilot-sdk/sdk-getting-started)
321+
* [Microsoft Agent Framework documentation](https://learn.microsoft.com/en-us/agent-framework/agents/providers/github-copilot)
322+
* [Blog: Build AI Agents with GitHub Copilot SDK and Microsoft Agent Framework](https://devblogs.microsoft.com/semantic-kernel/build-ai-agents-with-github-copilot-sdk-and-microsoft-agent-framework/)

0 commit comments

Comments
 (0)