copilot-sdk

Embed GitHub Copilot agentic workflows into applications using Python, TypeScript, Go, or .NET.

25|4|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/thangchung/agent-engineering-experiment --skill copilot-sdk-thangchung
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: copilot-sdk
Source: https://github.com/thangchung/agent-engineering-experiment/tree/main/foundry-agentfx/.github/skills/copilot-sdk
Command: npx skills add https://github.com/thangchung/agent-engineering-experiment --skill copilot-sdk-thangchung

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building agentic AI features into applications normally requires implementing your own orchestration, tool invocation, and session management. This Skill provides the GitHub Copilot SDK, which exposes the production-tested agent runtime behind Copilot CLI so you can invoke planning, tool calls, and file edits programmatically. ## Core Features & Use Cases - Programmable Agent Sessions: Create sessions, send prompts, stream responses, and persist conversations across restarts in Python, TypeScript, Go, or .NET. - Custom Tools and Agents: Define tools with schemas and handlers that Copilot invokes during reasoning, plus custom agent personas and system messages. - MCP Server Integration: Connect sessions to Model Context Protocol servers such as the GitHub MCP server for repository, issue, and PR access. - Use Case: Build an interactive CLI weather assistant where Copilot decides when to call your get_weather tool, streams the answer token by token, and maintains multi-turn context. ## Quick Start Ask the agent to create a Copilot SDK session in TypeScript that sends a prompt with streaming enabled and prints the response.

Frequently Asked Questions about copilot-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I embed GitHub Copilot in my application?▼

Install the Copilot SDK package for your language (@github/copilot-sdk for Node.js, github-copilot-sdk for Python, or equivalents for Go and .NET), create a CopilotClient, open a session with a model like gpt-4.1, and call sendAndWait with your prompt.

How do I define custom tools for Copilot SDK agents?▼

Use defineTool with a name, description, parameter schema, and handler function, then pass the tool in the session configuration. Copilot decides when to invoke it based on the user question and your tool description, and the handler result is fed back into the response.

Which languages does the GitHub Copilot SDK support?▼

The SDK supports TypeScript/Node.js 18+, Python 3.8+, Go 1.21+, and .NET 8.0+. All languages require the GitHub Copilot CLI installed and authenticated, since the SDK communicates with the CLI process over JSON-RPC.

Can Copilot SDK connect to MCP servers?▼

Yes, pass an mcpServers map in the session configuration with the server type and URL, such as the GitHub MCP server at https://api.githubcopilot.com/mcp/. This gives the session access to pre-built tools for repositories, issues, and pull requests.

Is the GitHub Copilot SDK production ready?▼

No, the SDK is in Technical Preview and may introduce breaking changes, so it is not recommended for production use yet. It is suitable for prototyping agentic features and evaluating the runtime.

Why does Copilot SDK fail with ENOENT or ECONNREFUSED errors?▼

ENOENT means the Copilot CLI is not installed or not on the system PATH, while ECONNREFUSED means the SDK cannot reach the CLI server. Verify the CLI with copilot --version, or start an external server with copilot --server --port 4321 and connect via cliUrl.