GitHub Copilot

Microsoft代理框架支持创建使用 GitHub Copilot SDK 作为其后端的代理。 GitHub Copilot 代理提供对功能强大的面向编码的 AI 功能的访问权限,包括 shell 命令执行、文件作、URL 提取和模型上下文协议 (MCP) 服务器集成。

重要

GitHub Copilot 智能体需要经过身份验证的 GitHub Copilot 运行时。 某些 SDK 使用已安装的 CLI,而 Go SDK 默认使用捆绑运行时。 为了安全,建议在容器化环境中(如 Docker 或开发容器)运行具有 shell 或文件权限的代理。

入门

将所需的 NuGet 包添加到项目。

dotnet add package Microsoft.Agents.AI.GitHub.Copilot

创建 GitHub Copilot 代理

作为第一步,创建 CopilotClient 并启动它。 AsAIAgent然后使用扩展方法创建代理。

using GitHub.Copilot;
using Microsoft.Agents.AI;

await using CopilotClient copilotClient = new();
await copilotClient.StartAsync();

AIAgent agent = copilotClient.AsAIAgent(sessionConfig: null);

Console.WriteLine(await agent.RunAsync("What is Microsoft Agent Framework?"));

配备工具和说明书

可以在创建代理时提供函数工具和自定义说明:

using GitHub.Copilot;
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;

AIFunction weatherTool = AIFunctionFactory.Create((string location) =>
{
    return $"The weather in {location} is sunny with a high of 25C.";
}, "GetWeather", "Get the weather for a given location.");

await using CopilotClient copilotClient = new();
await copilotClient.StartAsync();

AIAgent agent = copilotClient.AsAIAgent(
    tools: [weatherTool],
    instructions: "You are a helpful weather agent.");

Console.WriteLine(await agent.RunAsync("What's the weather like in Seattle?"));

代理功能

流式处理响应

在生成时获取响应:

await using CopilotClient copilotClient = new();
await copilotClient.StartAsync();

AIAgent agent = copilotClient.AsAIAgent(sessionConfig: null);

await foreach (AgentResponseUpdate update in agent.RunStreamingAsync("Tell me a short story."))
{
    Console.Write(update);
}

Console.WriteLine();

会话管理

使用会话在多次交互之间维护对话上下文:

await using CopilotClient copilotClient = new();
await copilotClient.StartAsync();

await using GitHubCopilotAgent agent = new(
    copilotClient,
    instructions: "You are a helpful assistant. Keep your answers short.");

AgentSession session = await agent.CreateSessionAsync();

// First turn
await agent.RunAsync("My name is Alice.", session);

// Second turn - agent remembers the context
AgentResponse response = await agent.RunAsync("What is my name?", session);
Console.WriteLine(response); // Should mention "Alice"

Permissions

默认情况下,代理无法执行 shell 命令、读/写文件或提取 URL。 若要启用这些功能,请通过以下方法 SessionConfig提供权限处理程序:

static Task<PermissionDecision> PromptPermission(
    PermissionRequest request, PermissionInvocation invocation)
{
    Console.WriteLine($"\n[Permission Request: {request.Kind}]");
    Console.Write("Approve? (y/n): ");

    string? input = Console.ReadLine()?.Trim().ToUpperInvariant();
    PermissionDecision decision = input is "Y" or "YES"
        ? PermissionDecision.ApproveOnce()
        : PermissionDecision.Reject();

    return Task.FromResult(decision);
}

await using CopilotClient copilotClient = new();
await copilotClient.StartAsync();

SessionConfig sessionConfig = new()
{
    OnPermissionRequest = PromptPermission,
};

AIAgent agent = copilotClient.AsAIAgent(sessionConfig);

Console.WriteLine(await agent.RunAsync("List all files in the current directory"));

工具审批

由于 GitHub Copilot SDK 负责工具调用循环,因此对自定义函数工具的审批是通过 SDK 的原生执行前钩子来实施的,而不是通过标准 Agent Framework 的审批往返流程。 当你注册一个封装在 ApprovalRequiredAIFunction 中的工具时,代理会安装一个默认的 OnPreToolUse 钩子,为该工具返回 "ask",并将该决策路由到你的 OnPermissionRequest 处理程序:

using GitHub.Copilot;
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;

AIFunction deleteFile = AIFunctionFactory.Create(
    (string path) => $"Deleted {path}.",
    "DeleteFile",
    "Deletes a file.");

await using CopilotClient copilotClient = new();
await copilotClient.StartAsync();

SessionConfig sessionConfig = new()
{
    // Wrapping the tool marks it approval-required; the agent turns this into an "ask" at OnPreToolUse.
    Tools = [new ApprovalRequiredAIFunction(deleteFile)],

    // OnPermissionRequest decides the "asked" tools (and Copilot's built-in shell/file/URL prompts).
    OnPermissionRequest = PromptPermission,
};

AIAgent agent = copilotClient.AsAIAgent(sessionConfig);

Console.WriteLine(await agent.RunAsync("Delete the file temp.txt"));

Warning

如果你通过 SessionConfig.Hooks 提供自己的 OnPreToolUse 钩子,则它会优先生效,代理不会安装其默认的审批钩子。 随后,你需要全面负责对注册的任何ApprovalRequiredAIFunction强制实施审批,例如返回"deny""ask"决策。 代理会记录一条警告,其中列出挂钩必须处理的所有需要审批的工具。

MCP 服务器

连接到本地(stdio)或远程 (HTTP) MCP 服务器以获取扩展功能:

await using CopilotClient copilotClient = new();
await copilotClient.StartAsync();

SessionConfig sessionConfig = new()
{
    OnPermissionRequest = PromptPermission,
    McpServers = new Dictionary<string, McpServerConfig>
    {
        // Local stdio server
        ["filesystem"] = new McpStdioServerConfig
        {
            Command = "npx",
            Args = ["-y", "@modelcontextprotocol/server-filesystem", "."],
            Tools = ["*"],
        },
        // Remote HTTP server
        ["microsoft-learn"] = new McpHttpServerConfig
        {
            Url = "https://learn.microsoft.com/api/mcp",
            Tools = ["*"],
        },
    },
};

AIAgent agent = copilotClient.AsAIAgent(sessionConfig);

Console.WriteLine(await agent.RunAsync("Search Microsoft Learn for 'Azure Functions' and summarize the top result"));

Tip

有关完整的可运行示例,请参阅 .NET 示例

Tools

工具 地位 注释
函数工具 标准 AIFunction 实例。
工具审批 由框架中支持函数调用的聊天客户端提供;可与任何函数工具调用配合使用。
代码解释器 不是 Copilot CLI 功能。
文件搜索 不是 Copilot CLI 功能。
Web 搜索 未以托管工具的形式提供。
Shell / 文件系统 / URL 获取 内置于 Copilot CLI 运行时,并由你提供的权限处理程序控制。
托管 MCP 工具 通过 SessionConfig.McpServers配置远程 (HTTP) MCP 服务器。 请参阅 MCP 服务器
本地 MCP 工具 通过 SessionConfig.McpServers配置本地 (stdio) MCP 服务器。 请参阅 MCP 服务器

使用代理

代理是标准的AIAgent,支持所有标准AIAgent操作。

有关如何运行和与代理交互的详细信息,请参阅 代理入门教程

Prerequisites

安装 Microsoft Agent Framework GitHub Copilot 包。

pip install agent-framework-github-copilot

Configuration

可以使用以下环境变量选择性地配置代理:

Variable 说明
GITHUB_COPILOT_CLI_PATH Copilot CLI 可执行文件的路径
GITHUB_COPILOT_MODEL 要使用的模型(例如, gpt-5claude-sonnet-4
GITHUB_COPILOT_TIMEOUT 请求超时(以秒为单位)
GITHUB_COPILOT_LOG_LEVEL CLI 日志级别
GITHUB_COPILOT_BASE_DIRECTORY CLI 会话状态和配置目录(默认为 ~/.copilot

入门

从 Agent Framework 导入所需的类:

import asyncio
from agent_framework.github import GitHubCopilotAgent, GitHubCopilotOptions

创建 GitHub Copilot 代理

基本代理创建

创建 GitHub Copilot 代理的最简单方法:

async def basic_example():
    agent = GitHubCopilotAgent(
        instructions="You are a helpful assistant.",
    )

    async with agent:
        result = await agent.run("What is Microsoft Agent Framework?")
        print(result)

使用显式配置

可以通过以下方法 default_options提供显式配置:

async def explicit_config_example():
    agent = GitHubCopilotAgent(
        instructions="You are a helpful assistant.",
        default_options={
            "model": "gpt-5",
            "timeout": 120,
        },
    )

    async with agent:
        result = await agent.run("What can you do?")
        print(result)

Tip

default_options(以及每次运行的 options)会转发 Copilot SDK 的 create_session 接受的任何参数——例如 reasoning_effortcontext_tierenable_citationsprovider(自备密钥)或 skill_directories——而不仅限于此处显示的这些键。 未知的参数名会引发 TypeError,这样就能捕获拼写错误,而不是将其悄悄忽略。

自带密钥(BYOK)

使用 Copilot SDK 的 BYOK 功能,将模型请求通过你自己的 OpenAI、Azure OpenAI、Anthropic 或兼容 OpenAI 的终结点进行路由,而不是通过 GitHub Copilot 后端。 将 ProviderConfig 传递给 GitHubCopilotOptions(provider=...),并在提供程序配置和会话级别的 model 选项中设置相同的模型标识符。

可运行的示例使用以下环境变量:

Variable 说明
BYOK_PROVIDER_TYPE 提供程序类型: openaiazureanthropic。 默认值为 openai.
BYOK_BASE_URL 提供程序终结点的基 URL。
BYOK_API_KEY 用于提供程序端点的静态 API 密钥。
BYOK_MODEL_ID 要请求的模型标识符。 默认值为 gpt-4o.

Warning

BYOK 使用静态凭据,不提供自动令牌刷新。 使 API 密钥远离源代码管理,并从环境变量或机密存储中加载它们。 提供商会跟踪使用情况和计费,而不是GitHub。

import asyncio
import os
from typing import Literal, cast

from agent_framework.github import GitHubCopilotAgent, GitHubCopilotOptions
from copilot.session import ProviderConfig


async def main() -> None:
    print("=== GitHub Copilot Agent with BYOK (Bring Your Own Key) ===\n")

    model_id = os.environ.get("BYOK_MODEL_ID", "gpt-4o")
    provider_type = cast(Literal["openai", "azure", "anthropic"], os.environ.get("BYOK_PROVIDER_TYPE", "openai"))

    # ProviderConfig routes the session through a custom endpoint instead of the GitHub
    # Copilot backend. `wire_api="completions"` is the broadly compatible choice; use
    # "responses" for providers that support the OpenAI Responses API.
    provider: ProviderConfig = {
        "type": provider_type,
        "base_url": os.environ["BYOK_BASE_URL"],
        "api_key": os.environ["BYOK_API_KEY"],
        "wire_api": "completions",
        "model_id": model_id,
    }

    # BYOK requires the model to also be set at the session level.
    agent: GitHubCopilotAgent[GitHubCopilotOptions] = GitHubCopilotAgent(
        instructions="You are a helpful assistant.",
        default_options=GitHubCopilotOptions(model=model_id, provider=provider),
    )

    async with agent:
        query = "What are the benefits of using your own API keys with an agent framework?"
        print(f"User: {query}")
        result = await agent.run(query)
        print(f"\nAgent: {result}\n")

代理功能

上下文供应者

Python GitHubCopilotAgent 也支持 context_providers=[...]。 提供者在每次调用之前和之后运行,因此由提供者添加的消息和指令会包含在 Copilot 提示中,而历史记录提供者可以观察到最终响应。

from agent_framework import InMemoryHistoryProvider

agent = GitHubCopilotAgent(
    instructions="You are a helpful coding assistant.",
    context_providers=[InMemoryHistoryProvider()],
)

可以将内置历史记录提供程序与自定义上下文提供程序组合在一起。 有关实现模式,请参阅 上下文提供程序

函数工具

为代理配备自定义功能:

from typing import Annotated
from pydantic import Field

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 tools_example():
    agent = GitHubCopilotAgent(
        instructions="You are a helpful weather agent.",
        tools=[get_weather],
    )

    async with agent:
        result = await agent.run("What's the weather like in Seattle?")
        print(result)

流式处理响应

对即时生成的响应进行获取,以提升用户体验。

async def streaming_example():
    agent = GitHubCopilotAgent(
        instructions="You are a helpful assistant.",
    )

    async with agent:
        print("Agent: ", end="", flush=True)
        async for chunk in agent.run("Tell me a short story.", stream=True):
            if chunk.text:
                print(chunk.text, end="", flush=True)
        print()

线程管理

在多次交互之间维护对话上下文:

async def thread_example():
    agent = GitHubCopilotAgent(
        instructions="You are a helpful assistant.",
    )

    async with agent:
        session = agent.create_session()

        # First interaction
        result1 = await agent.run("My name is Alice.", session=session)
        print(f"Agent: {result1}")

        # Second interaction - agent remembers the context
        result2 = await agent.run("What's my name?", session=session)
        print(f"Agent: {result2}")  # Should remember "Alice"

Permissions

默认情况下,代理无法执行 shell 命令、读/写文件或提取 URL。 若要启用这些功能,请提供权限处理程序:

import asyncio

from copilot.generated.rpc import PermissionDecisionDeniedInteractivelyByUser
from copilot.session import PermissionHandler, PermissionRequestResult
from copilot.session_events import PermissionRequest


async def prompt_permission(
    request: PermissionRequest, context: dict[str, str]
) -> PermissionRequestResult:
    print(f"\n[Permission Request: {request.kind}]")
    response = (await asyncio.to_thread(input, "Approve? (y/n): ")).strip().lower()
    if response in ("y", "yes"):
        return PermissionHandler.approve_all(request, context)
    return PermissionDecisionDeniedInteractivelyByUser()

async def permissions_example():
    agent = GitHubCopilotAgent(
        instructions="You are a helpful assistant that can execute shell commands.",
        default_options={
            "on_permission_request": prompt_permission,
        },
    )

    async with agent:
        result = await agent.run("List the Python files in the current directory")
        print(result)

对于应自动批准所有权限的受信任环境,请使用内置 PermissionHandler.approve_all

from copilot.session import PermissionHandler

agent = GitHubCopilotAgent(
    default_options={
        "on_permission_request": PermissionHandler.approve_all,
    },
)

权限处理程序同时支持同步和异步回调。 在异步处理程序中使用 asyncio.to_thread 进行交互式提示,以避免阻塞事件循环。

工具审批

由于 GitHub Copilot SDK 负责工具调用循环,因此对自定义函数工具的审批是通过 SDK 的原生执行前钩子来强制执行的,而不是通过标准的 Agent Framework 审批往返流程。 注册一个声明了 approval_mode="always_require" 的工具时,如果您未提供自己的 on_pre_tool_use 钩子,代理会安装一个默认钩子,为该工具返回 "ask",并将该决策路由到您的 on_permission_request 处理程序:

from agent_framework import tool
from agent_framework.github import GitHubCopilotAgent, GitHubCopilotOptions
from copilot.session import PermissionHandler


@tool(approval_mode="always_require")
def delete_file(path: str) -> str:
    """Delete a file."""
    return f"Deleted {path}."


agent = GitHubCopilotAgent(
    tools=[delete_file],
    # The "ask" decision is routed here; approve or deny the call.
    default_options=GitHubCopilotOptions(on_permission_request=PermissionHandler.approve_all),
)

Warning

如果你提供自己的 on_pre_tool_use 钩子,则会优先使用它,代理程序 不会 安装其默认的批准钩子。 然后,你完全负责强制批准任何 approval_mode="always_require" 工具(例如,通过返回 "deny""ask" 决定)。 代理会记录一条警告,其中列出挂钩必须处理的所有需要审批的工具。 使用默认的全部拒绝权限处理程序时,除非配置一个批准请求的on_permission_request,否则always_require工具将被拒绝。

MCP 服务器

连接到本地(stdio)或远程 (HTTP) MCP 服务器以获取扩展功能:

from copilot.session import MCPServerConfig, PermissionHandler

async def mcp_example():
    mcp_servers: dict[str, MCPServerConfig] = {
        # Local stdio server
        "filesystem": {
            "type": "stdio",
            "command": "npx",
            "args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
            "tools": ["*"],
        },
        # Remote HTTP server
        "microsoft-learn": {
            "type": "http",
            "url": "https://learn.microsoft.com/api/mcp",
            "tools": ["*"],
        },
    }

    agent = GitHubCopilotAgent(
        instructions="You are a helpful assistant with access to the filesystem and Microsoft Learn.",
        default_options={
            "on_permission_request": PermissionHandler.approve_all,
            "mcp_servers": mcp_servers,
        },
    )

    async with agent:
        result = await agent.run("Search Microsoft Learn for 'Azure Functions' and summarize the top result")
        print(result)

Observability

GitHubCopilotAgent 具有内置 OpenTelemetry 跟踪。 启动时调用 configure_otel_providers() 一次,为每次运行启用跨度、指标和日志:

from agent_framework.observability import configure_otel_providers
from agent_framework.github import GitHubCopilotAgent

configure_otel_providers(enable_console_exporters=True)

async with GitHubCopilotAgent() as agent:
    response = await agent.run("Hello!")

如果您需要没有遥测层的底层代理(例如将其封装为自定义代理),请从RawGitHubCopilotAgent导入agent_framework.github

有关 OTLP 导出器和更丰富的示例,请参阅 可观测性示例

Tools

工具 地位 注释
函数工具 标准 Python 可调用对象或 @ai_function
工具审批 由框架中支持函数调用的聊天客户端提供;可与任何函数工具调用配合使用。
代码解释器 不是 Copilot CLI 功能。
文件搜索 不是 Copilot CLI 功能。
Web 搜索 未以托管工具的形式提供。
Shell / 文件系统 / URL 获取 内置于 Copilot CLI 运行时中,并受你提供的 Permissions 处理程序的限制。
托管 MCP 工具 通过 default_options["mcp_servers"]配置远程 (HTTP) MCP 服务器。 请参阅 MCP 服务器
本地 MCP 工具 通过 default_options["mcp_servers"]配置本地 (stdio) MCP 服务器。 请参阅 MCP 服务器

使用代理

代理是标准 BaseAgent 代理,支持所有标准代理操作。

有关如何运行和与代理交互的详细信息,请参阅 代理入门教程

入门

安装 Microsoft Agent Framework Go 模块和 GitHub Copilot SDK for Go。 Agent Framework Go SDK 需要 Go 1.25 或更高版本。

go get github.com/microsoft/agent-framework-go github.com/github/copilot-sdk/go

创建 GitHub Copilot 代理

创建并启动一个 copilot.Client,然后将其传递给 copilotprovider.NewAgent

import (
    "context"
    "fmt"

    copilot "github.com/github/copilot-sdk/go"
    "github.com/microsoft/agent-framework-go/provider/copilotprovider"
)

ctx := context.Background()

copilotClient := copilot.NewClient(nil)
if err := copilotClient.Start(ctx); err != nil {
    panic(err)
}
defer func() { _ = copilotClient.Stop() }()

copilotAgent := copilotprovider.NewAgent(
    copilotClient,
    copilotprovider.AgentConfig{
        Instructions: "You are a helpful assistant.",
    },
)

response, err := copilotAgent.RunText(ctx, "What is Microsoft Agent Framework?").Collect()
if err != nil {
    panic(err)
}
fmt.Println(response)

配备工具和说明书

可以在创建代理时提供函数工具和自定义说明:

import (
    "context"
    "fmt"

    copilot "github.com/github/copilot-sdk/go"
    "github.com/microsoft/agent-framework-go/agent"
    "github.com/microsoft/agent-framework-go/provider/copilotprovider"
    "github.com/microsoft/agent-framework-go/tool"
    "github.com/microsoft/agent-framework-go/tool/functool"
)

weatherTool := functool.MustNew(
    functool.Config{
        Name:        "GetWeather",
        Description: "Get the weather for a given location.",
    },
    func(_ context.Context, location string) (string, error) {
        return fmt.Sprintf("The weather in %s is sunny with a high of 25C.", location), nil
    },
)

copilotAgent := copilotprovider.NewAgent(
    copilotClient,
    copilotprovider.AgentConfig{
        Instructions: "You are a helpful weather agent.",
        Config: agent.Config{
            Tools: []tool.Tool{weatherTool},
        },
    },
)

response, err := copilotAgent.RunText(ctx, "What's the weather like in Seattle?").Collect()
if err != nil {
    panic(err)
}
fmt.Println(response)

代理功能

流式处理响应

在生成时获取响应:

for update, err := range copilotAgent.RunText(ctx, "Tell me a short story.", agent.Stream(true)) {
    if err != nil {
        panic(err)
    }
    fmt.Print(update)
}

fmt.Println()

会话管理

使用会话在多次交互之间维护对话上下文:

session, err := copilotAgent.CreateSession(ctx)
if err != nil {
    panic(err)
}

// First turn
response, err := copilotAgent.RunText(ctx, "My name is Alice.", agent.WithSession(session)).Collect()
if err != nil {
    panic(err)
}
fmt.Println(response)

// Second turn - the agent remembers the context
response, err = copilotAgent.RunText(ctx, "What is my name?", agent.WithSession(session)).Collect()
if err != nil {
    panic(err)
}
fmt.Println(response)

Permissions

默认情况下,代理无法执行 shell 命令、读/写文件或提取 URL。 若要启用这些功能,请通过以下方法 copilot.SessionConfig提供权限处理程序:

import (
    "bufio"
    "fmt"
    "os"
    "strings"

    copilot "github.com/github/copilot-sdk/go"
    "github.com/github/copilot-sdk/go/rpc"
    "github.com/microsoft/agent-framework-go/provider/copilotprovider"
)

func promptPermission(request copilot.PermissionRequest, _ copilot.PermissionInvocation) (rpc.PermissionDecision, error) {
    fmt.Printf("\n[Permission Request: %s]\n", request.Kind())
    fmt.Print("Approve? (y/n): ")

    input, _ := bufio.NewReader(os.Stdin).ReadString('\n')
    input = strings.TrimSpace(strings.ToUpper(input))
    if input == "Y" || input == "YES" {
        return &rpc.PermissionDecisionApproveOnce{}, nil
    }
    return &rpc.PermissionDecisionReject{}, nil
}

copilotAgent := copilotprovider.NewAgent(
    copilotClient,
    copilotprovider.AgentConfig{
        SessionConfig: &copilot.SessionConfig{
            OnPermissionRequest: promptPermission,
        },
    },
)

response, err := copilotAgent.RunText(ctx, "List all files in the current directory").Collect()
if err != nil {
    panic(err)
}
fmt.Println(response)

MCP 服务器

连接到本地(stdio)或远程 (HTTP) MCP 服务器以获取扩展功能:

import (
    copilot "github.com/github/copilot-sdk/go"
    "github.com/microsoft/agent-framework-go/provider/copilotprovider"
)

mcpServers := map[string]copilot.MCPServerConfig{
    // Local stdio server
    "filesystem": copilot.MCPStdioServerConfig{
        Command: "npx",
        Args:    []string{"-y", "@modelcontextprotocol/server-filesystem", "."},
        Tools:   []string{"*"},
    },
    // Remote HTTP server
    "microsoft-learn": copilot.MCPHTTPServerConfig{
        URL:   "https://learn.microsoft.com/api/mcp",
        Tools: []string{"*"},
    },
}

copilotAgent := copilotprovider.NewAgent(
    copilotClient,
    copilotprovider.AgentConfig{
        Instructions: "You are a helpful assistant with access to the filesystem and Microsoft Learn.",
        SessionConfig: &copilot.SessionConfig{
            OnPermissionRequest: promptPermission,
            MCPServers:          mcpServers,
        },
    },
)

response, err := copilotAgent.RunText(ctx, "Search Microsoft Learn for 'Azure Functions' and summarize the top result").Collect()
if err != nil {
    panic(err)
}
fmt.Println(response)

Tip

有关完整的可运行示例,请参阅 Go GitHub Copilot 示例

Tools

工具 地位 注释
函数工具 标准 Go tool.Tool 实例,包括 functool 函数。
工具审批 函数工具可以使用标准的 Go 工具审批功能;Copilot 运行时权限由 SessionConfig.OnPermissionRequest 处理。
代码解释器 不是 Copilot CLI 功能。
文件搜索 不是 Copilot CLI 功能。
Web 搜索 未以托管工具的形式提供。
Shell / 文件系统 / URL 获取 内置于 Copilot CLI 运行时中,并受你提供的 Permissions 处理程序的限制。
托管 MCP 工具 通过 copilot.SessionConfig.MCPServers配置远程 (HTTP) MCP 服务器。 请参阅 MCP 服务器
本地 MCP 工具 通过 copilot.SessionConfig.MCPServers配置本地 (stdio) MCP 服务器。 请参阅 MCP 服务器

使用代理

代理是标准 *agent.Agent 代理,支持所有标准代理操作。

有关如何运行和与代理交互的详细信息,请参阅 代理入门教程

后续步骤