참고
코필로트 SDK가 현재 공개 미리 보기에 있습니다. 기능 및 가용성은 변경될 수 있습니다.
MAF(코필로트 SDK) 내에서 에이전트 공급자로 사용하여 Azure OpenAI, Anthropic 및 기타 공급자와 함께 다중 에이전트 워크플로를 작성합니다.
개요
Microsoft 에이전트 프레임워크는 의미 체계 커널 및 AutoGen의 통합 후속 작업입니다. AI 에이전트를 빌드, 오케스트레이션 및 배포하기 위한 표준 인터페이스를 제공합니다. 전용 통합 패키지를 사용하면 클라이언트를 프레임워크의 코필로트 SDK 다른 에이전트 공급자와 교환할 수 있는 일류 MAF 에이전트로 래핑할 수 있습니다.
| 개념 | 설명 |
|---|---|
| Microsoft 에이전트 프레임워크 | .NET 및 Python에서 단일 및 다중 에이전트 오케스트레이션을 위한 오픈 소스 프레임워크 |
| 에이전트 공급자 | 에이전트를 구동하는 백 엔드(Copilot, Azure OpenAI, Anthropic 등) |
| 오케스트레이터 | 순차, 동시 또는 핸드오프 워크플로에서 에이전트를 조정하는 MAF 구성 요소 |
| A2A 프로토콜 | 프레임워크에서 지원하는 에이전트 간 통신 표준 |
참고
MAF 통합 패키지는 .NET 및 Python에 사용할 수 있습니다. TypeScript와 Go에서는 코필로트 SDK를 직접 사용하세요. 표준 SDK API는 도구 호출, 스트리밍 및 사용자 지정 에이전트를 제공합니다.
사전 요구 사항
시작하기 전에 다음을 확인합니다.
- 선택한 언어로 작동하는 코필로트 SDK 설정입니다. Copilot SDK 사용 시작하기을(를) 참조하세요.
-
GitHub Copilot 구독(개인, 비즈니스 또는 엔터프라이즈). -
코파일럿 CLI SDK의 번들된 CLI를 통해 설치되거나 사용할 수 있습니다.
설치
코필로트 SDK MAF 통합 패키지와 함께 설치합니다.
dotnet add package GitHub.Copilot.SDK
dotnet add package Microsoft.Agents.AI.GitHub.Copilot --prerelease
Python의 예제는 리포지토리의 microsoft-agent-frameworkgithub/copilot-sdk 문서를 참조하세요.
기본 사용법
코필로트 SDK 클라이언트를 단일 메서드 호출로 MAF 에이전트로 래핑합니다. 결과 에이전트는 프레임워크의 표준 인터페이스를 준수하며 MAF 에이전트가 필요한 모든 곳에서 사용할 수 있습니다.
using GitHub.Copilot.SDK;
using Microsoft.Agents.AI;
await using var copilotClient = new CopilotClient();
await copilotClient.StartAsync();
// Wrap as a MAF agent
AIAgent agent = copilotClient.AsAIAgent();
// Use the standard MAF interface
string response = await agent.RunAsync("Explain how dependency injection works in ASP.NET Core");
Console.WriteLine(response);
Python의 예제는 리포지토리의 microsoft-agent-frameworkgithub/copilot-sdk 문서를 참조하세요.
사용자 지정 도구 추가
사용자 지정 함수 도구를 사용하여 에이전트를 확장합니다 Copilot . 표준을 코필로트 SDK 통해 정의된 도구는 에이전트가 MAF 내에서 실행되면 자동으로 사용할 수 있습니다.
using GitHub.Copilot.SDK;
using Microsoft.Extensions.AI;
using Microsoft.Agents.AI;
// Define a custom tool
AIFunction weatherTool = AIFunctionFactory.Create(
(string location) => $"The weather in {location} is sunny with a high of 25°C.",
"GetWeather",
"Get the current weather for a given location."
);
await using var copilotClient = new CopilotClient();
await copilotClient.StartAsync();
// Create agent with tools
AIAgent agent = copilotClient.AsAIAgent(new AIAgentOptions
{
Tools = new[] { weatherTool },
});
string response = await agent.RunAsync("What's the weather like in Seattle?");
Console.WriteLine(response);
MAF 도구와 함께 코필로트 SDK의 네이티브 도구 정의를 사용할 수도 있습니다.
import { CopilotClient, DefineTool } from "@github/copilot-sdk";
const getWeather = DefineTool({
name: "GetWeather",
description: "Get the current weather for a given location.",
parameters: { location: { type: "string", description: "City name" } },
execute: async ({ location }) => `The weather in ${location} is sunny, 25°C.`,
});
const client = new CopilotClient();
const session = await client.createSession({
model: "gpt-4.1",
tools: [getWeather],
onPermissionRequest: async () => ({ kind: "approved" }),
});
await session.sendAndWait({ prompt: "What's the weather like in Seattle?" });
경고
항상 반환 onPermissionRequest 하도록 설정 { kind: "approved" } 하면 승인 없이 프롬프트 삽입을 허용할 수 있습니다. 프로덕션 사용을 위해 권한을 부여하기 전에 요청된 도구 및 해당 매개 변수를 평가하는 정책 기반 승인을 구현합니다.
Python의 예제는 리포지토리의 microsoft-agent-frameworkgithub/copilot-sdk 문서를 참조하세요.
다중 에이전트 워크플로
MAF 통합의 주요 이점은 조정된 워크플로에서 다른 에이전트 공급자와 함께 Copilot를 통합하는 것입니다. 프레임워크의 기본 제공 오케스트레이터를 사용하여 다른 에이전트가 다른 단계를 처리하는 파이프라인을 만듭니다.
순차 워크플로
에이전트를 하나씩 실행하여 출력을 다음으로 전달합니다.
using GitHub.Copilot.SDK;
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.Orchestration;
await using var copilotClient = new CopilotClient();
await copilotClient.StartAsync();
// Copilot agent for code review
AIAgent reviewer = copilotClient.AsAIAgent(new AIAgentOptions
{
Instructions = "You review code for bugs, security issues, and best practices. Be thorough.",
});
// Azure OpenAI agent for generating documentation
AIAgent documentor = AIAgent.FromOpenAI(new OpenAIAgentOptions
{
Model = "gpt-4.1",
Instructions = "You write clear, concise documentation for code changes.",
});
// Compose in a sequential pipeline
var pipeline = new SequentialOrchestrator(new[] { reviewer, documentor });
string result = await pipeline.RunAsync(
"Review and document this pull request: added retry logic to the HTTP client"
);
Console.WriteLine(result);
Python의 예제는 리포지토리의 microsoft-agent-frameworkgithub/copilot-sdk 문서를 참조하세요.
동시 워크플로
여러 에이전트를 병렬로 실행하고 결과를 집계합니다.
using GitHub.Copilot.SDK;
using Microsoft.Agents.AI;
using Microsoft.Agents.AI.Orchestration;
await using var copilotClient = new CopilotClient();
await copilotClient.StartAsync();
AIAgent securityReviewer = copilotClient.AsAIAgent(new AIAgentOptions
{
Instructions = "Focus exclusively on security vulnerabilities and risks.",
});
AIAgent performanceReviewer = copilotClient.AsAIAgent(new AIAgentOptions
{
Instructions = "Focus exclusively on performance bottlenecks and optimization opportunities.",
});
// Run both reviews concurrently
var concurrent = new ConcurrentOrchestrator(new[] { securityReviewer, performanceReviewer });
string combinedResult = await concurrent.RunAsync(
"Analyze this database query module for issues"
);
Console.WriteLine(combinedResult);
스트리밍 응답
대화형 애플리케이션을 빌드할 때 에이전트 응답을 스트리밍하여 실시간 출력을 표시합니다. MAF 통합은 코필로트 SDK의 스트리밍 기능을 유지합니다.
using GitHub.Copilot.SDK;
using Microsoft.Agents.AI;
await using var copilotClient = new CopilotClient();
await copilotClient.StartAsync();
AIAgent agent = copilotClient.AsAIAgent(new AIAgentOptions
{
Streaming = true,
});
await foreach (var chunk in agent.RunStreamingAsync("Write a quicksort implementation in C#"))
{
Console.Write(chunk);
}
Console.WriteLine();
MAF 없이 코필로트 SDK를 통해 직접 스트리밍할 수도 있습니다.
import { CopilotClient } from "@github/copilot-sdk";
const client = new CopilotClient();
const session = await client.createSession({
model: "gpt-4.1",
streaming: true,
onPermissionRequest: async () => ({ kind: "approved" }),
});
session.on("assistant.message_delta", (event) => {
process.stdout.write(event.data.delta ?? "");
});
await session.sendAndWait({ prompt: "Write a quicksort implementation in TypeScript" });
Python의 예제는 리포지토리의 microsoft-agent-frameworkgithub/copilot-sdk 문서를 참조하세요.
구성 참조
MAF 에이전트 옵션
| 재산 | 유형 | 설명 |
|---|---|---|
Instructions | 문자열 | 에이전트에 대한 시스템 프롬프트 |
Tools | AIFunction[] 또는 리스트 | 에이전트에서 사용할 수 있는 사용자 지정 함수 도구 |
Streaming | bool | 스트리밍 응답 사용 |
Model | 문자열 | 기본 모델 재정의 |
Copilot SDK 옵션(직접 전달됨)
기본 Copilot 클라이언트를 생성할 때 모든 표준 SessionConfig 옵션을 사용할 수 있습니다. MAF 래퍼는 내부적으로 SDK에 작업을 맡깁니다.
| SDK 기능 | MAF 지원 |
|---|---|
사용자 지정 도구(DefineTool 및 AIFunctionFactory) | MAF 도구와 병합됨 |
| MCP 서버 | SDK 클라이언트에 구성됨 |
| 사용자 지정 에이전트 및 하위 에이전트 | Copilot 에이전트 내에서 사용 가능 |
| 무한 세션 | SDK 클라이언트에 구성됨 |
| 모델 선택 | 에이전트당 또는 호출당 재정의 가능 |
| 스트리밍 | 전체 델타 이벤트 지원 |
모범 사례
적절한 수준의 통합 선택
오케스트레이션된 워크플로에서 다른 공급자와 함께 작성 Copilot 해야 하는 경우 MAF 래퍼를 사용합니다. 애플리케이션에서만 사용하는 Copilot경우 독립 실행형 SDK가 더 간단하고 모든 권한을 부여합니다.
// Standalone SDK — full control, simpler setup
import { CopilotClient } from "@github/copilot-sdk";
const client = new CopilotClient();
const session = await client.createSession({
model: "gpt-4.1",
onPermissionRequest: async () => ({ kind: "approved" }),
});
const response = await session.sendAndWait({ prompt: "Explain this code" });
에이전트가 집중하도록 유지하기
다중 에이전트 워크플로를 빌드할 때 명확한 지침이 포함된 특정 역할을 각 에이전트에 제공합니다. 겹치는 책임 방지:
// Too vague — overlapping roles
const agents = [
{ instructions: "Help with code" },
{ instructions: "Assist with programming" },
];
// Focused — clear separation of concerns
const agents = [
{ instructions: "Review code for security vulnerabilities. Flag SQL injection, XSS, and auth issues." },
{ instructions: "Optimize code performance. Focus on algorithmic complexity and memory usage." },
];
오케스트레이션 수준에서 오류 처리
에이전트 호출을 오류 처리로 감싸야 하며, 특히 다중 에이전트 워크플로에서 한 에이전트의 실패가 전체 파이프라인을 차단하지 않도록 해야 합니다.
try
{
string result = await pipeline.RunAsync("Analyze this module");
Console.WriteLine(result);
}
catch (AgentException ex)
{
Console.Error.WriteLine($"Agent {ex.AgentName} failed: {ex.Message}");
// Fall back to single-agent mode or retry
}
추가 읽기
-
[AUTOTITLE](/copilot/how-tos/copilot-sdk/sdk-getting-started) -
[Microsoft Agent Framework 설명서](https://learn.microsoft.com/en-us/agent-framework/agents/providers/github-copilot) -
[블로그: GitHub Copilot SDK 및 Microsoft Agent Framework를 사용하여 AI 에이전트 빌드](https://devblogs.microsoft.com/semantic-kernel/build-ai-agents-with-github-copilot-sdk-and-microsoft-agent-framework/)