Token导航 LogoToken导航TokenDH.com
AI 工具external-servicegithub未标认证来源可访问clear审计异常

github-copilot-sdkGitHub GitHub Copilot SDK 工具

Agent Skill

用于围绕 GitHub 仓库、Issue、Pull Request、分支、提交和代码协作流程提供辅助能力。它适合让 Agent 查询项目状态、整理变更、辅助创建或检查协作事项,并把仓库中的信息转成可执行的下一步。使用时需要区分只读查询和写入操作;涉及创建 PR、修改 Issue、推送分支或访问私有仓库时,应确认 token 权限、目标仓库范围和用户授权。

总安装

2,375

周安装

97

GitHub Stars

55

下载量

760
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:github-copilot-sdk(GitHub GitHub Copilot SDK 工具)
来源仓库:https://github.com/rysweet/amplihack
仓库路径:skills/github-copilot-sdk
安装命令:
npx skills add https://github.com/rysweet/amplihack --skill github-copilot-sdk
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/rysweet/amplihack --skill github-copilot-sdk

简介

调用 GitHub Copilot SDK 实现自定义 AI 编程助手。

  • 适用于构建领域专用插件、私有化部署或离线推理环境。
  • 封装常用请求模式,简化模型交互与结果解析过程。
  • 要求本地具备 GPU 加速能力及有效的 Copilot 许可证。
  • github-copilot-sdk 属于AI 工具类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

GitHub Copilot SDK - Comprehensive Skill

Overview

The GitHub Copilot SDK enables developers to embed Copilot's agentic workflows programmatically in their applications. It exposes the same engine behind Copilot CLI as a production-tested agent runtime you can invoke from code.

When to Use the Copilot SDK

Use the Copilot SDK when:

  • Building applications that need Copilot's AI capabilities
  • Implementing custom AI assistants with tool-calling abilities
  • Creating integrations that leverage Copilot's code understanding
  • Connecting to MCP (Model Context Protocol) servers for standardized tools
  • Need streaming responses in custom UIs

Don't use when:

  • GitHub Copilot CLI is sufficient (use CLI directly)
  • No programmatic integration needed (use Copilot in VS Code)
  • Building simple chat without tools (use standard LLM API)

Language Support

SDKInstallation
Node.js/TypeScriptnpm install @github/copilot-sdk
Pythonpip install github-copilot-sdk
Gogo get github.com/github/copilot-sdk/go
.NETdotnet add package GitHub.Copilot.SDK

Prerequisites

  1. GitHub Copilot CLI installed and authenticated
  2. Active Copilot subscription (free tier available with limits)

Quick Start

Minimal Example (TypeScript)

import { CopilotClient } from "@github/copilot-sdk";

const client = new CopilotClient();
const session = await client.createSession({ model: "gpt-4.1" });

const response = await session.sendAndWait({ prompt: "What is 2 + 2?" });
console.log(response?.data.content);

await client.stop();

Minimal Example (Python)

import asyncio
from copilot import CopilotClient

async def main():
    client = CopilotClient()
    await client.start()
    session = await client.create_session({"model": "gpt-4.1"})
    response = await session.send_and_wait({"prompt": "What is 2 + 2?"})
    print(response.data.content)
    await client.stop()

asyncio.run(main())

Add Streaming

const session = await client.createSession({
  model: "gpt-4.1",
  streaming: true,
});

session.on((event) => {
  if (event.type === "assistant.message_delta") {
    process.stdout.write(event.data.deltaContent);
  }
});

await session.sendAndWait({ prompt: "Tell me a joke" });

Add Custom Tool

import { defineTool } from "@github/copilot-sdk";

const getWeather = defineTool("get_weather", {
  description: "Get weather for a city",
  parameters: {
    type: "object",
    properties: {
      city: { type: "string", description: "City name" },
    },
    required: ["city"],
  },
  handler: async ({ city }) => ({
    city,
    temperature: `${Math.floor(Math.random() * 30) + 50}°F`,
    condition: "sunny",
  }),
});

const session = await client.createSession({
  model: "gpt-4.1",
  tools: [getWeather],
});

Core Concepts

Architecture

Your Application → SDK Client → JSON-RPC → Copilot CLI (server mode)

The SDK manages the CLI process lifecycle automatically or connects to an external CLI server.

Key Components

  1. CopilotClient: Entry point - manages connection to Copilot CLI
  2. Session: Conversation context with model, tools, and history
  3. Tools: Custom functions Copilot can invoke
  4. Events: Streaming responses and tool call notifications
  5. MCP Integration: Connect to Model Context Protocol servers

Session Configuration

const session = await client.createSession({
  model: "gpt-4.1", // Model to use
  streaming: true, // Enable streaming
  tools: [myTool], // Custom tools
  mcpServers: {
    // MCP server connections
    github: {
      type: "http",
      url: "https://api.githubcopilot.com/mcp/",
    },
  },
  systemMessage: {
    // Custom system prompt
    content: "You are a helpful assistant.",
  },
  customAgents: [
    {
      // Custom agent personas
      name: "code-reviewer",
      displayName: "Code Reviewer",
      description: "Reviews code for best practices",
      prompt: "Focus on security and performance.",
    },
  ],
});

Navigation Guide

When to Read Supporting Files

reference.md - Read when you need:

  • Complete API reference for all 4 languages
  • All method signatures with parameters and return types
  • Session configuration options
  • Event types and handling
  • External CLI server connection

examples.md - Read when you need:

  • Working copy-paste code for all 4 languages
  • Error handling patterns
  • Multiple sessions management
  • Interactive assistant implementation
  • Custom agent definition examples

patterns.md - Read when you need:

  • Production-ready architectural patterns
  • Streaming UI integration
  • MCP server integration patterns
  • Rate limiting and retry patterns
  • Structured output extraction

drift-detection.md - Read when you need:

  • Understanding how this skill stays current
  • Validation workflow
  • Update procedures

Quick Reference

Common Event Types

Event Type (TS/Go)Python Enum
assistant.message_deltaSessionEventType.ASSISTANT_MESSAGE_DELTA
session.idleSessionEventType.SESSION_IDLE
tool.invocationSessionEventType.TOOL_EXECUTION_START
tool.resultSessionEventType.TOOL_EXECUTION_COMPLETE
Python: Import from copilot.generated.session_events import SessionEventType

Default Tools

The SDK operates in --allow-all mode by default, enabling:

  • File system operations
  • Git operations
  • Web requests
  • All first-party Copilot tools

Integration with Amplihack

Use the Copilot SDK to build custom agents within amplihack:

# Create Copilot-powered agent for specific domain
from copilot import CopilotClient

async def create_code_review_agent():
    client = CopilotClient()
    await client.start()
    session = await client.create_session({
        "model": "gpt-4.1",
        "streaming": True,
        "systemMessage": {
            "content": "You are an expert code reviewer."
        }
    })
    return session

Next Steps

  1. Start Simple: Basic send/receive with default model
  2. Add Streaming: Real-time responses for better UX
  3. Add Tools: Custom functions for your domain
  4. Connect MCP: Use GitHub MCP server for repo access
  5. Build UI: Integrate into your application

For complete API details, see reference.md. For working code in all languages, see examples.md. For production patterns, see patterns.md.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

30.78%
按下载量换算234

Antigravity

22.37%
按下载量换算170

github-copilot

16.48%
按下载量换算125

OpenCode

14.73%
按下载量换算112

Cursor

8.93%
按下载量换算68

Gemini CLI

3.96%
按下载量换算30

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills