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

Aperta
#1,867 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
8/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
devtools, go

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).

Lingua principale
Go
Stelle
31
Fork
49
Merge medio
9h 43m
PR unite (30g)
367

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rossoctl/cortex

Tutte le issue di rossoctl/cortex

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.