Skip to content

Add GitHub Copilot SDK as an AI provider option#222

Open
AyushIIITU wants to merge 3 commits intoKeygraphHQ:mainfrom
AyushIIITU:main
Open

Add GitHub Copilot SDK as an AI provider option#222
AyushIIITU wants to merge 3 commits intoKeygraphHQ:mainfrom
AyushIIITU:main

Conversation

@AyushIIITU
Copy link

@AyushIIITU AyushIIITU commented Mar 6, 2026

Add : Support of Github Copilot

Summary

Integrates GitHub Copilot SDK (@github/copilot-sdk ^0.1.30) into Shannon to provide multi-model routing and enhanced code analysis capabilities. Copilot is optional and fully backward compatible—Claude Agent SDK remains the default. This enables intelligent model selection for vulnerability detection and improved analysis coverage for security assessments.

Root Cause

Shannon currently relies solely on Claude Agent SDK. By adding Copilot SDK support, we can:

  • Route requests to the most appropriate model based on query type
  • Leverage Copilot's code understanding for vulnerability patterns
  • Provide users flexibility to choose their preferred AI backend
  • Enable future multi-model strategies for enhanced accuracy

Fix

  • Added @github/copilot-sdk (^0.1.30) to dependencies
  • Updated src/ai/claude-executor.ts to support Copilot integration
  • Added Copilot initialization in src/session-manager.ts
  • Updated configuration schema to support Copilot settings in YAML configs
  • Added optional GITHUB_TOKEN environment variable for Copilot authentication
  • Falls back gracefully to Claude if Copilot is unavailable

Configuration

Add to .env:

GITHUB_TOKEN=your_github_token_here  # Optional, for Copilot features
COPILOT_PROVIDER=github              # Set to use Copilot (default: anthropic)

Test Plan

Prerequisites

npm install
cp .env.example .env
docker compose build

1. Claude Agent SDK (Default Behavior)

Verify backward compatibility with no GitHub token:

unset GITHUB_TOKEN
./shannon start URL=http://example.com REPO=test-repo

Expected: Agent execution completes using Claude only, no errors.

2. Copilot Integration (With Token)

Test Copilot-enabled execution:

export GITHUB_TOKEN=ghp_your_token_here
export COPILOT_PROVIDER=github
./shannon start URL=http://example.com REPO=test-repo

Expected: Worker logs show "✓ Copilot SDK initialized" and agent execution completes.

3. Authentication Flow

./shannon login

Expected: Successfully validates GitHub token (if set) and Copilot SDK readiness.

4. With Custom Config

Create configs/test-copilot.yaml:

auth:
  type: none
target:
  skipMfa: true
copilot:
  enabled: true
  model: gpt-4

Run:

./shannon start URL=http://example.com REPO=test-repo CONFIG=./configs/test-copilot.yaml

Expected: Uses Copilot settings from config file, generates deliverables correctly.

5. Graceful Fallback

Test fallback when Copilot is unavailable:

export GITHUB_TOKEN=invalid_token
./shannon start URL=http://example.com REPO=test-repo

Expected: Logs warning, falls back to Claude, completes successfully.

6. Verification

After any test run, verify:

docker compose logs -f worker | grep -i copilot

Should show integration status messages.

Check deliverables generated:

ls ./repos/test-repo/deliverables/

Expected: Report, vulnerability analysis, and exploit findings.

Backward Compatibility

✅ Fully backward compatible - Copilot is optional
✅ Claude Agent SDK remains the default
✅ No breaking changes to existing workflows
✅ Works with or without GITHUB_TOKEN set

Notes

  • Copilot requires a valid GitHub token for full functionality
  • Falls back to Claude if Copilot is unavailable or misconfigured
  • Uses PIPELINE_TESTING=true for local development without external APIs
  • No changes to Temporal workflow orchestration required

Closes #193

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]: Add GitHub Copilot SDK as an AI provider option

1 participant