feature: opt-in plugin config to reuse the proxied agent's LLM credentials

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
8/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
活跃
技术栈
devtools, go

调研方向

The payload points at core/plugins/contextguru/plugin.go (incomingModel) as the closest existing in-process version of reusing the agent's credentials. The open questions are design decisions: out-of-process key handling, OAuth token policy, dialects and cost caps. Nothing here is settled, so a newcomer should not start coding; the first step is to comment and ask a maintainer to agree on the design. Done would be a maintainer-approved design, not a patch.

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

描述

enhancement

Summary

Add an opt-in plugin config option that lets a plugin reuse the LLM credentials of the agent Cortex is proxying (endpoint, model, API key), so users don't have to enter separate credentials for plugins that make their own LLM calls. Explicit credentials in the plugin config stay supported and take precedence.

Requested by @vinodmut for the altk-evolve integration; agreed by @huang195 in Slack.

Motivation

Plugins backed by a companion service that makes its own LLM calls (e.g. altk-evolve) currently need their own credentials: an API key, a base URL, and a model, set through env vars, a .env file, or plugin parameters. That's extra setup when the user usually wants the same model the agent already uses.

Today, consent is given by the user explicitly passing credentials as a plugin parameter (e.g. ibac's inference server). Reusing the agent's credentials silently would let a plugin run up token costs without the user knowing, so this must stay opt-in. A config flag keeps the consent explicit and removes the copy-paste.

Proposal

  • A per-plugin config option, e.g. llm.credentials: passthrough (the name is a placeholder), that is off by default.
  • When enabled, the plugin gets the agent's endpoint, model, and Authorization from the live request.
  • Explicit api_key / base_url / model in the plugin config still work, and override passthrough when set.
  • Calls made with reused credentials should carry the existing per-process sentinel header so the pipeline doesn't intercept them again. They should also be attributable (stats/telemetry) so the user can see the token spend a plugin drives.

Prior art

context-guru already does an in-process version of this: model.source: incoming rebuilds the agent's model client from the live request (base URL + token-exchanged Authorization + the request's model). See incomingModel in core/plugins/contextguru/plugin.go. It only supports the OpenAI dialect for now.

Open questions

  • Out-of-process consumers. Evolve's learning step runs later ("once idle") in a separate process, after the request that carried the key has ended. Passthrough there means handing the key to another process, or holding it past the request, which in-process plugins don't do today. Options: Cortex hands the key over at registration time, or Cortex exposes a local relay endpoint the service calls and Cortex injects the agent's credentials there. The relay keeps the key inside Cortex and gives one place to meter spend.
  • Subscription / OAuth tokens. When the agent runs on a Claude subscription, the "key" is an OAuth token, and using it for another service's calls may not be allowed under the provider's terms. Passthrough may need to be refused, or carry a warning, for OAuth-style credentials.
  • Dialects. Anthropic as well as OpenAI (context-guru's incoming is OpenAI-only).
  • Cost guardrails. Possibly an optional per-plugin token/spend cap when passthrough is enabled.

Related

Separate but adjacent: plugins backed by a long-running service (sparc, aiac, sentry, context-guru, Evolve) each need that service started outside Cortex. Hai noted that this pattern keeps coming up and may be worth revisiting, perhaps via a companion-process hook on the laptop supervisor (cortex --supervise).

主要语言
Go
星标
31
派生
49
平均合并
9 小时 43 分钟
30 天内合并 PR
367

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

rossoctl/cortex 的其他 Issue

查看 rossoctl/cortex 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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