Skip to content

Switch from Copilot Proxy to CAPI#318443

Draft
guomaggie wants to merge 4 commits into
microsoft:mainfrom
guomaggie:maggie/search-subagent-copilot-proxy-to-capi
Draft

Switch from Copilot Proxy to CAPI#318443
guomaggie wants to merge 4 commits into
microsoft:mainfrom
guomaggie:maggie/search-subagent-copilot-proxy-to-capi

Conversation

@guomaggie
Copy link
Copy Markdown
Contributor

@guomaggie guomaggie commented May 26, 2026

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:

  • CAPI returns a list of models available based on a user's SKU, FSI status, etc. We disabled the search subagent tool (for explore as well) if the search subagent models are not in the list of models returned by CAPI. So, if a user is blocked from using Qwen models, they're blocked from using our subagent tool.
  • Updated the search subagent tool to use a CAPI endpoint, instead of proxyAgenticEndpoint

Copilot AI review requested due to automatic review settings May 26, 2026 21:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SearchAgentChatEndpoint extending CopilotChatEndpoint with custom token limits (260000 prompt / 16000 output) and a SEARCH_AGENT_FAMILY constant.
  • Update SearchSubagentToolCallingLoop to discover the search-agent endpoint from endpointProvider.getAllChatEndpoints() instead of constructing ProxyAgenticEndpoint, falling back to the main agent endpoint on failure.
  • Gate SearchSubagent and ExploreSubagent tool availability in agentIntent on the presence of a search-agent family 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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

} 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);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed during testing that the switch will cause backgroundToDoAgent to fail because it requests copilot-fast, which isn't available to free users. Should this change be covered by this PR too (the current PR focuses on supporting search subagent)?

Image

@guomaggie guomaggie marked this pull request as draft May 26, 2026 22:55
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.

4 participants