microsoft / microsoft/vscode

Support registration of external agents via Extension API in the agents view

Open
#325,827 1 comment 8 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

## Summary

Currently, VS Code supports adding **custom prompt-based agents** through `vscode.chat.registerCustomAgentProvider()` (via `.agent.md` files), but there is no Extension API mechanism to register full **Agent Host providers** (like `CopilotAgent`, `ClaudeAgent`, or `CodexAgent`) that implement the `IAgent` interface with their own SDK integration.

This feature request seeks to enable extensions to register complete agent implementations that integrate with the VS Code Agent Host architecture, allowing third-party developers to bring their own language models and agent SDKs into the agents view alongside the built-in agents.

## Problem Statement

Users want to integrate external agents (not just Claude/Copilot/Codex) into their local agent orchestration workflows via CLI. Currently:

1. **Custom agents** (prompt-based) can only wrap existing harnesses and cannot add new Agent Host providers
2. **Agent Host providers** require modifying VS Code's core code in `agentHostMain.ts`
3. Extensions have no way to register full `IAgent` implementations with custom SDKs
4. The agent picker only shows agents registered through hardcoded provider registration, limiting extensibility

## Desired Behavior

Extensions should be able to:

1. **Implement a new `vscode.AgentHostProvider` interface** that allows registration of full agent implementations
2. **Register agents via `vscode.agentHost.registerAgentProvider()`** with complete SDK integration
3. **Dynamically appear in the agents picker** without modifying VS Code source code
4. **Support both local and remote agent orchestration** workflows
5. **Advertise agent capabilities** (`getDescriptor().capabilities`) to the platform

### Example Usage (proposed API)

```typescript
// extension.ts
import * as vscode from 'vscode';

class MyCustomAgent implements vscode.AgentHost {
// Implementation details for IAgent interface
// - Create/manage chats via SDK
// - Handle session lifecycle
// - Emit progress signals
readonly descriptor = {
id: 'my-custom-agent',
displayName: 'My Custom Agent',
capabilities: { /* ... */ }
};

async createChat(options: vscode.CreateChatOptions) { /* ... */ }
async disposeChat(sessionId: string) { /* ... */ }
// ... other IAgent methods
}

export function activate(context: vscode.ExtensionContext) {
const agent = new MyCustomAgent();
context.subscriptions.push(
vscode.agentHost.registerAgentProvider(agent)
);
}
```

## Technical Details

**Current Architecture:**
- `IAgent` interface is defined in `src/vs/platform/agentHost/common/agentService.ts`
- Agents are registered in `src/vs/platform/agentHost/node/agentHostMain.ts` (hardcoded)
- `ChatCustomAgentProvider` exists in Extension API but only for prompt-based agents

**Proposed Changes:**
1. Expose `vscode.AgentHost` interface (or minimal subset) in the Extension API type definitions
2. Add `vscode.agentHost.registerAgentProvider(provider: vscode.AgentHostProvider)` to the public API
3. Modify the agent service to discover and register extension-provided agent providers at initialization time
4. Route extension-provided agents through the existing agent orchestrator

## Related Issues

- Existing `ChatCustomAgentProvider` API for custom agents
- Agent Host multi-chat architecture in `src/vs/platform/agentHost/`
- Remote agent host dynamic agent discovery already supports dynamic registration

## Notes

This would bring feature parity for local development with the existing remote agent host architecture, which already dynamically discovers agents from `rootState.agents`. The change enables a true plugin model for agent extensibility without requiring core modifications.

Contributor guide

Open the contributing guide

Research direction

Start by reading the IAgent interface in src/vs/platform/agentHost/common/agentService.ts, then trace hardcoded registration in src/vs/platform/agentHost/node/agentHostMain.ts and the existing ChatCustomAgentProvider extension API. Done means extensions can register full agent providers through a public API, their agents appear in the picker, and capabilities are exposed to local and remote orchestration.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
ai, api, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.