[FEATURE] Design trusted Agent identity for outbound model requests

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
go

调研方向

Start by reading the Actor identity work in #3359, #3361, and #3362, then trace how model requests reach an explicitly configured gateway and how agentgateway keys usage limits. Decide which component verifies and resolves the Agent identity, how failures behave, and whether token injection or Actor labels are needed. Validate the design with two Agents sharing an AgentTemplate and ModelConfig: each should receive separate limits, regardless of a caller-supplied identity header.

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

描述

📋 Prerequisites
📝 Feature Summary

No response

❓ Problem Statement / Motivation

Agentgateway needs to track model usage and enforce token limits per kagent Agent. Two Agents can share an AgentTemplate and ModelConfig but still need separate limits. This must work across the kagent, Claude, Codex, and BYO harnesses.

#2737 proposed sending X-Agent-Id. PR #2901 demonstrated that this gives two Agents separate agentgateway buckets (end-to-end result). However, review found that sendAgentIDHeader is too specific, could send identity to unintended model endpoints, and produces a header that an agent process could forge. The Claude harness requirement also shows why a solution confined to one compiler is insufficient.

We agreed to design a general, trusted way to identify the Agent on outbound requests before continuing #2901 (discussion).

💡 Proposed Solution

Use the merged Actor identity work as the starting point: #3359 and #3361 provide gateway-injected Actor JWTs, and #3362 lets a downstream service resolve an Actor token to the actual kagent Agent. For model requests sent to an explicitly configured gateway, explore having that gateway verify the token, resolve the Agent, and use the Agent identity as its usage and limit key. The credential must not reach the upstream model provider, and a caller-supplied X-Agent-Id must not be trusted.

The design should decide:

  1. Whether the existing Actor token and ResolveAgentIdentity are sufficient, or whether Actor labels from Substrate #186 and #3208 are needed.
  2. Whether current placeholder-based token injection is sufficient, or whether to depend on Substrate #3137, which proposes injection without a client-supplied placeholder.
  3. Which component verifies the token and resolves the Agent, how failures are handled, and what agentgateway changes are needed to key limits by verified identity.

Validate the agreed design with two Agents sharing an AgentTemplate and ModelConfig: they should receive separate limits, and changing a caller-supplied identity header should not change which Agent is charged.

Related discussion: Substrate egress proposal, Quentin’s Codex implementation and test, and agreement to continue in a design issue

🔄 Alternatives Considered

No response

🎯 Affected Service(s)

None

📚 Additional Context

No response

🙋 Are you willing to contribute?
  • I am willing to submit a PR for this feature
主要语言
Go
星标
4.5k
派生
937
平均合并
1 天 10 小时
30 天内合并 PR
150

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

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

从这里开始

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

kagent-dev/kagent 的其他 Issue

查看 kagent-dev/kagent 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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