intellectronica/copilot-sdk
This skill helps with GitHub Copilot SDK work across Node.js/TypeScript, Python, Go, .NET, and Java. It covers setup, authentication, permissions, streaming events, custom tools, custom agents, MCP servers, hooks, skills, and session persistence.
npx skills add https://github.com/intellectronica/agent-skills --skill copilot-sdk
The GitHub Copilot SDK exposes the same Copilot CLI agent runtime over JSON-RPC, so apps can drive Copilot programmatically instead of building their own orchestration layer.
Status: Public preview
SDKs: Node.js/TypeScript, Python, Go, .NET, Java
Architecture: Application -> SDK client -> JSON-RPC -> Copilot CLI
When helping with the Copilot SDK:
docs/ as the source of truth for shared behavior.listModels() is available.go tool bundler workflow.github/copilot-sdk-java and expects the CLI to be installed separately.DefaultAzureCredential.approveAllPermissionHandler.approve_allcopilot.PermissionHandler.ApproveAllPermissionHandler.ApproveAllPermissionHandler.APPROVE_ALLdisconnect()destroy()sessionId when creating them.cliUrl.copilot --headless --port 4321
client.listModels() and the official supported-models page.reasoningEffort exists for models that support it.| SDK | Install |
| --- | --- |
| 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 |
| Java | Maven/Gradle package com.github:copilot-sdk-java |
Pick the setup that matches the application shape:
cliUrl.Use the same mental model in every language:
send() if you need streaming or progress.send() or sendAndWait().session.idle or the returned final message.disconnect() the session and stop/dispose the client.import { CopilotClient, approveAll } from "@github/copilot-sdk";
const client = new CopilotClient();
await client.start();
const session = await client.createSession({
model: "gpt-5",
streaming: true,
onPermissionRequest: approveAll,
});
session.on("assistant.message_delta", (event) => {
process.stdout.write(event.data.deltaContent ?? "");
});
await session.sendAndWait({ prompt: "What is 2+2?" });
await session.disconnect();
await client.stop();
Common operations across SDKs:
start(), stop(), forceStop()createSession(), resumeSession(), disconnect()send(), sendAndWait(), abort(), getMessages()listModels(), listSessions(), getStatus() / ping()assistant.message.assistant.message_delta.session.idle is the reliable "turn complete" signal.See references/event-system.md.
defineTool(...) with Zod or raw JSON Schema.@define_tool with Pydantic models.DefineTool(...).AIFunctionFactory.Create(...).overridesBuiltInTool: trueoverrides_built_in_tool=TrueOverridesBuiltInTool = trueAdditionalProperties["is_override"] = trueskipPermission.customAgents lets you define sub-agents per session.mcpServers attaches local or remote MCP servers.onPreToolUse, onPostToolUse, onUserPromptSubmitted, and lifecycle/error hooks.skillDirectories; disable selectively with disabledSkills.See references/cli-agents-mcp.md.
mode: "immediate" for steering and mode: "enqueue" for queueing.commands.onUserInputRequest.session.ui when the connected client supports them.TelemetryConfig.onGetTraceContext callback for outbound propagation.sessionId for resumable sessions.infiniteSessions for long-running workflows that may need compaction.~/.copilot/session-state/ unless configuration overrides it.| Concept | TypeScript | Python | Go | .NET | Java |
| --- | --- | --- | --- | --- | --- |
| Create session | createSession() | create_session() | CreateSession() | CreateSessionAsync() | createSession() |
| Resume session | resumeSession() | resume_session() | ResumeSession() | ResumeSessionAsync() | resumeSession() |
| Final content | event.data.content | event.data.content | *event.Data.Content | evt.Data.Content | event.getData().content() |
| Delta content | event.data.deltaContent | event.data.delta_content | *event.Data.DeltaContent | evt.Data.DeltaContent | event.getData().deltaContent() |
| Skills field | skillDirectories | skill_directories | SkillDirectories | SkillDirectories | setSkillDirectories(...) |
destroy() still appears in older examples but disconnect() is the current method.assistant.message and assistant.message_delta use event.data.*, not top-level event.content.send().sessionId is awkward to operationalize.references/working-examples.md - current starter examples, including tools and resume patternsreferences/event-system.md - event names, lifecycle, and language access patternsreferences/cli-agents-mcp.md - custom agents, skills, MCP, headless CLI, and config locationsreferences/troubleshooting.md - common failures, debug logging, auth, permissions, and transport issuesTake intellectronica/copilot-sdk from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference pip, npm.
Without those the skill loads but fails at the first command.