基于Kubernetes隔离的Agent凭据防护机制

Sycophant把Agent运行在自选Kubernetes集群中,借助Job规格与只读卷让harness按名称引用Secret而不读取其值,并在工具或模型输出返回前对凭据做脱敏,从而在Agent被完全攻陷时仍限制其能力。

![Sycophant](<https://raw.githubusercontent.com/calebfaruki/sycophant/HEAD/docs/logo.png>) ## 自主AI代理的零信任框架. [OpenSSF 记分卡](<https://scorecard.dev/viewer/?uri=github.com/calebfaruki/sycophant>) [咨询 DeepWiki](<https://deepwiki.com/calebfaruki/sycophant>) [与rust一起的Made](<https://www.rust-lang.org/>) 版本 0.1.0 [许可证:AGPL-3.0](<https://github.com/calebfaruki/sycophant/blob/HEAD/LICENSE>) Sycophant主机在库伯内特斯集群中自主的 AI 代理基于最小的特权,零知识和深度的防御,它将代理机生产的一切视为对抗性. > **发行前并处于积极发展阶段.** 期待锋利的边缘。 ## 为什么Sycophant 大部分的代理框架都是为能力而建的,而不是为遏制而建的。隔离是您所选择的,如果你记得的话。 托管的平台采取了另一个极端。模型、您的数据和代理都生活在他们的基础设施上。您得到了控制,但它们是您不拥有的机器上的设置,并以您必须信任的承诺为后盾。 Sycophant 也不是。 您的数据生活在您所选择的基础设施上。 代理只回答您列出的人, 以及他们的绑定聊天控件。 包含是默认的, 而不是附加的 。 ## 被出卖的特工是不会做的 假设该代理被完全颠覆: 即时注射、 有毒工具、 坏模型。 Kubernetes 本身包含它。 每个租户都是一个命名空间, 每个组件都是一个吊舱。 该代理仍然无法 : - **诵一秘密曰.** 代理用名称向工具或模型询问控制器 。 控制器将“ 机密” 命名为“ 任务” , 并且从未读过它 。 只有调用时的显示器才有值 。 - **通过输出泄露一个秘密。** 在工具或模型输出返回代理之前,其中的每一个证书值都成为了编辑标记. - **免费调用网络.** Cilium 给每个吊舱一个默认密度的 Egress 防火墙。 每个工具片只覆盖它宣布的域 。 - **从工具里逃出来。** gVisor sandbox 执行代理工具代码的吊舱,所以一个容器的逃逸停止在沙盒. - **使用特权身份。** 工具吊舱没有 RBAC 。 每个符号只使用一个服务 。 - **重写自己的历史.** 谈话日志只存一卷绳子 工具舱从不看到 - **联系另一个房客。** 每个租户都有自己的网络,储存和身份,没有租户之间的路线. - **解除武装执法。** Kyverno 在其命名空间出现时创建每个租户的 RBAC, 并从它内部块块编辑到安全资源 。 链锯集成测试在直播集群上检查这些规则。每次测试都尝试禁用动作,检查集群拒绝的操作。 ## 快速启动 Sycophant船作为Helm图,有两种方式进入. **CLI:本地,默认安全.** 那个... `sycoadm` CLI 站起一个本地 [k3d](https://k3d.io) 具有全容量堆栈的集群( Q)[见所需经费](#requirements)) 已经接通,然后安装 Hello-world 棋子在 [`examples/sycoadm/`](<https://github.com/calebfaruki/sycophant/blob/main/examples/sycoadm/>)您需要多克, k3d, Go, 一个与 `aarch64-unknown-linux-musl` 目标、jq、舵、kubectl、protoc、cmake、一个C编译器、打开sl、htpasswd、grpcurl、Tailscale 和 GGUF 模型,位于 `~/.cache/sycophant/weights/Qwen3.5-2B-Q4_K_M.gguf`. ```sh make sycoadm syco export PATH="$PWD/target:$PATH" # Create the cluster. Prompts for a sysadmin email and password; idempotent. # Every `up` below prompts for that password and waits for its installer. sycoadm setup sycoadm tenant up -f examples/sycoadm/tenants/hello-world.yaml # The model server and weights images the inference example names. docker pull ghcr.io/ggml-org/llama.cpp:server@sha256:9f84380be42d6285a827629c809387349c3541aa8986f7536547ca33cc8dd47a docker tag ghcr.io/ggml-org/llama.cpp:server@sha256:9f84380be42d6285a827629c809387349c3541aa8986f7536547ca33cc8dd47a llama-server:local docker build -f build/weights.Dockerfile --build-arg GGUF=Qwen3.5-2B-Q4_K_M.gguf \ -t weights:local ~/.cache/sycophant/weights sycoadm inference up -f examples/sycoadm/inference/qwen3-5-2b.yaml sycoadm toolset up -f examples/sycoadm/toolsets/hello-world/values.yaml # The demo secret for toolset hello-world (the agent's # `secret.hello-world.demo-ssh-key` key). Keep it on one line. The # scrubber redacts single-line values. printf '%s' 'hello-world-demo-secret-DO-NOT-USE' \ | sycoadm tenant secret set demo-ssh-key --tenant hello-world sycoadm agent up -f examples/sycoadm/agents/hello-world.yaml sycoadm instructions up -f examples/sycoadm/instructions/hello-world.yaml sycoadm channel up -f examples/sycoadm/channels/tailnet.yaml # Join the tailnet. Needs sudo; once per machine. sycoadm connect --tenant hello-world # Point syco at the relay on the tailnet. mkdir -p ~/.config/syco sed 's/${TAILNET_RELAY_ADDR}/relay:9090/' examples/syco/config.toml > ~/.config/syco/config.toml syco login --email e2e-sysadmin@sycophant.local sycoadm user up -f examples/sycoadm/users/alice.yaml \ --set "user.subject=https://127.0.0.1:30443/dex#$(syco whoami | awk '/^Subject:/ {print $2}')" # Ask the agent to use ShowKernel and to WebFetch https://example.com (it fails: # the toolset has no egress). Ask it to use GetSecret on demo-ssh-key. The # reply shows [REDACTED:demo-ssh-key]. syco chat # Tear down one piece, or everything. sycoadm agent down hello-world --tenant hello-world sycoadm destroy ``` `sycoadm upgrade` 永远不要触碰频道 替换旧的 `app` 升级后的频道,使用 `sycoadm channel down app --tenant <tenant>` 接着是 `channel up` 上方。新频道将尾网作为新节点加入,客户端重新连接。 **公开演讲.** `sycoadm ingress up --domain <name> --vpn-tenant <tenant>` 给出一个公开的 IPv4 地址。它从不触及路由器或 DNS 。第一点是 A 记录。 `<name>` 在此家的公开IPv4 上, 没有 AAAA 记录。 命令会向前打印路由器、 Docker 桌面设置和可选的 CAA 记录, 并手动设定, 然后等待 Enter 。 然后它会从 k3d 发布 443 并部署 Caddy, 它会获得一个加密证书 。 任何失败, 或者 Ctrl- C , 都会撤销每个更改 。 在没有 NAT 循环的路由器上, 如 Livebox , 家用设备需要本地的 DNS 或主机条目 。 `<name>` 给 LAN IPv4. `--vpn-tenant` 这是暂时的。它把凯迪指在该租户的头级阶梯,直到该集群共享的VPN土地。设置该租户的 `headscale.serverUrl` 改为: `https://<name>` 所以设备通过它。 `sycoadm ingress down` 删除什么 `up` 加上,无论有哪个部分, 并打印什么是你的 手去掉。 **DevOps:你自己的集群.** 用 Helm 安装图表 。 `sycophant-quickstart` 图表捆绑 gVisor RuntimeClass 和集群层。安装 `kyverno-crds` 图表和 Kyverno 先([参见先决条件](<https://github.com/calebfaruki/sycophant/blob/main/charts/sycophant-quickstart/README.md#prerequisites>)): ```sh kubectl apply -f charts/sycophant-cluster/system-ns.yaml helm install sycophant charts/sycophant-quickstart \ -n sycophant-system --wait ``` 已经提供了自己的 RuntimeClass ? 跳过捆绑并单独安装集群层 : ```sh helm install sycophant charts/sycophant-cluster \ -n sycophant-system --wait ``` ## 构成部分 ![经过认证的人和渠道(人或频道符)通过继电器控制器网关到达一个每代理机的吊带,吊带运行代理机循环,拥有对话日志,并从只读的卷读其能力目录和指令.它在不同的路径上达到三种能力:它直接拨打的温暖的局部推导服务,没有证书;远程推导任务和工具Job,每个带带子产生的电平光光光沙盒,只有它自己的秘密和自己的网络进化。只有工具Jobs挂载工作空间量。证书只存在于这些工作内部,从没有代理。“宽度=](<https://raw.githubusercontent.com/calebfaruki/sycophant/HEAD/docs/architecture.svg>) | 构成部分 | 作用 | | --- | --- | | **调和** | 代理运行时间和经纪人, 每个代理运行一个。 它驱动代理循环, 拥有对话日志, 并从只读的音量读取自己的指令( AGENTS . md 和技能) 。 它将每个工具呼叫和远程模式调用发送到一个只持有工具盘密钥和 Egress 域的有门的 Job 。 它直接拨打一个温暖的本地模式, 没有证书 。 | | **中继** | 客户端网关。 认证的人和频道( 人或频道标志) 拨号通过它联系他们的代理商, 并传递消息到或从管理器中 。 | | **工具集** | 工具运行时间。 它执行工具调用带子创建的 gVisor 沙盒 。 | 以rust monorepo制成于 gRPC( tonic/ prost), kube- rs 和 Helm 图表上 。 `sycoadm` CLI驱动它,图像瞄准Linux arm64和amd64. ## 所需经费 Sycophant 工作在任何具有三种功能的兼容库伯内特集群上。每个集群是一个可互换的角色,具有合理的默认值 : - **沙盒容器运行时间 :** a `gvisor` RuntimeClass. 它隔离了执行代理工具代码的工具集. - **网络进取控制 :** Cilium (默认- 拒绝 egress with a L7 DNS 允许列表). - **招生政策引擎:** Kyverno 3.9 .x,与它的CRD. `sycoadm setup` 在本地的 k3d 集群上安装此默认设置 。 ## 地方发展 `make` 没有参数 列出每个目标。 `make lint-shell` 需要检查 shell 、 sfmt 和编辑器配置检查器 `scripts/install-test-deps.sh` 安装。本地目标是一个 k3d 集群。 `scripts/e2e.sh` 是 end-to-end 测试: 它构建一个 Hello- world 部署, 并声明安全条款 。 下面的修改会期望租户的命名空间( S) 。`tenant-<10hex>`(单位:千美元) `$NS`与一个租户: ```sh NS=$(kubectl get ns -l app.kubernetes.io/part-of=sycophant-tenant -o name | cut -d/ -f2) ``` - **新鲜二进制的macOS摊位.** XProtect在第一次启动时扫描每个新的二进制,一个大型测试二进制可以坐落在0% CPU为10+分钟时. `syspolicyd` 工作。 等待。 杀死它会重新启动扫描。 在系统设置 → 隐私和安全 → 开发工具 下添加您的终端会跳过扫描 。 - **Docker VM 磁盘,而不是 RAM,是限制.** 一场近乎完整的VM旅行 kubelet 驱赶和一场Kyverno 驱赶风暴,看起来像是记忆问题. Keverno 驱赶风暴 保持关于15 GB的自由. `sycoadm setup` 根据8 GB拒绝. - **重建的图像并不能取代活的图像.** k3d 的容器缓存 `name:tag`。在重新导入前删除旧的 : ```sh docker exec k3d-sycophant-server-0 ctr -n k8s.io image rm docker.io/library/<image>:local k3d image import <image>:local --cluster sycophant kubectl rollout restart deployment/<deployment> -n "$NS" ``` - **断断续续的谈话史** 磁带崩溃的 mid-tool-call 可以留下一个日志 模型拒绝(`tool_use without tool_result`。发送 `/clear` 输入 `syco` 用来清空对话。 图表位于下 [`charts/`](<https://github.com/calebfaruki/sycophant/blob/main/charts/>) (`sycophant-quickstart` 是安装捆绑。 [实例](<https://github.com/calebfaruki/sycophant/blob/main/examples/sycoadm/>) 显示如何写每个作品。 ## 警卫 安全是结构,不是配置,简单,不是复杂。见 [SECURITY . md (英语).](<https://github.com/calebfaruki/sycophant/blob/main/SECURITY.md>) 报告和/或 [THREAT_MODEL . md (英语).](<https://github.com/calebfaruki/sycophant/blob/main/THREAT_MODEL.md>) 为完整的模型。 ## 捐款 欢迎投稿。 打开一个问题来讨论修改, 或发送拉动请求。 请从下面的设计文件开始 。 [`docs/`](<https://github.com/calebfaruki/sycophant/blob/main/docs/>) 以获得方向。 ## 许可证 [AGPL-3.0](<https://github.com/calebfaruki/sycophant/blob/main/LICENSE>) 登录方式 [公牛队](https://www.yo-bullitt.com/).

查看原始来源