SAM:面向AI Agent的零配置零信任P2P网络
Meet SAM (Sovereign Agent Mesh): A Zero-Config, Zero-Trust P2P Network for AI Agents
google/sam is not Segment Anything. SAM here means Sovereign Agent Mesh, an Apache-2.0 networking project for autonomous AI agents. The problem it targets is concrete. Agents now run across cloud servers, on-prem datacenters, laptops, Raspberry Pis and Android devices. Letting them share tools usually means exposing internal scripts, LLM endpoints or private APIs to the public internet. SAM’s alternative is a zero-config, zero-trust P2P overlay — closer to a private VPN, but scoped to agent-to-agent tool sharing over the Model Context Protocol. Nodes discover each other automatically, survive NAT, and authorize every call cryptographically.
google/sam 不是 Segment Anything。这里的 SAM 指的是 Sovereign Agent Mesh,一个面向自主 AI 代理的 Apache-2.0 网络项目。它解决的问题很具体。代理现在运行在云服务器、本地数据中心、笔记本电脑、树莓派和 Android 设备上。让它们共享工具通常意味着将内部脚本、LLM 端点或私有 API 暴露到公共互联网。SAM 的替代方案是一个零配置、零信任的 P2P 覆盖网络——更接近私有 VPN,但范围限定为通过 Model Context Protocol 进行代理间工具共享。节点自动发现彼此,穿透 NAT,并对每次调用进行加密授权。
Note: The repo carries an explicit disclaimer: this is not an officially supported Google product.
注意:该仓库带有明确免责声明:这不是谷歌官方支持的产品。
Is it deployable?
它可以部署吗?
Partially, the engineering is production-shaped, but the public mesh is still labelled a beta testnet.
部分可以,工程实现已具备生产形态,但公共网格仍被标记为 beta 测试网。
- What ships now: Go binaries, an install script, ghcr.io Docker images, a charts/sam-mesh Helm chart, a production Kubernetes guide, and Android/iOS support. The public testnet is bananas.sam-mesh.dev. For real workloads, self-host your control plane. The docs call this “DIY Mode” and it is the path to full data and policy control.
- Company level: Best fit is mid-market and enterprise engineering orgs running agents across more than one network boundary. Startups inside a single VPC gain less; the value shows up once agents span cloud, datacenter and laptops.
- Industries: Financial services, healthcare, public sector and defense, and industrial or robotics edge fleets. Broadly, any regulated org that cannot publish internal tools to the internet.
- Applications: Cross-cloud MCP tool sharing, hybrid on-prem to cloud agent calls, brokered inference endpoints, sandboxed agents with credential injection, and pooled warm workers.
- 目前发布的内容:Go 二进制文件、安装脚本、ghcr.io Docker 镜像、charts/sam-mesh Helm chart、生产 Kubernetes 指南,以及 Android/iOS 支持。公共测试网是 bananas.sam-mesh.dev。对于真实工作负载,请自托管控制平面。文档称之为“DIY 模式”,这是实现完全数据和策略控制的路径。
- 公司层面:最适合在多个网络边界运行代理的中型市场和大型企业工程组织。单一 VPC 内的初创公司获益较少;一旦代理跨越云、数据中心和笔记本电脑,价值就会显现。
- 行业:金融服务、医疗保健、公共部门和国防,以及工业或机器人边缘集群。广泛来说,任何不能将内部工具发布到互联网的受监管组织。
- 应用:跨云 MCP 工具共享、混合本地到云代理调用、代理推理端点、带凭据注入的沙箱代理,以及池化热备工作节点。
Architecture: three binaries
架构:三个二进制文件
- sam-control-plane — identity registration, token issuing, policy distribution.
- sam-router — libp2p bootstrap points and GossipSub routing overlays.
- sam-node — the P2P client providing mesh transport, self-healing connectivity, and a local MCP HTTP interface.
- sam-control-plane — 身份注册、令牌签发、策略分发。
- sam-router — libp2p 引导点和 GossipSub 路由覆盖。
- sam-node — 提供网格传输、自愈连接和本地 MCP HTTP 接口的 P2P 客户端。
A node joins with sam-node join, then runs with sam-node run. libp2p uses 5001/udp and 5002/tcp; the local MCP API defaults to 8080.
节点通过 sam-node join 加入,然后通过 sam-node run 运行。libp2p 使用 5001/udp 和 5002/tcp;本地 MCP API 默认端口为 8080。
Identity: OIDC in, Biscuit out
身份:OIDC 进,Biscuit 出
This is the interesting part. The control plane verifies an OIDC JWT. It then translates the claims into Datalog facts and seals them into a Biscuit token. sub becomes user(...), each group becomes group(...), and the peer ID binds in as client_peer_id(...).
这是有趣的部分。控制平面验证 OIDC JWT。然后它将声明转换为 Datalog 事实,并将其封装到 Biscuit 令牌中。sub 变为 user(...),每个组变为 group(...),对等 ID 绑定为 client_peer_id(...)。
The consequence: nodes authorize offline. A node evaluates the presented token against its own local rules without calling home.
结果是:节点离线授权。节点根据自身的本地规则评估所出示的令牌,无需回连主服务器。
Enforcement is strict default-deny. Access needs an explicit capability fact such as granted_service_exact(...). There are no built-in exceptions — even the discovery catalog system://sam.catalog must be granted. Services use a strict type://name convention with wildcard support (mcp://*, mcp://build-runner.*).
执行策略是严格的默认拒绝。访问需要显式的能力事实,例如 granted_service_exact(...)。没有内置例外——即使是发现目录 system://sam.catalog 也必须被授予。服务使用严格的 type://name 约定,并支持通配符(mcp://*、mcp://build-runner.*)。
Every request runs a two-stage pipeline. Stage 1 gates the connection against ban and revocation caches. Stage 2 runs exactly two Biscuit authorizer passes. The first covers the node’s own identity token to emit target_fact assertions. The second covers the caller’s token. A baseline check blocks replay by requiring the connection peer ID to match the token.
每个请求都经过两阶段流水线。第一阶段根据封禁和撤销缓存对连接进行门控。第二阶段恰好执行两次 Biscuit 授权器传递。第一次覆盖节点自身的身份令牌,以发出 target_fact 断言。第二次覆盖调用者的令牌。基线检查通过要求连接对端 ID 与令牌匹配来阻止重放。
Operators can attenuate locally, denying a write tool after 9 PM or blocking contractors. Local allows still cannot bypass control-plane check if constraints.
操作员可以在本地进行衰减,例如在晚上 9 点后拒绝写入工具或阻止承包商。如果存在约束,本地允许仍然无法绕过控制平面的检查。
Interactive explainer
交互式解释器
What an agent actually calls
代理实际调用的内容
The node exposes standard MCP tools: discover_remote_services, find_remote_tools, and call_remote_tool. Guides cover Gemini, Claude Code, Claude Desktop, Google Antigravity and OpenClaw. sam-node skill install writes a SKILL.md so an agent can bring the node online itself. The enrollment login stays with a human by design.
节点暴露标准 MCP 工具:discover_remote_services、find_remote_tools 和 call_remote_tool。指南涵盖 Gemini、Claude Code、Claude Desktop、Google Antigravity 和 OpenClaw。sam-node 技能安装会写入 SKILL.md,使代理能够自行将节点上线。按设计,注册登录仍由人类完成。
Egress control: sam-box and nano-init
出口控制:sam-box 和 nano-init
The Secure Outbound Gateway targets a real agent-security gap. nano-init runs as PID 1 in the sandbox and sets the proxy environment variables. For tools that ignore them, it LD_PRELOADs an interceptor hooking the C connect() syscall on ports 80 and 443.
安全出站网关针对真实的代理安全漏洞。nano-init 在沙箱中作为 PID 1 运行,并设置代理环境变量。对于忽略这些变量的工具,它通过 LD_PRELOAD 注入一个拦截器,挂钩端口 80 和 443 上的 C connect() 系统调用。
Traffic reaches sam-box over a Unix domain socket. The gateway verifies the Biscuit, injects the real credential from secrets.yaml, and upgrades the request to HTTPS. The agent sandbox never holds the key.
流量通过 Unix 域套接字到达 sam-box。网关验证 Biscuit,从 secrets.yaml 注入真实凭据,并将请求升级为 HTTPS。代理沙箱从不持有密钥。
A worked pattern: warm agent pool
一个实用的模式:热代理池
The code-reviewer pool example fans batch work across identical running workers using ordinary MCP services. A manager learns peers via DHT discovery and tracks busy state with leases. Correctness comes from synchronous lease assignment, fencing tokens, grace eviction, and a POOL_BUSY backstop. Workers verify a short-lived HMAC token offline; anything else returns NO_LEASE.
代码审查者池示例使用普通 MCP 服务将批量工作分散到相同的运行中工作进程。管理器通过 DHT 发现学习对等节点,并使用租约跟踪繁忙状态。正确性来自同步租约分配、围栏令牌、宽限驱逐和 POOL_BUSY 后备机制。工作进程离线验证短时 HMAC 令牌;其他任何情况返回 NO_LEASE。
Key Takeaways
关键要点
- SAM is Sovereign Agent Mesh, an Apache-2.0 P2P overlay — not Segment Anything.
- Three binaries: control plane for identity and policy, routers for libp2p transport, nodes for MCP.
- OIDC claims are translated into Biscuit Datalog facts, so nodes authorize offline.
- Default-deny is absolute; even the discovery catalog needs an explicit grant.
- Production use means self-hosting a control plane — the public mesh is a beta testnet.
- SAM 是主权代理网格(Sovereign Agent Mesh),一个 Apache-2.0 许可的 P2P 覆盖网络——不是 Segment Anything。
- 三个二进制文件:控制平面用于身份和策略,路由器用于 libp2p 传输,节点用于 MCP。
- OIDC声明被转换为Biscuit Datalog事实,因此节点可离线授权。
- 默认拒绝是绝对的;即使是发现目录也需要显式授权。
- 生产环境使用意味着自托管控制平面——公共网格是测试网。
Check out the GitHub Repo. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.
查看GitHub仓库。此外,欢迎在Twitter上关注我们,别忘了加入我们的150k+ML SubReddit并订阅我们的新闻通讯。等等!你在Telegram上吗?现在你也可以在Telegram上加入我们。
Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us
需要与我们合作推广你的GitHub仓库、Hugging Face页面、产品发布或网络研讨会等吗?请联系我们。
The post Meet SAM (Sovereign Agent Mesh): A Zero-Config, Zero-Trust P2P Network for AI Agents appeared first on MarkTechPost.
文章《遇见SAM(主权代理网格):面向AI代理的零配置、零信任P2P网络》首次出现在MarkTechPost上。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力