Skip to content

Commit 375ff6e

Browse files
authored
Merge pull request #148 from aojea/autopudate
Organize documentation into user and developer sections
2 parents 7d232cf + b0cd3f0 commit 375ff6e

4 files changed

Lines changed: 186 additions & 190 deletions

File tree

‎README.md‎

Lines changed: 22 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -2,138 +2,43 @@
22

33
<img alt="SAM" src="docs/sam_logo.png" />
44

5-
SAM is a smart network built for autonomous agents:
5+
SAM is a smart network built for autonomous AI agents:
66

7-
* **Zero Config:** Nodes discover each other and build the network automatically.
7+
* **Zero Config:** Nodes discover each other and build the P2P network automatically.
88
* **Zero Trust:** Every connection, node, and packet is strictly authenticated.
9-
* **Agentic Network:** Built for agents to use. The nodes provide the self-healing, peer-to-peer infrastructure, allowing autonomous agents to seamlessly plug in, communicate, and operate across the mesh.
10-
* **Portability:** Environment-agnostic and IP-independent. Network identity is cryptographic and travels with the node, enabling mobility across cloud, edge, and local setups.
9+
* **Agentic Network:** Formed by lightweight nodes (`sam-node`) that provide self-healing, P2P connectivity, allowing autonomous agents to plug in, communicate, and invoke tools dynamically.
10+
* **Portability:** Cryptographic identities are environment-agnostic, allowing seamless node mobility across cloud, local, and edge environments.
1111

12+
---
1213

13-
- `sam-hub`: The control plane for identity and policy distribution.
14-
- `sam-node`: The lightweight agents that form the actual peer-to-peer mesh.
14+
## Architecture Components
1515

16-
## Build
16+
* `sam-hub`: The control plane for identity mapping and policy distribution.
17+
* `sam-node`: The P2P nodes providing the mesh transport layer and local MCP interfaces.
1718

18-
```bash
19-
make build
20-
./bin/sam-node --help
21-
./bin/sam-hub --help
22-
```
19+
---
2320

24-
## Basic Usage
25-
26-
### 1. Run the hub
27-
28-
```bash
29-
SAM_OIDC_ISSUER=https://issuer.example.com \
30-
SAM_OIDC_ID=sam-client \
31-
SAM_OIDC_SECRET=sam-secret \
32-
SAM_HUB_KEY=$(openssl rand -hex 32) \
33-
./bin/sam-hub
34-
```
35-
36-
### 2. Join a mesh (Enroll node)
37-
38-
To register the node's cryptographic identity with the hub:
39-
40-
```bash
41-
./bin/sam-node join http://localhost:8080
42-
```
43-
44-
This initiates the interactive OIDC Device Authorization flow. It prints a URL to open in your browser for authentication. Once authorized, it automatically receives the node's Biscuit identity token and saves it (along with the derived node private key) inside the local data store.
45-
46-
### 3. Run the node
47-
48-
Start the node using the stored identity (note that `--api-token` is mandatory to protect the local API when not using mTLS):
49-
50-
```bash
51-
./bin/sam-node run --api-token my-secret-token
52-
```
53-
54-
Or run the node by explicitly passing OIDC credentials to dynamically authenticate and enroll on start:
55-
56-
```bash
57-
./bin/sam-node run \
58-
--oidc-issuer https://issuer.example.com \
59-
--client-id <id> \
60-
--client-secret <secret> \
61-
--api-token my-secret-token
62-
```
63-
64-
## Docker Quick Start
65-
66-
You can run the SAM node using Docker and the officially published image. To persist your node's identity, private key, and mesh discovery configuration across runs, use a host volume mounted to the container's data directory.
67-
68-
### 1. Join the Mesh (Enroll)
69-
70-
Run the container interactively to register your node with the community testnet (`https://bananas.sam-mesh.dev`):
71-
72-
```bash
73-
docker run -it \
74-
-v $(pwd)/sam-data:/data \
75-
ghcr.io/google/sam-node:latest \
76-
join --data-dir /data https://bananas.sam-mesh.dev
77-
```
78-
79-
- Follow the printed device authentication instructions in your browser.
80-
- This generates the node identity and stores it inside `./sam-data/agent.db` on the host.
81-
82-
### 2. Run the Node
83-
84-
Start the background mesh node container using the stored identity. Make sure to publish the required libp2p ports (5001/UDP and 5002/TCP), set a secure `--api-token` to protect the local MCP/Sidecar API, and bind the HTTP server to `0.0.0.0:8080` so that it can be reached from the host:
85-
86-
```bash
87-
docker run -d \
88-
--name sam-node \
89-
-v $(pwd)/sam-data:/data \
90-
-p 5001:5001/udp \
91-
-p 5002:5002 \
92-
-p 8080:8080 \
93-
ghcr.io/google/sam-node:latest \
94-
run --data-dir /data --bind-addr 0.0.0.0:8080 --api-token my-secret-token
95-
```
96-
97-
## Local MCP Server
98-
99-
Each `sam-node` exposes a Model Context Protocol (MCP) server over HTTP Server-Sent Events (SSE) to allow local processes to discover the capabilities of the local agent and get information from the mesh.
100-
101-
By default, the server listens at `127.0.0.1:8080`. You can change this with the `--bind-addr` flag.
102-
103-
To query the mesh info via the MCP server, you can use the `mcp-client` tool provided in the repository:
104-
105-
```bash
106-
./bin/mcp-client -url http://127.0.0.1:8080/mcp/events
107-
```
108-
109-
## Testing
110-
111-
```bash
112-
make test
113-
make test-e2e
114-
make test-e2e-container
115-
```
21+
## Documentation
11622

117-
`test-e2e-container` runs a containerized BATS framework that starts:
23+
Start exploring the Sovereign Agent Mesh:
11824

119-
- a mock OIDC container
120-
- a `sam-hub` container
121-
- multiple `sam-node` containers
25+
### For Users & Operators
26+
Get a node running on the public testnet (`bananas.sam-mesh.dev`) in minutes:
27+
- 🚀 **[User Quick Start Guide](docs/quickstart.md)**: Connect and run a SAM node using Docker and query the local MCP server via `curl`.
28+
- 📖 **[CLI Reference](docs/cli/reference.md)**: Comprehensive CLI reference and configurations.
29+
- 📡 **[Testnet Validation Tutorial](docs/testnet-validation.md)**: Real-time verification, remote tool invocation, and HTTP stream proxies.
12230

123-
## Documentation
31+
### For Developers & Contributors
32+
Compile from source, run local clusters, or execute tests:
33+
- 🛠️ **[Developer Guide](docs/development.md)**: Prereqs, compilation, local hub setup, and Kubernetes Kind deployment.
34+
- 🧪 **[Testing Guide](docs/testing.md)**: Go tests, E2E BATS, and containerized mesh execution.
12435

125-
- Docs index: `docs/index.html`
126-
- Project docs landing page: `docs/README.md`
127-
- Quickstart: `docs/quickstart.md`
128-
- CLI reference: `docs/cli/reference.md`
129-
- Testing guide: `docs/testing.md`
36+
---
13037

13138
## License
13239

13340
See [LICENSE](LICENSE).
13441

13542
## Disclaimer
13643

137-
This is not an officially supported Google product. This project is not eligible
138-
for the [Google Open Source Software Vulnerability Rewards
139-
Program](https://bughunters.google.com/open-source-security).
44+
This is not an officially supported Google product. This project is not eligible for the [Google Open Source Software Vulnerability Rewards Program](https://bughunters.google.com/open-source-security).

‎docs/README.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ The documentation here is intentionally small and aligned with what is implement
1919

2020
## Start Here
2121

22-
- [Quick Start](quickstart.md)
23-
- [CLI Reference](cli/reference.md)
24-
- [Testing](testing.md)
25-
- [Testnet Validation](testnet-validation.md)
22+
- [Quick Start](quickstart.md) - User Quick Start using Docker.
23+
- [CLI Reference](cli/reference.md) - CLI command usage reference.
24+
- [Developer Guide](development.md) - Building from source, local testing, and Kind setups.
25+
- [Testing Guide](testing.md) - Detailed test layer and troubleshooting information.
26+
- [Testnet Validation Tutorial](testnet-validation.md) - Real-time integration and MCP verification with public testnets.
2627

2728
## Notes
2829

‎docs/development.md‎

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Developer Guide & Repository Setup
2+
3+
This document is for developers who want to compile SAM from source, run a local development mesh, run the test suites, or contribute to the repository.
4+
5+
---
6+
7+
## Prerequisites
8+
9+
To build and test the Go binaries natively:
10+
11+
- **Go Toolchain**: Go 1.25+
12+
- **Docker**: For running containerized integration tests and building local images.
13+
- **BATS**: `bats-core` framework for running E2E shell tests.
14+
15+
---
16+
17+
## Build from Source
18+
19+
Clone the repository and compile the binaries:
20+
21+
```bash
22+
git clone https://github.com/google/sam.git
23+
cd sam
24+
make build
25+
```
26+
27+
This compiles and generates the following binaries under `./bin/`:
28+
29+
- `./bin/sam-hub`: The OIDC identity bridge and cryptographic Biscuit token issuer.
30+
- `./bin/sam-node`: The mesh agent node CLI supporting `join` and `run` commands.
31+
- `./bin/mcp-client`: A CLI-based utility to interact with MCP servers.
32+
33+
---
34+
35+
## Running a Local Dev Hub
36+
37+
To run `sam-hub` locally for testing, you must supply OIDC issuer configurations and a 32-byte hexadecimal seed key:
38+
39+
```bash
40+
# Generate a random 32-byte key for biscuit signing
41+
export SAM_HUB_KEY=$(openssl rand -hex 32)
42+
export SAM_OIDC_ISSUER=https://issuer.example.com
43+
export SAM_OIDC_ID=sam-client
44+
export SAM_OIDC_SECRET=sam-secret
45+
46+
./bin/sam-hub
47+
```
48+
49+
---
50+
51+
## Testing
52+
53+
The repository implements a testing pyramid. Ensure the test suites are green before pushing code:
54+
55+
### 1. Go Unit & Integration Tests
56+
Runs the packages' unit tests and multi-node integration tests:
57+
```bash
58+
make test
59+
```
60+
61+
### 2. Local E2E Tests (BATS)
62+
Validates local command-line behaviors for `sam-node` and `sam-hub`:
63+
```bash
64+
make test-e2e
65+
```
66+
67+
### 3. Containerized Mesh E2E (BATS)
68+
Builds local Docker images, spins up a mock OIDC server, runs `sam-hub` and multiple `sam-node` containers in a local bridge network, and performs end-to-end device flows and tool discovery:
69+
```bash
70+
make test-e2e-container
71+
```
72+
73+
---
74+
75+
## Local Kubernetes Test Setup
76+
77+
For end-to-end integration testing in a local Kubernetes environment:
78+
79+
1. **Start Kind Cluster**:
80+
Ensure you have a Kind cluster running.
81+
2. **Build and Load Images**:
82+
```bash
83+
make docker-build-node
84+
make docker-build-hub
85+
kind load docker-image sam-node:local
86+
kind load docker-image sam-hub:local
87+
```
88+
3. **Deploy Config Templates**:
89+
Deploy and template configuration files located under `.github/k8s/` or `development/kind/` to spin up local nodes and vLLM inference engines.

0 commit comments

Comments
 (0)