## Understanding SAM (Sovereign Agent Mesh)
The project referenced as `google/sam` is not Google’s Segment Anything Model. Instead, “SAM” here stands for **Sovereign Agent Mesh**, which is an Apache 2.0 licensed networking project designed for autonomous AI agents. The core problem it addresses is the difficulty agents face when trying to share tools across different environments—such as cloud servers, on-premise data centers, laptops, Raspberry Pis, and Android devices. Traditionally, enabling tool sharing requires exposing internal scripts, LLM endpoints, or private APIs to the public internet, which poses security risks.
SAM offers an alternative approach by creating a **zero-config, zero-trust peer-to-peer (P2P) overlay**. This overlay functions similarly to a private VPN but is specifically scoped for agent-to-agent tool sharing using the Model Context Protocol (MCP). Key features of SAM include automatic node discovery, NAT traversal, and cryptographic authorization of every call.
> **Note:** The repository includes a clear disclaimer stating that this is not an officially supported Google product.
### Deployability
SAM is considered **partially deployable**. The engineering is production-ready in many aspects, but the public mesh is still labeled as a beta testnet.
– **Current offerings:** Go binaries, installation scripts, Docker images available on GHCR, a Helm chart (`charts/sam-mesh`), production Kubernetes guidance, and support for Android and iOS. The public testnet can be accessed via `bananas.sam-mesh.dev`. For production workloads, users are encouraged to use “DIY Mode” by self-hosting the control plane to maintain full data and policy control.
– **Ideal use cases:** Mid-market and enterprise engineering organizations running agents across multiple network boundaries. Startups operating within a single VPC may not derive as much benefit since SAM’s value increases when agents span clouds, data centers, and personal devices.
– **Target industries:** Financial services, healthcare, public sector and defense, as well as industrial or robotics edge fleets—particularly for regulated organizations that cannot expose internal tools to the internet.
– **Applications include:** Cross-cloud MCP tool sharing, hybrid on-prem to cloud agent calls, brokered inference endpoints, sandboxed agents with credential injection, and pooled warm workers.
### Architecture: Three Binaries
SAM’s architecture is built around three core binaries:
1. **`sam-control-plane`**
Handles identity registration, token issuing, and policy distribution.
2. **`sam-router`**
Provides libp2p bootstrap points and GossipSub routing overlays.
3. **`sam-node`**
Acts as the P2P client, offering mesh transport, self-healing connectivity, and a local MCP HTTP interface.
Joining the mesh is simple: run `sam-node join`, followed by `sam-node run`. The libp2p layer uses ports `5001/udp` and `5002/tcp`, while the local MCP API defaults to port `8080`.
### Identity: OIDC In, Biscuit Out
SAM employs an interesting identity mechanism. The control plane verifies an OIDC JWT and then translates its claims into **Biscuit** tokens. Claims such as `sub`, groups, and peer IDs are converted into Datalog facts and sealed within the token.
This design enables **offline authorization**—nodes can evaluate presented tokens against local rules without contacting the control plane. The default stance is **strict deny**, with explicit allow rules required for capabilities like `granted_service_exact(…)`. Services follow a strict `type://name` naming convention, supporting wildcards (e.g., `mcp://*`).
Every request undergoes a two-stage pipeline:
1. **Stage 1:** Gates the connection using ban and revocation caches.
2. **Stage 2:** Executes exactly two Biscuit authorizer passes—one for the node’s own identity token and another for the caller’s token. Replay attacks are blocked by ensuring the connection peer ID matches the token.
Operators can apply local attenuation policies (e.g., denying write access after 9 PM) without bypassing the control plane’s constraints.
### Interactive Explainer
The repository includes an interactive explainer that demonstrates SAM’s functionality through four panels covering mesh architecture, identity conversion, default-deny policy enforcement, and outbound proxy gateways.
—
## Frequently Asked Questions (FAQ)
### What does SAM stand for?
SAM stands for **Sovereign Agent Mesh**.
### Is SAM a Google product?
No, SAM is **not** an officially supported Google product. The repository includes a clear disclaimer regarding its status.
### What problem does SAM solve?
SAM enables autonomous AI agents to securely share tools across diverse environments—cloud, on-premise, laptops, and edge devices—without exposing internal APIs to the public internet.
### What is the communication model used by SAM?
SAM uses a **zero-config, zero-trust P2P overlay** built on libp2p, offering features like automatic discovery and NAT traversal.
### How does SAM handle identity and authorization?
SAM verifies OIDC JWTs at the control plane and issues Biscuit tokens containing Datalog facts. Nodes perform **offline authorization**, enforcing strict default-deny policies based on granted capabilities.
### What ports does SAM use?
libp2p uses ports `5001/udp` and `5002/tcp`. The local MCP API defaults to port `8080`.
### What is the current deployment status?
SAM is **partially deployable**. The engineering is production-shaped, but the public mesh remains in beta.
### Which industries benefit most from SAM?
Industries with strict regulatory requirements—such as **financial services, healthcare, public sector, defense, and industrial robotics**—are primary beneficiaries.
### Can SAM be self-hosted?
Yes, users can deploy SAM in “DIY Mode” for full control over data and policy.
### What is `sam-box` used for?
`sam-box` acts as a gateway proxy. It verifies Biscuit tokens, injects credentials, and upgrades plain HTTP traffic to HTTPS, ensuring that secrets never enter the sandbox.
—
## Conclusion
Sovereign Agent Mesh (SAM) presents a robust solution for secure, zero-trust tool sharing among autonomous AI agents operating across heterogeneous environments. By leveraging a P2P overlay, cryptographic identity tokens (Biscuits), and strict default-deny policies, SAM enables organizations to integrate AI agents into their infrastructure without compromising security or compliance.
Although currently in beta and not a Google-backed product, SAM shows strong potential for enterprises and regulated industries seeking private, auditable, and scalable agent communication frameworks. With support for cloud, on-premise, and edge deployments—and accompanied by an interactive explainer and comprehensive documentation—SAM offers a forward-looking approach to the emerging challenges of multi-agent collaboration.



