github / github/copilot-cli

Per-agent provider selection for custom agents

未关闭
#4,703 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

area:agents area:models
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

I know about BYOK (COPILOT_PROVIDER_BASE_URL plus COPILOT_MODEL), /model, and the model field in custom-agent frontmatter. We use all three. None of them lets two agents in one session talk to two different endpoints, because COPILOT_PROVIDER_BASE_URL is process-wide and nothing scopes it to an agent. That is the difference between this and #3624 and copilot-sdk#1545, both closed within hours pointing at the BYOK docs.

The ask

A provider field in custom-agent frontmatter. Or the per-agent env/env_file scoping that #2879 proposes for secrets, which would do the same job. The main agent keeps the session provider. The subagent gets its own base URL.

What the runtime already does

I put a recording HTTP server at COPILOT_PROVIDER_BASE_URL on 1.0.83-3 and dispatched a custom agent through the task tool. Three requests came out of one session:

1  model=local-worker-model  tools=24  main agent
2  model=ROUTE-ME-LOCAL      tools=1   subagent; model from its .agent.md frontmatter,
                                       its own instructions in the system prompt
3  model=local-worker-model  tools=24  main agent

The model override on the task tool arrives the same way. The per-agent model id already reaches the provider, and v1.0.62 ("Keep custom agents on their configured model when using BYOK providers") and v1.0.65 for subagents made that deliberate. What it cannot carry is an endpoint to send that id to.

Use case

A cloud main agent plans and reviews. It hands renames, comment edits, log lines and single-file changes to a subagent running a 27B model on the developer's Mac (MLX, 48 GB). Those tokens cost nothing. I am not claiming the local model matches the cloud one. On our own eight-task benchmark two local models came out indistinguishable from each other, and the only claim I will stand behind is free tokens for mechanical work. Judgement stays in the cloud.

What we tried

A routing proxy at COPILOT_PROVIDER_BASE_URL, keyed on the model id. Known local ids go to the MLX server and the proxy forwards the rest to GitHub. Two problems killed it. It puts the main agent's traffic through GitHub endpoints that are not documented for that use. And the docs say "A declared model or effort that can't be honored falls back to the session's value instead of failing the dispatch", so any proxy error on a local id sends that task to the session model instead. You find out from the bill rather than from an error.

Related

  • #2879 asks for per-agent env:/env_file: to isolate secrets. Same mechanism, different reason for wanting it.
  • #2728 asks for per-agent LSP config, so per-agent configuration beyond model is a shape this project already accepts.
  • #3709, #3282, #1354, #2554 and #2758 want the model version of this. A commenter on #3709 already asked for subagents to use the other models a provider offers.
  • copilot-sdk#1544 named routing subagent tasks to a local endpoint. Its author closed it 14 minutes later while still investigating, and nobody from GitHub replied.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 task tool 的 dispatch 路径和 custom-agent frontmatter 处理开始,然后跟踪会话范围的 COPILOT_PROVIDER_BASE_URL 和每个 agent 的模型如何到达 provider。定义 subagent 如何选择自己的 endpoint,同时主 agent 保留会话 provider,并验证包含这两个 agent 的会话是否能正确路由请求,而不会因 fallback 产生混淆。

由索引模型根据 Issue 内容生成。

评估

领域
ai, cli
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。