copilot-sdk
Frameworkgithub/copilot-sdk
Multi-platform SDK for integrating GitHub Copilot Agent into applications.
Overview
The GitHub Copilot SDK provides a production-tested agent runtime for embedding Copilot's agentic workflows into your applications. It supports Python, TypeScript, Go, .NET, Java, and Rust, managing the Copilot CLI process via JSON-RPC. Requires a GitHub Copilot subscription or BYOK.
README Preview
# GitHub Copilot CLI SDKs\n\n\n\n[](https://www.npmjs.com/package/@github/copilot-sdk)\n[](https://pypi.org/project/github-copilot-sdk/)\n[](https://www.nuget.org/packages/GitHub.Copilot.SDK)\n[](https://pkg.go.dev/github.com/github/copilot-sdk/go)\n[](https://crates.io/crates/github-copilot-sdk)\n[](https://central.sonatype.com/artifact/com.github/copilot-sdk-java)\n\nAgents for every app.\n\nEmbed Copilot's agentic workflows in your application with the GitHub Copilot SDK for Python, TypeScript, Go, .NET, Java, and Rust.\n\nThe GitHub Copilot SDK exposes the same engine behind Copilot CLI: a production-tested agent runtime you can invoke programmatically. No need to build your own orchestration—you define agent behavior, Copilot handles planning, tool invocation, file edits, and more.\n\n## Available SDKs\n\n| SDK | Location | Cookbook | Installation |\n| ------------------------ | ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| **Node.js / TypeScript** | [`nodejs/`](./nodejs/) | [Cookbook](https://github.com/github/awesome-copilot/blob/main/cookbook/copilot-sdk/nodejs/README.md) | `npm install @github/copilot-sdk`
FAQ (4)
TroubleshootingHow do I stop Copilot SDK from routing 127.0.0.1 or localhost requests through an HTTP proxy?
Set loopback addresses in NO_PROXY so local BYOK endpoints bypass the proxy:
export NO_PROXY="127.0.0.1,::1,localhost"
export no_proxy="127.0.0.1,::1,localhost"
On Windows (PowerShell):
$env:NO_PROXY="127.0.0.1,::1,localhost"
$env:no_proxy="127.0.0.1,::1,localhost"
Restart VS Code after setting the variable. A permanent fix was added in the Agent Host PR to automatically append loopback hosts to NO_PROXY when it injects HTTP_PROXY/HTTPS_PROXY; update to a VS Code/Copilot SDK release containing that change.
TroubleshootingWhy does `send_and_wait` resolve early with the wrong result when a spawned sub-agent fails or becomes idle in the Copilot SDK Rust session?
This is a bug in github/copilot-sdk Rust v1.0.14 with CLI runtime 1.0.84-5. The CLI re-emits sub-agent events on the parent session stream with the child's agent_id, but handle_notification in rust/src/session.rs lets every session.idle, session.error, and assistant.message complete the parent's send_and_wait waiter without checking agent_id.
Fix it by upgrading to a release containing the PR fix(rust): only root-agent events complete send_and_wait. As a temporary local patch, restrict waiter completion and last-message updates to root-agent events only:
// In the send_and_wait waiter arm of handle_notification
let is_root_event = notification
.agent_id
.as_ref()
.is_none_or(|id| id == &root_agent_id);
if is_root_event {
match notification.method.as_str() {
"session.idle" | "session.error" => {
// resolve the waiter
}
"assistant.message" => {
// update the waiter's last message
}
_ => {}
}
}
Child-tagged events should still be forwarded to on_event; they must only be ignored by the send_and_wait waiter. Verify with a regression test where an in-flight parent wait receives session.error with a child agent_id and remains pending, then resolves only after a root session.idle.
TroubleshootingWhy does Client::create_session hang when a SessionFsProvider is bound in the Copilot SDK Rust crate?
The deadlock occurs because session.create is sent before the session event loop is started. During creation, the CLI sends inbound sessionFs.stat/sessionFs.writeFile requests, but nothing dispatches them yet, so the RPC waits indefinitely. This was fixed in PR fix(rust): start the session event loop before the session.create RPC by spawning the event loop before calling session.create, matching the existing session.resume behavior. Upgrade to a release containing that fix. On rust/v1.0.14, the workaround is to patch start_prepared_create in rust/src/session.rs so spawn_event_loop runs before call_with_inline_callback.
TroubleshootingIs it a bug if the Rust router enqueues a request through a sender cloned before the session registration is replaced?
No code fix is required. This is not an observable bug. The router task is the sole producer for each per-session channel, and unbounded sends do not block. Therefore, sending through a sender cloned before a concurrent re-registration is equivalent to linearizing that send at lookup time, before the replacement. Holding the router lock across enqueue changes no reachable outcome. Session-ID reuse, unknown-session dropping, and the wire protocol remain unchanged.