Switch from Copilot Proxy to CAPI#318443
Draft
guomaggie wants to merge 4 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Replaces the hardcoded ProxyAgenticEndpoint (with model vscode-agentic-search-router-a) used by the search subagent with a new SearchAgentChatEndpoint based on a CAPI-advertised search-agent family model, and gates the SearchSubagent/ExploreSubagent tools on availability of that model.
Changes:
- Introduce
SearchAgentChatEndpointextendingCopilotChatEndpointwith custom token limits (260000 prompt / 16000 output) and aSEARCH_AGENT_FAMILYconstant. - Update
SearchSubagentToolCallingLoopto discover the search-agent endpoint fromendpointProvider.getAllChatEndpoints()instead of constructingProxyAgenticEndpoint, falling back to the main agent endpoint on failure. - Gate
SearchSubagentandExploreSubagenttool availability inagentIntenton the presence of asearch-agentfamily endpoint.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/platform/endpoint/node/searchAgentChatEndpoint.ts | New endpoint class wrapping CopilotChatEndpoint with search-agent-specific token limits. |
| extensions/copilot/src/extension/prompt/node/searchSubagentToolCallingLoop.ts | Switches endpoint resolution from ProxyAgenticEndpoint to CAPI-discovered SearchAgentChatEndpoint with fallback. |
| extensions/copilot/src/extension/intents/node/agentIntent.ts | Adds availability check for the search-agent family to gate subagent tools. |
Copilot's findings
- Files reviewed: 3/3 changed files
- Comments generated: 3
Comment on lines
+97
to
+109
| // Use the CAPI search-agent model. Fall back to the main agent endpoint if the model | ||
| // is not available for this user | ||
| try { | ||
| const allEndpoints = await this.endpointProvider.getAllChatEndpoints(); | ||
| const searchAgentEndpoint = allEndpoints.find(e => e.family === SEARCH_AGENT_FAMILY); | ||
| if (searchAgentEndpoint instanceof ChatEndpoint) { | ||
| return this.instantiationService.createInstance(SearchAgentChatEndpoint, searchAgentEndpoint.modelMetadata); | ||
| } | ||
| this._logService.warn(`Search-agent model not available in CAPI, falling back to main agent endpoint`); | ||
| } catch (error) { | ||
| this._logService.warn(`Failed to get search-agent endpoint from CAPI, falling back to main agent: ${error}`); | ||
| } | ||
| return await this.endpointProvider.getChatEndpoint(this.options.request); |
There was a problem hiding this comment.
Keeping both paths; the checks happen at different times - agentIntent.ts for whether we expose the tool when the req starts, and getEndpoint for when we pick the endpoint at fetch time.
Comment on lines
+150
to
+151
| const allEndpoints = await endpointProvider.getAllChatEndpoints().catch(() => [] as IChatEndpoint[]); | ||
| const searchAgentAvailable = allEndpoints.some(e => e.family === SEARCH_AGENT_FAMILY); |
guomaggie
commented
May 26, 2026
| } catch (error) { | ||
| this._logService.warn(`Failed to get search-agent endpoint from CAPI, falling back to main agent: ${error}`); | ||
| } | ||
| return await this.endpointProvider.getChatEndpoint(this.options.request); | ||
| } | ||
|
|
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Currently, we use copilot-proxy as a go-between to get access from VS Code to models hosted in Fireworks. This PR covers changes needed to switch to CAPI: