github-copilot-sdk

Comprehensive knowledge of GitHub Copilot SDK for embedding Copilot's agentic workflows in Python, TypeScript, Go, and .NET applications. Auto-activates for Copilot SDK integration, CopilotClient usage, session management, streaming responses, custom tools, and MCP server connections.

16 stars

Best use case

github-copilot-sdk is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Comprehensive knowledge of GitHub Copilot SDK for embedding Copilot's agentic workflows in Python, TypeScript, Go, and .NET applications. Auto-activates for Copilot SDK integration, CopilotClient usage, session management, streaming responses, custom tools, and MCP server connections.

Teams using github-copilot-sdk should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/github-copilot-sdk/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/ai-agents/github-copilot-sdk/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/github-copilot-sdk/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How github-copilot-sdk Compares

Feature / Agentgithub-copilot-sdkStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Comprehensive knowledge of GitHub Copilot SDK for embedding Copilot's agentic workflows in Python, TypeScript, Go, and .NET applications. Auto-activates for Copilot SDK integration, CopilotClient usage, session management, streaming responses, custom tools, and MCP server connections.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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

| SDK                    | Installation                              |
| ---------------------- | ----------------------------------------- |
| **Node.js/TypeScript** | `npm install @github/copilot-sdk`         |
| **Python**             | `pip install github-copilot-sdk`          |
| **Go**                 | `go get github.com/github/copilot-sdk/go` |
| **.NET**               | `dotnet 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)

```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)

```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

```typescript
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

```typescript
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

```typescript
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_delta` | `SessionEventType.ASSISTANT_MESSAGE_DELTA` |
| `session.idle`            | `SessionEventType.SESSION_IDLE`            |
| `tool.invocation`         | `SessionEventType.TOOL_EXECUTION_START`    |
| `tool.result`             | `SessionEventType.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:

```python
# 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`.

Related Skills

copilot-sdk

16
from diegosouzapw/awesome-omni-skill

Build agentic applications with GitHub Copilot SDK. Use when embedding AI agents in apps, creating custom tools, implementing streaming responses, managing sessions, connecting to MCP servers, or creating custom agents. Triggers on Copilot SDK, GitHub SDK, agentic app, embed Copilot, programmable agent, MCP server, custom agent. **PROACTIVE ACTIVATION**: Auto-invoke when building agentic applications or integrating Copilot SDK. **DETECTION**: Check for @github/copilot-sdk imports, copilot dependencies in package.json/pyproject.toml/go.mod. **USE CASES**: Embedding agents in apps, creating custom tools, implementing streaming, managing sessions, connecting to MCP servers.

awesome-copilot-root-typespec-create-agent

16
from diegosouzapw/awesome-omni-skill

Generate a complete TypeSpec declarative agent with instructions, capabilities, and conversation starters for Microsoft 365 Copilot Use when: the task directly matches typespec create agent responsibilities within plugin awesome-copilot-root. Do not use when: a more specific framework or task-focused skill is clearly a better match.

awesome-copilot-root-mcp-m365-agent-expert

16
from diegosouzapw/awesome-omni-skill

Expert assistant for building MCP-based declarative agents for Microsoft 365 Copilot with Model Context Protocol integration Use when: the task directly matches mcp m365 agent expert responsibilities within plugin awesome-copilot-root. Do not use when: a more specific framework or task-focused skill is clearly a better match.

awesome-copilot-root-mcp-create-declarative-agent

16
from diegosouzapw/awesome-omni-skill

Skill converted from mcp-create-declarative-agent.prompt.md Use when: the task directly matches mcp create declarative agent responsibilities within plugin awesome-copilot-root. Do not use when: a more specific framework or task-focused skill is clearly a better match.

awesome-copilot-root-agent-governance

16
from diegosouzapw/awesome-omni-skill

Use when: the task directly matches agent governance responsibilities within plugin awesome-copilot-root. Do not use when: a more specific framework or task-focused skill is clearly a better match.

python-github-actions

16
from diegosouzapw/awesome-omni-skill

Complete Python GitHub Actions system. PROACTIVELY activate for: (1) uv-based CI workflows (10-100x faster), (2) Matrix testing across Python versions, (3) Dependency caching with setup-uv, (4) Parallel test execution, (5) Reusable workflows, (6) Publishing to PyPI with trusted publishing, (7) Code coverage with codecov, (8) Security scanning. Provides: Workflow templates, caching config, matrix strategies, composite actions. Ensures fast, reliable CI/CD pipelines.

phoenix-github

16
from diegosouzapw/awesome-omni-skill

Manage GitHub issues, labels, and project boards for the Arize-ai/phoenix repository. Use when filing roadmap issues, triaging bugs, applying labels, managing the Phoenix roadmap project board, or querying issue/project state via the GitHub CLI.

github

16
from diegosouzapw/awesome-omni-skill

Access GitHub repositories via the GitHub REST API. Use this skill when the user wants to interact with GitHub including reading files, creating/updating files, listing repos, managing branches, viewing commits, working with issues, or managing pull requests. All scripts use PEP 723 inline metadata for dependencies and run via `uv run`. Requires GITHUB_TOKEN environment variable (a Personal Access Token with appropriate scopes).

github-workflow-automation

16
from diegosouzapw/awesome-omni-skill

Advanced GitHub Actions workflow automation with AI swarm coordination, intelligent CI/CD pipelines, and comprehensive repository management

github-search

16
from diegosouzapw/awesome-omni-skill

Search GitHub for repos, code, and usage examples using gh CLI. Capabilities: repo discovery, code search, finding library usage patterns, issue/PR search. Actions: search, find, discover repos/code/examples. Keywords: gh, github, search repos, search code, find examples, how to use library, stars, language filter. Use when: finding repositories, searching code patterns, discovering how libraries are used, exploring open source.

github-release-management

16
from diegosouzapw/awesome-omni-skill

Comprehensive GitHub release orchestration with AI swarm coordination for automated versioning, testing, deployment, and rollback management

github-ops

16
from diegosouzapw/awesome-omni-skill

Workflow for repository reconnaissance and operations using GitHub CLI (gh). Optimizes token usage by using structured API queries instead of blind file fetching.