Skip to content

Copilot CLI Adapter

The Copilot CLI adapter integrates youBencha with GitHub Copilot CLI for AI-powered code generation and modification.

  1. GitHub Copilot CLI installed:

    Terminal window
    npm install -g @githubnext/github-copilot-cli
  2. GitHub authentication configured:

    Terminal window
    gh auth login
  3. Active GitHub Copilot subscription

agent:
type: copilot-cli
config:
prompt: "Add error handling to all API endpoints"

Always set to copilot-cli for this adapter.

agent:
type: copilot-cli

Specify the AI model to use:

agent:
type: copilot-cli
model: claude-sonnet-4.5

Supported models:

  • claude-sonnet-4.5, claude-sonnet-4, claude-haiku-4.5
  • gpt-5, gpt-5.1, gpt-5.1-codex-mini, gpt-5.1-codex
  • gemini-3-pro-preview

Use a named agent from .github/agents/ directory:

agent:
type: copilot-cli
agent_name: my-custom-agent

When specified:

  1. The .github/agents/ directory is copied to workspace
  2. Agent is invoked with --agent <name> flag
  3. Custom agent instructions are applied

Inline prompt for the agent:

agent:
type: copilot-cli
config:
prompt: "Add JWT authentication to the login endpoint"

Load prompt from external file:

agent:
type: copilot-cli
config:
prompt_file: ./prompts/add-auth.md

Named agents allow you to use custom agent configurations stored in your repository.

your-repo/
└── .github/
└── agents/
├── code-reviewer.agent.md
├── test-writer.agent.md
└── refactorer.agent.md
.github/agents/code-reviewer.agent.md
# Code Reviewer Agent
You are an expert code reviewer. Focus on:
- Code quality and maintainability
- Security vulnerabilities
- Performance issues
- Best practices
Be thorough but constructive.
agent:
type: copilot-cli
agent_name: code-reviewer
config:
prompt: "Review the authentication module"
suite.yaml
name: auth-feature-eval
description: Evaluate authentication implementation
repo: https://github.com/example/api-server.git
branch: main
agent:
type: copilot-cli
model: claude-sonnet-4.5
agent_name: security-focused
config:
prompt_file: ./prompts/add-jwt-auth.md
evaluators:
- name: git-diff
config:
assertions:
max_files_changed: 10
- name: agentic-judge
config:
type: copilot-cli
assertions:
auth_complete: "JWT auth is fully implemented. Score 0-1."

The adapter uses these environment variables:

VariableDescription
GITHUB_TOKENGitHub authentication token
COPILOT_MODELDefault model (can be overridden)
Error: Copilot CLI not found

Solution: Install Copilot CLI:

Terminal window
npm install -g @githubnext/github-copilot-cli
Error: GitHub authentication required

Solution: Authenticate with GitHub:

Terminal window
gh auth login
Error: GitHub Copilot subscription required

Solution: Ensure you have an active Copilot subscription at github.com/settings/copilot.

Error: Model 'xyz' not available

Solution: Check supported models and your subscription tier. Some models require Copilot Enterprise.

  1. Use named agents for consistent behavior across evaluations
  2. Specify models explicitly for reproducible results
  3. Use prompt files for complex instructions
  4. Test authentication before running evaluations