Intelligent Agent Router
A VS Code extension that intelligently routes prompts to free or premium Copilot models based on complexity and length analysis.
Features
Automatic Complexity Analysis: Analyzes prompts based on:
- Technical term density
- Sentence complexity
- Code block presence
- Question depth
- Overall length
Smart Model Routing: Automatically selects between free and premium Copilot models based on configurable thresholds
Manual Model Selection: Override automatic routing with --model parameter
Copilot Chat Integration: Use @agent-router directly in Copilot Chat
Help Command: Type help to see all features and usage examples
Visual Analysis: Real-time complexity scoring and routing decision display
Quick Start
- Open Copilot Chat (
Ctrl+Alt+I)
- Type:
@agent-router What is Docker?
- See automatic complexity analysis and model selection
Usage
Automatic Routing (Default)
@agent-router What is Docker?
@agent-router Explain machine learning algorithms with examples
Manual Model Selection
@agent-router --model gpt-5 What is quantum computing?
@agent-router --model claude-sonnet-4.5 Help me optimize this code
@agent-router --model gpt-4o Simple explanation of APIs
Get Help
@agent-router help
@agent-router --help
@agent-router features
Configuration
Configure the extension via VS Code settings:
{
"intelligentAgentRouter.complexityThreshold": 70,
"intelligentAgentRouter.lengthThreshold": 500,
"intelligentAgentRouter.enableAutoRouting": true
}
Settings
complexityThreshold (default: 70): Complexity score (0-100) threshold to route to premium Copilot model
lengthThreshold (default: 500): Character count threshold to route to premium Copilot model
enableAutoRouting (default: true): Enable/disable automatic routing
Available Models
Free Tier Models
gpt-4o - Fast, general purpose
gpt-5-mini - Lightweight alternative
gpt-4.1 - Legacy model
Premium Tier Models
claude-sonnet-4.5 - Advanced reasoning (default for complex prompts)
gpt-5.2 - Latest GPT model
claude-opus-4.5 - Maximum capability
claude-haiku-4.5 - Fast premium option
gemini-2.5-pro - Google's advanced model
- And more...
How It Works
The extension evaluates prompts using multiple factors:
- Technical Terms (×5 weight): Counts occurrences of technical keywords
- Sentence Complexity (×10 weight): Analyzes average sentence length
- Code Blocks (×15 weight): Detects code snippets in the prompt
- Question Depth (×20 weight): Evaluates question complexity (multi-part, conditional, comparative)
- Length Bonus: Considers overall prompt length
Based on these factors, a complexity score (0-100) is calculated. Prompts exceeding the complexity or length threshold are routed to premium Copilot models.
Installation
From VSIX Package
- Download the
.vsix file
- Open VS Code
- Go to Extensions view (
Ctrl+Shift+X)
- Click "..." menu → "Install from VSIX..."
- Select the downloaded
.vsix file
From Source
- Clone this repository
- Run
npm install to install dependencies
- Run
npm run compile to build
- Press
F5 to launch the extension in debug mode
Development
Build
npm run compile
Watch mode
npm run watch
Lint
npm run lint
Requirements
- VS Code 1.85.0 or higher
- Node.js 18.x or higher
Extension Settings
This extension contributes the following settings:
intelligentAgentRouter.complexityThreshold: Complexity score (0-100) to trigger premium model selection
intelligentAgentRouter.lengthThreshold: Character count to trigger premium model selection
intelligentAgentRouter.enableAutoRouting: Enable/disable automatic model routing
Release Notes
0.0.1
Initial release with:
- Prompt complexity analysis across 5 dimensions
- Automatic Copilot model routing (free vs premium)
- Manual model selection with
--model parameter
- Copilot Chat integration with
@agent-router
- Help command for feature discovery
- Real-time complexity scoring and model selection display
- Support for all available Copilot models
License
MIT