Skip to content

Migrate to GitHub Copilot SDK for background agent functionality (bundled)#5

Draft
Copilot wants to merge 8 commits intomainfrom
copilot/use-new-copilot-sdk
Draft

Migrate to GitHub Copilot SDK for background agent functionality (bundled)#5
Copilot wants to merge 8 commits intomainfrom
copilot/use-new-copilot-sdk

Conversation

Copy link

Copilot AI commented Jan 19, 2026

Replaces direct vscode.lm Language Model API calls with the GitHub Copilot SDK (technical preview, Jan 14 2026) for background agent execution. The SDK and CLI are bundled with the extension - no separate installation or configuration required!

Changes

New CopilotSDKService (src/CopilotSDKService.ts)

  • Wraps Copilot SDK with dynamic import for ES module compatibility
  • Manages session lifecycle and streaming responses
  • Uses bundled SDK/CLI (included as npm dependency)
  • No fallback - SDK is mandatory for extension functionality

Updated AIPackageGenerator (src/AIPackageGenerator.ts)

  • Simplified sendAIRequest() method - SDK only (no fallback)
  • All AI requests route through SDK service layer
  • Session cleanup in finally blocks
  • Removed vscode.lm fallback logic (~140 lines removed)

Updated CreateNodePanel (src/CreateNodePanel.ts)

  • Removed CLI installation checks (SDK is bundled)
  • Direct usage - extension works out of the box

Configuration

  • Dependency: @github/copilot-sdk@0.1.22 (bundled, latest version)
  • Removed rosPackageCreator.useCopilotSDK setting (SDK now mandatory)
  • Removed rosPackageCreator.copilotCLIPath setting (no configuration needed)
  • Only remaining setting: rosPackageCreator.maxAIResponseSize for response size control

Documentation

  • Updated to clarify SDK/CLI are bundled with extension
  • Removed installation instructions (no separate installation needed)
  • Removed CLI path configuration references
  • Simplified troubleshooting (no installation or configuration scenarios)

Implementation Notes

Single code path - SDK is bundled as an npm dependency. The extension works immediately after installation with zero setup and zero configuration required. The SDK package includes the CLI binary, so users don't need to install or configure anything.

// SDK is imported directly - always available since it's bundled
this.CopilotSDK = await import('@github/copilot-sdk');
// Client uses bundled CLI automatically
this.client = new this.CopilotSDK.CopilotClient({
  useStdio: true,
  logLevel: 'error',
  autoStart: true,
  autoRestart: true
});

Benefits:

  • ✅ Zero setup required - works out of the box
  • ✅ Zero configuration required - no settings to adjust
  • ✅ Single, testable code path
  • ✅ Simpler architecture (removed installation and configuration complexity)
  • ✅ Better user experience - no installation prompts or configuration needed
  • ✅ SDK bundled like any other npm dependency
  • ✅ Latest SDK version (0.1.22) with all recent improvements and bug fixes
Original prompt

This section details on the original issue you should resolve

<issue_title>[feature] Use new Github Copilot SDK for background instead of using LLM directly</issue_title>
<issue_description>what is needed
Visual Studio Code implemented a new background agent SDK, which adds an API for an extension to use to perform what this extension was trying to do manually.

why is it needed
Manual implementation has been problematic.</issue_description>

<agent_instructions>Propose a plan before implementing.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 19, 2026 02:13
Co-authored-by: ranchhandrobotics <93450393+ranchhandrobotics@users.noreply.github.com>
Co-authored-by: ranchhandrobotics <93450393+ranchhandrobotics@users.noreply.github.com>
Co-authored-by: ranchhandrobotics <93450393+ranchhandrobotics@users.noreply.github.com>
Copilot AI changed the title [WIP] Update extension to use new Github Copilot SDK for background Migrate to GitHub Copilot SDK for background agent functionality Jan 19, 2026
@ranchhandrobotics
Copy link
Contributor

@copilot I'd rather have only one codepath to test - instead if the sdk isn't installed offer to install it for them, otherwise the extension is not available.

Co-authored-by: ranchhandrobotics <93450393+ranchhandrobotics@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 19, 2026

@copilot I'd rather have only one codepath to test - instead if the sdk isn't installed offer to install it for them, otherwise the extension is not available.

Implemented single code path as requested. The extension now:

  1. Requires GitHub Copilot SDK (no fallback to vscode.lm)
  2. Offers installation when CLI not found - shows modal with "Install Now" / "Learn More" / "Cancel" options
  3. Blocks functionality until SDK is available

All fallback code removed (~140 lines). Extension validates CLI presence before opening UI and provides guided installation.

Commit: 695edda

Copilot AI changed the title Migrate to GitHub Copilot SDK for background agent functionality Migrate to GitHub Copilot SDK for background agent functionality (SDK required) Jan 19, 2026
@ranchhandrobotics
Copy link
Contributor

@copilot since the sdk is available as an npm package why can't we install it into the extension and carry it with us?

Co-authored-by: ranchhandrobotics <93450393+ranchhandrobotics@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 19, 2026

@copilot since the sdk is available as an npm package why can't we install it into the extension and carry it with us?

You're absolutely right! The SDK is already bundled as an npm dependency (@github/copilot-sdk@0.1.13), which includes the CLI binary.

Removed all installation prompts and checks - the extension now works out of the box with the bundled SDK. No separate installation needed!

Changes:

  • Removed CLI installation check and prompt dialog
  • Simplified SDK initialization to use bundled CLI
  • Updated docs to clarify SDK is bundled with extension

Commit: 06d267f

Copilot AI changed the title Migrate to GitHub Copilot SDK for background agent functionality (SDK required) Migrate to GitHub Copilot SDK for background agent functionality (bundled) Jan 19, 2026
@ranchhandrobotics
Copy link
Contributor

@copilot we shouldn't need the cli setting if we include the sdk with our extension

Co-authored-by: ranchhandrobotics <93450393+ranchhandrobotics@users.noreply.github.com>
Copy link
Author

Copilot AI commented Jan 19, 2026

@copilot we shouldn't need the cli setting if we include the sdk with our extension

Agreed! Removed the copilotCLIPath setting completely. Since the SDK is bundled with the extension, no CLI path configuration is needed.

The extension now has zero configuration requirements - it just works out of the box using the bundled SDK/CLI.

Commit: 98ae277

@ranchhandrobotics
Copy link
Contributor

@copilot Update this change to 0.1.8, with the documentation at https://github.com/github/copilot-sdk/tree/main/nodejs

Copy link
Author

Copilot AI commented Feb 6, 2026

@copilot Update this change to 0.1.8, with the documentation at https://github.com/github/copilot-sdk/tree/main/nodejs

I checked the available versions of @github/copilot-sdk and version 0.1.8 doesn't exist. The available versions jump from 0.0.1 to 0.1.9.

Did you mean:

  • 0.1.18 (latest stable before preview versions)?
  • 0.1.22 (latest version overall)?
  • 0.1.9 (earliest in 0.1.x series)?

Please clarify which version you'd like me to use, and I'll update the dependency accordingly.

@ranchhandrobotics
Copy link
Contributor

@copilot yes, i meant the latest - which is 0.1.22

Co-authored-by: ranchhandrobotics <93450393+ranchhandrobotics@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 6, 2026

@copilot yes, i meant the latest - which is 0.1.22

Updated to @github/copilot-sdk@0.1.22 (latest version).

The upgrade completed successfully:

  • ✅ Dependencies installed
  • ✅ Code compiles without errors
  • ✅ Passes all linting checks
  • ✅ No API breaking changes detected

Commit: 367ff90

@ranchhandrobotics
Copy link
Contributor

Don't forget to use copilot sdk to list the models that copilot sdk can access, and expose them to the webview. I don't think copilot sdk exposes an auto mode, so I think we need to expose the raw models and save the last selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] Use new Github Copilot SDK for background instead of using LLM directly

2 participants