Skip to content

Agent Mesh

refactor(sdk): rename JS and Python SDK packages to @agentmesh-p2p/sdk and agentmesh-p2p

Antonio Ojeac6de13ebc810
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6f58a9ba..ffe7f0c0 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -77,7 +77,7 @@ jobs:
cache-dependency-path: sdk/js/package-lock.json
- name: Stamp the release version on both SDKs
run: ./hack/sdk-version.sh "${SDK_VERSION#v}"
- - name: Build and publish @sam-mesh/sdk
+ - name: Build and publish @agentmesh-p2p/sdk
# npm's trusted publishing needs npm 11.5 or later; Node 22 ships 10.
# npm 11 refuses to publish a prerelease without an explicit dist-tag,
# and "latest" must stay on stable versions.
@@ -85,8 +85,8 @@ jobs:
working-directory: sdk/js
run: |
ver="${SDK_VERSION#v}"
- if npm view "@sam-mesh/sdk@${ver}" version >/dev/null 2>&1; then
- echo "@sam-mesh/sdk@${ver} is already published on npm; skipping."
+ if npm view "@agentmesh-p2p/sdk@${ver}" version >/dev/null 2>&1; then
+ echo "@agentmesh-p2p/sdk@${ver} is already published on npm; skipping."
exit 0
fi
npm install -g npm@latest
@@ -118,12 +118,12 @@ jobs:
python-version: "3.12"
- name: Stamp the release version on both SDKs
run: ./hack/sdk-version.sh "${SDK_VERSION#v}"
- - name: Build sam-mesh
+ - name: Build agentmesh-p2p
working-directory: sdk/python
run: |
python -m pip install --upgrade build
python -m build
- - name: Publish sam-mesh
+ - name: Publish agentmesh-p2p
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
packages-dir: sdk/python/dist/
diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml
index 987196e2..e9993ddf 100644
--- a/.github/workflows/sdk.yml
+++ b/.github/workflows/sdk.yml
@@ -13,7 +13,7 @@
# limitations under the License.
# Native SDKs (sdk/): unit tests per language, then both SDKs on a mesh with
-# a real control plane, router and sam-node through tests/integration, and
+# a real control plane, router and agentmesh-node through tests/integration, and
# the example programs the docs embed run the same way. api/agentmesh.proto is a
# trigger because the SDKs ship bindings generated from it; the docs are
# because they embed the examples.
@@ -30,7 +30,7 @@ on:
- 'hack/verify-sdk-generated.sh'
- 'site/content/docs/guides/native-sdks.md'
- 'tests/integration/sdk_*_test.go'
- - 'Dockerfile.sam-sdk-*'
+ - 'Dockerfile.agentmesh-sdk-*'
- '.github/workflows/sdk.yml'
pull_request:
branches: [main]
@@ -42,7 +42,7 @@ on:
- 'hack/verify-sdk-generated.sh'
- 'site/content/docs/guides/native-sdks.md'
- 'tests/integration/sdk_*_test.go'
- - 'Dockerfile.sam-sdk-*'
+ - 'Dockerfile.agentmesh-sdk-*'
- '.github/workflows/sdk.yml'
permissions:
@@ -88,7 +88,7 @@ jobs:
- name: Generated bindings, embedded examples and lockfile are current
run: ./hack/verify-sdk-generated.sh
- - name: Both SDKs and the documented examples on a mesh with a real control plane, router and sam-node
+ - name: Both SDKs and the documented examples on a mesh with a real control plane, router and agentmesh-node
run: go test ./tests/integration -run TestNativeSDK -count=1 -v
# The images the testnets run the examples from (deploy.yaml builds and
@@ -96,16 +96,16 @@ jobs:
# pull request, not the deploy.
- name: SDK canary images build
run: |
- docker build -f Dockerfile.sam-sdk-js -t sam-sdk-js:ci .
- docker build -f Dockerfile.sam-sdk-python -t sam-sdk-python:ci .
+ docker build -f Dockerfile.agentmesh-sdk-js -t agentmesh-sdk-js:ci .
+ docker build -f Dockerfile.agentmesh-sdk-python -t agentmesh-sdk-python:ci .
# Without a token every example stops at enrollment with this
# message: the default command (the agent), the caller, and the
# two written with the official A2A SDK.
- docker run --rm sam-sdk-js:ci 2>&1 | grep -q 'exactly one of'
- docker run --rm sam-sdk-python:ci 2>&1 | grep -q 'exactly one of'
- docker run --rm sam-sdk-js:ci build/examples/call.js 2>&1 | grep -q 'exactly one of'
- docker run --rm sam-sdk-python:ci examples/call.py 2>&1 | grep -q 'exactly one of'
- docker run --rm sam-sdk-js:ci build/examples/a2a-agent.js 2>&1 | grep -q 'exactly one of'
- docker run --rm sam-sdk-python:ci examples/a2a_agent.py 2>&1 | grep -q 'exactly one of'
- docker run --rm sam-sdk-js:ci build/examples/a2a-call.js peer 2>&1 | grep -q 'exactly one of'
- docker run --rm sam-sdk-python:ci examples/a2a_call.py peer 2>&1 | grep -q 'exactly one of'
+ docker run --rm agentmesh-sdk-js:ci 2>&1 | grep -q 'exactly one of'
+ docker run --rm agentmesh-sdk-python:ci 2>&1 | grep -q 'exactly one of'
+ docker run --rm agentmesh-sdk-js:ci build/examples/call.js 2>&1 | grep -q 'exactly one of'
+ docker run --rm agentmesh-sdk-python:ci examples/call.py 2>&1 | grep -q 'exactly one of'
+ docker run --rm agentmesh-sdk-js:ci build/examples/a2a-agent.js 2>&1 | grep -q 'exactly one of'
+ docker run --rm agentmesh-sdk-python:ci examples/a2a_agent.py 2>&1 | grep -q 'exactly one of'
+ docker run --rm agentmesh-sdk-js:ci build/examples/a2a-call.js peer 2>&1 | grep -q 'exactly one of'
+ docker run --rm agentmesh-sdk-python:ci examples/a2a_call.py peer 2>&1 | grep -q 'exactly one of'
diff --git a/Dockerfile.agentmesh-sdk-js b/Dockerfile.agentmesh-sdk-js
index 5ebc00d6..37c4cfd5 100644
--- a/Dockerfile.agentmesh-sdk-js
+++ b/Dockerfile.agentmesh-sdk-js
@@ -2,7 +2,7 @@
# them: `node build/examples/agent.js [url]` joins as an agent that accepts
# A2A requests, `node build/examples/call.js [peer] <service> <tool|path>
# [args]` calls a service or an agent, and `a2a-agent.js` and `a2a-call.js`
-# do the same with the official A2A SDK. The examples import "@sam-mesh/sdk"
+# do the same with the official A2A SDK. The examples import "@agentmesh-p2p/sdk"
# by name and resolve it through the package's own exports, so the image
# keeps the package layout: package.json, dist/, build/examples/ and the
# production node_modules/ plus the two packages the A2A examples need,
diff --git a/hack/sdk-version.sh b/hack/sdk-version.sh
index bd7e2e2f..67743bb7 100755
--- a/hack/sdk-version.sh
+++ b/hack/sdk-version.sh
@@ -14,7 +14,7 @@
# limitations under the License.
# Stamps one version on both native SDKs, so a release publishes
-# @sam-mesh/sdk and sam-mesh at the version of its tag. The release
+# @agentmesh-p2p/sdk and agentmesh-p2p at the version of its tag. The release
# workflow runs it on the tag; a developer never needs to.
#
# ./hack/sdk-version.sh 1.2.3
diff --git a/sam-control-plane b/sam-control-plane
deleted file mode 100755
index 9b918ce8..00000000
Binary files a/sam-control-plane and /dev/null differ
diff --git a/sdk/README.md b/sdk/README.md
index 2828ba99..81af884b 100644
--- a/sdk/README.md
+++ b/sdk/README.md
@@ -1,14 +1,14 @@
# Native SDKs
This directory holds the SDKs that let an agent join a SAM mesh from inside
-its own process, without a `sam-node` sidecar. Two languages are in scope:
+its own process, without a `agentmesh-node` sidecar. Two languages are in scope:
-- [`js/`](js/) — `@sam-mesh/sdk`, TypeScript for Node.js, built on
+- [`js/`](js/) — `@agentmesh-p2p/sdk`, TypeScript for Node.js, built on
[js-libp2p](https://github.com/libp2p/js-libp2p).
-- [`python/`](python/) — `sam-mesh` (import `agent_mesh`), built on
+- [`python/`](python/) — `agentmesh-p2p` (import `agent_mesh`), built on
[py-libp2p](https://github.com/libp2p/py-libp2p).
-The motivation is [issue #480](https://github.com/google/sam/issues/480). The
+The motivation is [issue #480](https://github.com/google/agentmesh/issues/480). The
sidecar works, but it makes every agent deployment manage a second process,
a local port and a token, which does not fit serverless platforms and splits
tracing between the agent and the network layer. An earlier attempt at a
@@ -17,15 +17,15 @@ removed in favour of this work.
Both SDKs speak the mesh protocol directly. There is no SDK-specific
endpoint anywhere in the mesh; a member built with an SDK is, to every other
-member and to the control plane, a peer like a `sam-node`.
+member and to the control plane, a peer like a `agentmesh-node`.
An SDK member is an agent, not a service provider. It calls what the mesh
-offers: MCP tools, inference and A2A services that `sam-node`s publish and
+offers: MCP tools, inference and A2A services that `agentmesh-node`s publish and
the discovery table names. Inbound, it accepts one thing: A2A requests for
itself, as `a2a://<name>`, reached by peer ID through a router. It publishes
no service, writes no provider record and reports no catalog; a tool, a
model or a named agent that others should find by name runs behind a
-`sam-node`. The reasons are in [Agents, not services](#agents-not-services).
+`agentmesh-node`. The reasons are in [Agents, not services](#agents-not-services).
## What exists today
@@ -40,7 +40,7 @@ Milestones 1 to 5 are implemented and tested in both languages:
| Signed key-set sync (`GET /keys`) | yes | yes |
| Persisted state (identity and credential, owner-only files; IndexedDB in a browser) | yes | yes |
| Biscuit verification of a peer's credential (signature, expiry, peer binding, roles, labels) | yes | yes |
-| libp2p host as `sam-node` configures it (TCP and WebSocket, TLS first and Noise, yamux) | yes | yes |
+| libp2p host as `agentmesh-node` configures it (TCP and WebSocket, TLS first and Noise, yamux) | yes | yes |
| `/mesh/auth/1.0.0`, both sides; join = handshake with a router and check its role | yes | yes |
| Circuit relay v2 reservation on the router; dial and accept through it | yes | yes |
| Service discovery in the mesh DHT (`/mesh/kad/1.0.0`) | yes | yes |
@@ -48,18 +48,18 @@ Milestones 1 to 5 are implemented and tested in both languages:
| Caller-side label requirements on the provider's credential | yes | yes |
| `/libp2p-http` client: call inference and A2A services on the mesh; response bodies stream | yes | yes |
| The mesh as a transport for HTTP clients: `session.fetch()` for fetch-based clients, `MeshTransport` for httpx, so the official A2A SDK's client works unchanged | `fetch` | httpx |
-| Provider authorizer: the baseline Datalog and the mesh policy (`GET /policies`), evaluated as `sam-node` does | yes | yes |
+| Provider authorizer: the baseline Datalog and the mesh policy (`GET /policies`), evaluated as `agentmesh-node` does | yes | yes |
| A2A ingress for the agent: `/libp2p-http` for `a2a://<name>`, forwarded to an A2A server beside the process or answered in it; not announced anywhere | yes | yes |
-| Control plane pull before join and on `sam-node`'s interval: `/keys` verified against the trusted set, credential refresh after a rotation, `/info` bans and router addresses | yes | yes |
+| Control plane pull before join and on `agentmesh-node`'s interval: `/keys` verified against the trusted set, credential refresh after a rotation, `/info` bans and router addresses | yes | yes |
| Gossip events from the control plane (`/mesh/events/v1`, StrictSign): ban enforced at once, key rotation adopted, policy update pulls | yes | yes |
| Banned peers refused: connections dropped and denied, handshakes and requests refused, dials refused | yes | yes |
-| Runs in a browser page: WebSocket and Noise to the router, state in IndexedDB, the agent answered by a fetch handler; `sdk/js/examples/browser` against `sam-one`, tested in Chromium | yes | — |
-| Published to a registry from the release workflow | npm `@sam-mesh/sdk` | PyPI `sam-mesh` |
+| Runs in a browser page: WebSocket and Noise to the router, state in IndexedDB, the agent answered by a fetch handler; `sdk/js/examples/browser` against `agentmesh-one`, tested in Chromium | yes | — |
+| Published to a registry from the release workflow | npm `@agentmesh-p2p/sdk` | PyPI `agentmesh-p2p` |
A member built this way is on the mesh and uses it in both directions: it
finds a service in the DHT and calls it through the router, verifying the
provider on every call, and it answers A2A requests for its own agent from
-a `sam-node` or another SDK member that names it by peer ID, authorizing
+a `agentmesh-node` or another SDK member that names it by peer ID, authorizing
every caller with the same Datalog the Go node evaluates. It follows the
control plane while it runs: a ban reaches it as a gossip event within a
second and again with the next pull, and a key rotation makes it refresh
@@ -140,17 +140,17 @@ pinned by a test:
- URL parsers lowercase the host (WHATWG `URL`, httpx), and a base58 peer
ID is case-sensitive. The URL an HTTP client uses for a peer's service
therefore carries the peer ID in the path,
- `http://mesh/mesh/<peer-id>/<type>/<name>/<path>`, the shape of `sam-node`'s
+ `http://mesh/mesh/<peer-id>/<type>/<name>/<path>`, the shape of `agentmesh-node`'s
egress proxy and of an agent card rewritten for the mesh; the host is ignored.
- A member that publishes nothing has announced no address, so nothing in
- the DHT or a router's peerstore names one. `sam-node` dials
+ the DHT or a router's peerstore names one. `agentmesh-node` dials
`/p2p/<router>/p2p-circuit` for every router it authenticated with when
it knows nothing else about a peer, as both SDKs do for a peer named by
ID (`internal/node/mcp.go`, `preparePeerAddrs`).
- Every Go component runs GossipSub with `StrictSign`. `@libp2p/gossipsub`
(the libp2p-maintained package; `@chainsafe/libp2p-gossipsub` stops at
libp2p 2) and py-libp2p's `GossipSub` with `strict_signing=True` both
- exchange messages with `sam-router`. py-libp2p's Pubsub learns of peers
+ exchange messages with `agentmesh-router`. py-libp2p's Pubsub learns of peers
through a notifee it registers when constructed, so it is built before
the first connection; it also opens a meshsub stream to every new peer
and its host logs an error for peers that do not run pubsub, which is
@@ -158,7 +158,7 @@ pinned by a test:
- py-libp2p's connection gate is address-based, not peer-based, so the
Python SDK enforces a ban by disconnecting the peer and refusing its
handshakes, requests and dials; js-libp2p's `connectionGater` also denies
- the connection itself, as sam-node's gater does.
+ the connection itself, as agentmesh-node's gater does.
## Wire contract
@@ -172,7 +172,7 @@ alters one of these, the SDKs change with it.
protobuf encoding `PublicKey{Type: Ed25519, Data: <32 bytes>}`, which is
the bytes `08 01 12 20` followed by the key. Private keys persist as
`PrivateKey{Type: Ed25519, Data: <seed || public>}`, bytes `08 01 12 40`
- followed by 64 bytes; this is what `sam-node` writes to its store.
+ followed by 64 bytes; this is what `agentmesh-node` writes to its store.
- The peer ID is the identity multihash (`00 24`) of the public key encoding,
written in base58btc. The control plane refuses an enrollment whose
`peer_id` is not derived from `public_key`
@@ -191,10 +191,10 @@ An unknown field is an error. `control_plane_url` has no trailing slash.
In a browser the JS SDK keeps the same two records in an IndexedDB
database named after the state location, kept by the browser for the
page's origin.
-`sam-node` keeps the same message in `agent.db`, and `sam-node state
+`agentmesh-node` keeps the same message in `agent.db`, and `agentmesh-node state
export|import <dir>` moves a member between the two
(`internal/node/statedir.go`). `TestNativeSDKExamples` resumes each SDK's
-directory with the other SDK and with an imported `sam-node`. Fields an SDK
+directory with the other SDK and with an imported `agentmesh-node`. Fields an SDK
does not use (`receive_time`, `oidc_session`) are carried through on save,
so a directory survives a round trip through any implementation.
@@ -225,9 +225,9 @@ messages in `api/agentmesh.proto`. Bodies are capped at 1 MiB on both sides.
| `POST /refresh` | `TokenRefreshRequest`, header `Authorization: Bearer <base64 biscuit>` | `TokenRefreshResponse` | sign `mesh:refresh:<peer_id>:<ts>` |
| `GET /keys` | — | `KeysResponse` | none; see below |
| `GET /policies` | headers `Authorization: Bearer <base64 biscuit>`, `X-Mesh-Challenge-Ts`, `X-Mesh-Challenge-Sig` | `PolicyConfigGetResponse{datalog_rules}` | sign `mesh:policies:<peer_id>:<ts>` |
-| `GET /egress` | headers `Authorization: Bearer <base64 biscuit>`, `X-Mesh-Challenge-Ts`, `X-Mesh-Challenge-Sig` | `EgressAssignmentsResponse` | sign `mesh:egress:<peer_id>:<ts>` (`sam-node` only) |
-| `GET /revocations` | headers `Authorization: Bearer <base64 biscuit>`, `X-Mesh-Challenge-Ts`, `X-Mesh-Challenge-Sig` | `RevocationsResponse` | sign `mesh:revocations:<peer_id>:<ts>` (`sam-node` only) |
-| `POST /nodes/catalog` | `NodeCatalogReport`, headers `Authorization: Bearer <base64 biscuit>`, `X-Mesh-Challenge-Ts`, `X-Mesh-Challenge-Sig` | `204` | sign `mesh:nodes-catalog:<peer_id>:<ts>`; `sam-node` reports what it publishes, while an SDK member publishes nothing and does not call it |
+| `GET /egress` | headers `Authorization: Bearer <base64 biscuit>`, `X-Mesh-Challenge-Ts`, `X-Mesh-Challenge-Sig` | `EgressAssignmentsResponse` | sign `mesh:egress:<peer_id>:<ts>` (`agentmesh-node` only) |
+| `GET /revocations` | headers `Authorization: Bearer <base64 biscuit>`, `X-Mesh-Challenge-Ts`, `X-Mesh-Challenge-Sig` | `RevocationsResponse` | sign `mesh:revocations:<peer_id>:<ts>` (`agentmesh-node` only) |
+| `POST /nodes/catalog` | `NodeCatalogReport`, headers `Authorization: Bearer <base64 biscuit>`, `X-Mesh-Challenge-Ts`, `X-Mesh-Challenge-Sig` | `204` | sign `mesh:nodes-catalog:<peer_id>:<ts>`; `agentmesh-node` reports what it publishes, while an SDK member publishes nothing and does not call it |
- `<ts>` is the request's `challenge_unix_ms`, unix milliseconds, and must
be within 5 minutes of the control plane's clock (`challengeMaxAge`). When
@@ -269,7 +269,7 @@ messages in `api/agentmesh.proto`. Bodies are capped at 1 MiB on both sides.
- Transports: `libp2p.DefaultTransports` (TCP, QUIC, WebSocket).
- Security: TLS first, Noise accepted (`libp2p.Security` twice, in that
- order, on `sam-node` and `sam-router`). Both bind the connection to the
+ order, on `agentmesh-node` and `agentmesh-router`). Both bind the connection to the
peer ID. The Node and Python SDKs offer the same two in the same order and
land on TLS with a Go peer and with each other; in a browser the JS SDK
offers Noise alone, since a page cannot run libp2p's TLS, and a Node or
@@ -297,7 +297,7 @@ bytes), with a 64 KiB cap on the first frame.
credential. The client verifies that credential the same way and, for a
router, requires the router role. This is how a member joins: connect to a
router, run this handshake, and the router admits it to the relay and
- gossip. Both SDKs answer it too, so a `sam-node` can verify them before
+ gossip. Both SDKs answer it too, so a `agentmesh-node` can verify them before
calling.
- `/mesh/mcp/1.0.0` (`WithBiscuitAuth` then `HandleMCPStream`). Client sends
`AuthFrame{biscuit, target_service: "mcp://<service>", agent}`; server
@@ -314,7 +314,7 @@ bytes), with a 64 KiB cap on the first frame.
the same authorizer, then forwards `<upstream>` to the service with those
two headers stripped and `X-Peer-Id` set to the verified caller. The SDKs
are clients of this for `inference://`, `a2a://` and `egress://` services
- (an egress destination is one a `sam-node` serves for a hostname outside
+ (an egress destination is one a `agentmesh-node` serves for a hostname outside
the mesh, as the control plane assigned it; the SDK reaches it as any
other service, `/egress/<hostname>/<path>` on that node), and servers of
it for their own agent, `a2a://<name>`, only. Bodies are framed by
@@ -335,7 +335,7 @@ records up and announce none.
A peer that announced nothing is still reachable by peer ID: every router
relays for the peers it admitted, so a caller dials
`<router>/p2p-circuit/p2p/<peer>` through each router that admitted it.
-Both SDKs do this for a bare peer ID, and `sam-node` does it when it knows
+Both SDKs do this for a bare peer ID, and `agentmesh-node` does it when it knows
no other address for a peer (`preparePeerAddrs` in `internal/node/mcp.go`).
This is how an SDK agent is reached.
@@ -358,7 +358,7 @@ of it is derived in the SDK:
`hack/verify-sdk-generated.sh` fails when they are stale.
- The mesh policy arrives rendered: `GET /policies` answers
`PolicyConfigGetResponse{datalog_rules}`, one rule per entry, rendered by
- the control plane with `api.BuildPolicyRules`. `sam-node` adds the same
+ the control plane with `api.BuildPolicyRules`. `agentmesh-node` adds the same
text; no member compiles roles and bindings itself. An unparseable entry
rejects the whole response.
- Presence-only facts carry the single term `true`
@@ -377,15 +377,15 @@ service, no DHT record, no catalog entry. The reasons:
- **The agent is the principal; a service is infrastructure.** A harness
(LangChain, Claude Code, a browser agent) is an MCP client. The tools it
- should see through the mesh are the ones `sam-node`s publish. Something
+ should see through the mesh are the ones `agentmesh-node`s publish. Something
that must be reachable by name, a tool, a model, a named agent, is a
- deployment concern, and the sidecar model exists for it: the `sam-node`
+ deployment concern, and the sidecar model exists for it: the `agentmesh-node`
beside it publishes the service and enforces the policy once, in Go.
- **Publishing is the expensive part.** Being a provider needs a DHT
provide loop, a catalog report and provider records that go stale on
every rollout. Accepting requests for the agent itself needs the relay
reservation, the auth handshake and the authorizer, all of which a member
- needs anyway to be verified by a `sam-node` before it is called.
+ needs anyway to be verified by a `agentmesh-node` before it is called.
- **One inbound protocol.** A2A is the protocol for talking to an agent,
and the A2A SDKs serve one agent card each. One ingress means one
authorizer path to audit in three languages instead of two ingress
@@ -394,12 +394,12 @@ service, no DHT record, no catalog entry. The reasons:
reachable through a router's relay and nothing else, which is what
`accept_a2a` is. The JS SDK runs in a page: it reaches the router over
WebSocket (`wss` when the router sits behind a TLS-terminating edge, as
- `sam-one --tunnel` puts it), secures the connection with Noise, keeps its
+ `agentmesh-one --tunnel` puts it), secures the connection with Noise, keeps its
state in IndexedDB and answers its agent with a fetch handler.
What an SDK agent is on the wire: a peer with a relay reservation on a
router, answering `/mesh/auth/1.0.0` and `/libp2p-http` for `a2a://<name>`,
-with no DHT record and no catalog entry. To a `sam-node` it is a peer whose
+with no DHT record and no catalog entry. To a `agentmesh-node` it is a peer whose
address nobody announced, reached through the router that admitted both,
and whose credential it verifies before forwarding
`/mesh/<peer>/a2a/<name>/...`. Routers, the control plane and the Datalog
@@ -410,9 +410,9 @@ Two agents that both wrote nothing down still meet: A learns B's peer ID
present their credentials, and A opens the A2A conversation on that
connection; libp2p's secure channel is end to end, so the router carries
ciphertext.
-An agent that must be *found* by name runs behind a `sam-node`. Two agents
+An agent that must be *found* by name runs behind a `agentmesh-node`. Two agents
that both can only call out (two browsers) meet at a third agent behind a
-`sam-node` that both call.
+`agentmesh-node` that both call.
## Plan
@@ -429,9 +429,9 @@ holds against the control plane's records.
### Milestone 2 — join the mesh (done)
-- libp2p host per SDK, configured as `sam-node`'s: TCP and WebSocket, TLS,
+- libp2p host per SDK, configured as `agentmesh-node`'s: TCP and WebSocket, TLS,
yamux, identify, circuit relay v2 client. The testnets' routers listen on
- TCP; `sam-one`'s router is a WebSocket listener on the port that serves
+ TCP; `agentmesh-one`'s router is a WebSocket listener on the port that serves
its API (`/ws`, or `/wss` behind a tunnel), so a member reaches it over
WebSocket or not at all; `tests/integration/standalone_sdk_test.go` holds
both SDKs to it. JS: `libp2p`, `@libp2p/tcp`, `@libp2p/websockets`,
@@ -460,11 +460,11 @@ holds against the control plane's records.
with the handshake and a relay), and refuses a relay without the router
role, a router that trusts another control plane, and a refused
reservation. Integration: `tests/integration/sdk_mesh_test.go` runs one
- mesh with a control plane, a `sam-router`, a `sam-node` and one member per
+ mesh with a control plane, a `agentmesh-router`, a `agentmesh-node` and one member per
SDK, all real, then walks the connectivity matrix: every member on the
- router's lease; each SDK member verifies the `sam-node` and the other SDK
+ router's lease; each SDK member verifies the `agentmesh-node` and the other SDK
member on both the direct and the relayed path, and is verified by them;
- the `sam-node` reaches each member through the router; an admitted Go peer
+ the `agentmesh-node` reaches each member through the router; an admitted Go peer
does the same and sends a forged frame; an address behind the router for
a peer that is not on the mesh fails. About 7 seconds.
@@ -489,7 +489,7 @@ holds against the control plane's records.
and from the libp2p stream for `mcp.ClientSession`. `""` as the target is
the provider's own catalog (`list_local_services`, `get_mesh_info`).
- Egress floor: `join({ egressRequireLabels })` (`join(egress_require_labels=)`)
- is `sam-node`'s `egress.require_labels` for an SDK member: every provider
+ is `agentmesh-node`'s `egress.require_labels` for an SDK member: every provider
the session calls must attest all of them, on top of a call's required
labels, on every outbound call however the peer was named, MCP and HTTP
alike. It is the same rule as the caller's requirement (`api.LabelCheck`),
@@ -498,17 +498,17 @@ holds against the control plane's records.
implementations agree on it, as they do on the caller's requirement. The
HTTP path (`request`, `fetch`, `MeshTransport`) verifies the provider with
or without a floor, through the mutual `/mesh/auth/1.0.0` handshake, as
- `sam-node`'s `VerifyPeerLabels` does before its egress proxy sends
+ `agentmesh-node`'s `VerifyPeerLabels` does before its egress proxy sends
anything; a positive verdict is kept per peer for five minutes
(`labelGateTTL`); a refusal is not kept. An unmet floor is a
`LabelsNotSatisfiedError` naming the floor.
- `session.listTools(peer, service)` and `session.callTool(peer, service,
tool, args)` on top of that.
- Tests. Unit: each SDK calls a tool on an in-process provider that serves
- `/mesh/mcp/1.0.0` as `sam-node` does with the official MCP server behind
+ `/mesh/mcp/1.0.0` as `agentmesh-node` does with the official MCP server behind
it, reads its catalog, and is refused for missing labels, an untrusted
provider, a forged caller credential and an unknown service. Integration:
- the mesh of `sdk_mesh_test.go` has an MCP backend behind the `sam-node`
+ the mesh of `sdk_mesh_test.go` has an MCP backend behind the `agentmesh-node`
(`calc`, tool `add`); each SDK member discovers it in the DHT, lists and
calls `add` through the router, reads the node's catalog and is refused a
service the node does not have. The runners took `discover`, `tools` and
@@ -518,7 +518,7 @@ holds against the control plane's records.
- Datalog as the contract, Go side: the baseline moved into a generated
artifact both SDKs embed, the control plane renders the mesh policy as
- `datalog_rules`, and `sam-node` consumes that text like any other member.
+ `datalog_rules`, and `agentmesh-node` consumes that text like any other member.
See the authorization section above.
- Provider authorizer in each SDK (`authorizer.ts`, `authorizer.py`), built
from the artifact and `datalog_rules`, evaluated on every inbound
@@ -533,20 +533,20 @@ holds against the control plane's records.
listener, which is what an Express app with the A2A SDK's handlers is,
and runs it on the ingress's own `http.Server`.
- `session.accept_a2a(target, name=)` / `session.acceptA2A(spec)` fetches
- the mesh policy, re-reads it on `sam-node`'s sync interval and starts
+ the mesh policy, re-reads it on `agentmesh-node`'s sync interval and starts
answering. It announces nothing. One agent per session.
- `/libp2p-http` client for callers built on HTTP libraries:
`open_http_request` / `fetchOverStream` return once the headers are in
and stream the body; `MeshTransport` (httpx) and `session.fetch()`
(fetch) carry a client's requests to the peer a mesh URL names. The A2A
SDK's client takes either without changes. The card of an agent behind a
- `sam-node` names the agent's own address; a GET of the well-known card
+ `agentmesh-node` names the agent's own address; a GET of the well-known card
path or of the service root is answered the way the node's egress proxy
answers it: the SDK fetches the card itself, with identity encoding, and
serves it rewritten (`rewriteAgentCard` / `rewrite_agent_card`): HTTP
interfaces point at the mesh URL, gRPC ones are dropped, signatures go.
Streaming stays as the agent declares it, since the transport streams.
-- `sam-node`: a peer it knows no address for is dialed through every
+- `agentmesh-node`: a peer it knows no address for is dialed through every
router it authenticated with, so its egress proxy reaches an agent by
peer ID (`preparePeerAddrs`).
- Examples with the official A2A SDKs (`a2a-agent.ts`, `a2a-call.ts`;
@@ -562,16 +562,16 @@ holds against the control plane's records.
a Node listener), an httpx client on `MeshTransport`, and refusals for a
role that grants nothing, an ungranted type, another agent name (404), a
missing biscuit and a dotted path; plus the authorizer alone against the
- decisions `internal/node/middleware_test.go` pins, and `sam-node`'s
+ decisions `internal/node/middleware_test.go` pins, and `agentmesh-node`'s
router fallback. Integration: in the mesh of `sdk_mesh_test.go` each SDK
- member accepts `a2a://agent`; the `sam-node` reaches it by peer ID
+ member accepts `a2a://agent`; the `agentmesh-node` reaches it by peer ID
through its egress proxy, the other SDK member does the same with no
lookup, a lookup for `a2a://agent` finds nothing, the member refuses a
`/mesh/mcp/1.0.0` stream, and a Go peer whose role the policy grants
nothing gets 403 and is answered once it presents a node-role token.
About 9 seconds for the whole mesh. `TestNativeSDKA2A` runs the A2A SDK
agents and calls each from the other language with the A2A SDK's client;
- the answer names the caller's peer, and a `sam-node` fetches the card
+ the answer names the caller's peer, and a `agentmesh-node` fetches the card
through its egress proxy.
### Milestone 5 — parity and release (done)
@@ -585,7 +585,7 @@ holds against the control plane's records.
reconciled with the rule that a ban recorded after the request went out
survives an answer that omits it; the mesh policy while accepting
callers. Runs
- once shortly after join, then on `sam-node`'s interval with the same
+ once shortly after join, then on `agentmesh-node`'s interval with the same
jitter, and whenever an event triggers it.
- Gossip events on `/mesh/events/v1`: the topic validator rejects
anything not signed by a trusted control plane key and ignores stale
@@ -597,7 +597,7 @@ holds against the control plane's records.
connections are dropped when the ban lands.
- Publishing: `.github/workflows/release.yml` stamps the release tag's
version on both packages (`hack/sdk-version.sh`) and publishes
- `@sam-mesh/sdk` to npm and `sam-mesh` to PyPI through trusted
+ `@agentmesh-p2p/sdk` to npm and `agentmesh-p2p` to PyPI through trusted
publishing. A prerelease tag (`v0.1.0-rc.4`) publishes under the npm
dist-tag `next`, a stable tag under `latest`; PyPI needs no tag, `pip`
skips prereleases on its own. When a publish job (`publish-sdk-js`
@@ -605,12 +605,12 @@ holds against the control plane's records.
the failed job, or run the workflow by hand from the Actions tab with
the tag and target SDK as input; it checks out that tag and publishes
the selected SDK. One-time setup by a package owner: on npmjs.com, create the
- `sam-mesh` organization, publish `@sam-mesh/sdk` 0.1.0 once by hand
+ `agentmesh-p2p` organization, publish `@agentmesh-p2p/sdk` 0.1.0 once by hand
(`cd sdk/js && npm publish --access public`; the trusted-publisher
settings live on the package page, which exists only after that), then
register `google/sam` with workflow `release.yml` under the package's
Settings, Trusted publishing; on pypi.org, add a pending publisher for
- project `sam-mesh` with the same repository and workflow (environment
+ project `agentmesh-p2p` with the same repository and workflow (environment
left empty), which reserves the name and lets the first tag create the
project. No publishing token is stored in the repository.
- Docs: `site/content/docs/guides/native-sdks.md`.
@@ -625,12 +625,12 @@ holds against the control plane's records.
and a pull agrees; then the control plane rotates its key and announces
it, and every member ends up trusting both keys, holding a credential
that verifies only under the new one, and still authenticating with the
- `sam-node`.
+ `agentmesh-node`.
### On the testnets
Both testnets run the example programs, unchanged, as canaries beside the
-`sam-node` ones (`.github/k8s/sam-sdk-canary-template.yaml`): two pairs, an
+`agentmesh-node` ones (`.github/k8s/agentmesh-sdk-canary-template.yaml`): two pairs, an
agent written with one SDK and the official A2A SDK (`a2a-agent.ts`,
`a2a_agent.py`) and a caller written with the other in one pod, enrolled
with the pod's projected service account token through `AGENTMESH_JWT_PATH`. The
@@ -639,14 +639,14 @@ prints, through a volume the pod shares, sends it a message with the A2A
SDK's client every five minutes and is Ready while the last answer named
the caller, so the Deployment's availability says whether an agent is still
reachable after hours on the mesh. Two CronJobs cross every implementation
-boundary every 15 minutes and once per rollout: the `sam-node` cold-path
+boundary every 15 minutes and once per rollout: the `agentmesh-node` cold-path
probe (`sam-probe-cronjob-template.yaml`) runs an agent per SDK as sidecars
and fetches each one's agent card by peer ID through the egress proxy
(node → SDK), and the SDK cold-path probe
-(`sam-sdk-probe-cronjob-template.yaml`) runs each SDK's callers against the
+(`agentmesh-sdk-probe-cronjob-template.yaml`) runs each SDK's callers against the
everything canary by name (SDK → node) and the other SDK's agent by peer ID,
the card with the mesh SDK's client and a message with the A2A SDK's
-(SDK → SDK). The images (`Dockerfile.sam-sdk-js`, `Dockerfile.sam-sdk-python`)
+(SDK → SDK). The images (`Dockerfile.agentmesh-sdk-js`, `Dockerfile.agentmesh-sdk-python`)
are built per commit by `deploy.yaml`, so `bananas` runs the SDKs at the
same commit as the Go components they talk to.
@@ -654,7 +654,7 @@ same commit as the Go components they talk to.
- The connector interface for platforms (issue #480): `Attach`, `Detach`,
`Refresh`, `Status` and the agent bundle, so a scheduler places SDK
- members the way it places `sam-box` sandboxes.
+ members the way it places `agentmesh-box` sandboxes.
- Reading the control plane's events also for router address changes, and
re-dialing a router that replaced another.
@@ -662,7 +662,7 @@ same commit as the Go components they talk to.
- Rewriting the control plane, router or sandbox components; they stay Go.
- Publishing services from an SDK: an MCP server, a named inference or A2A
- service, a DHT record or a catalog entry. That is `sam-node`'s job; see
+ service, a DHT record or a catalog entry. That is `agentmesh-node`'s job; see
[Agents, not services](#agents-not-services).
- Any SDK-only wire protocol. If an SDK needs something the Go node does not
speak, the Go node learns it first.
@@ -682,11 +682,11 @@ python3 -m venv sdk/python/.venv
sdk/python/.venv/bin/pip install -e 'sdk/python[test]'
sdk/python/.venv/bin/pytest sdk/python/tests
-# Both against a real control plane, router and sam-node, and the example
+# Both against a real control plane, router and agentmesh-node, and the example
# programs the docs embed against the same
go test ./tests/integration -run TestNativeSDK -v
-# The JS SDK in a browser page against sam-one, in Chromium (Playwright);
+# The JS SDK in a browser page against agentmesh-one, in Chromium (Playwright);
# also run by `make ui-test`
cd sdk/js && node scripts/bundle-browser.mjs examples/browser/app.js build/browser-example
cd tests/ui && npm ci && npx playwright install chromium && npx playwright test browser-sdk
@@ -741,7 +741,7 @@ one follows is named so a change on one side can be carried to the others.
| `session.ts` | `session.py` | `MeshSession`: join, relay reservation, refresh loop, control plane sync loop, gossip events, `acceptA2A()` / `accept_a2a()`, `fetch()` |
| `discovery.ts` | `discovery.py` | service keys and DHT lookups as `internal/node/service.go`; lookups only, no records |
| `mcp.ts` | `mcp_client.py` | MCP over `/mesh/mcp/1.0.0`, the client side of `internal/node/gate.go` |
-| `authorizer.ts` | `authorizer.py` | the provider authorizer, as `internal/node.(*SamNode).Authorize`, over the generated baseline and `datalog_rules` |
+| `authorizer.ts` | `authorizer.py` | the provider authorizer, as `internal/node.(*AgentMeshNode).Authorize`, over the generated baseline and `datalog_rules` |
| `libp2p-http.ts` | `libp2p_http.py` | `/libp2p-http` client (streaming) and the A2A ingress for the agent, as go-libp2p-http and `StartIngressServer`; mesh URLs |
| `http1.ts` | — | HTTP/1.1 heads and bodies on a libp2p stream, for `libp2p-http.ts` (Python uses `h11` in `libp2p_http.py`) |
| `libp2p-http-node.ts` | — | the ingress for a Node request listener (an Express app), Node's own HTTP server over the stream |
diff --git a/sdk/js/README.md b/sdk/js/README.md
index 5d1895ae..592d431f 100644
--- a/sdk/js/README.md
+++ b/sdk/js/README.md
@@ -1,22 +1,22 @@
-# @sam-mesh/sdk
+# @agentmesh-p2p/sdk
-Native JavaScript SDK for joining an Agent Mesh (SAM) from inside the agent
-process. It replaces the `sam-node` sidecar for agents written for Node.js
+Native JavaScript SDK for joining an Agent Mesh from inside the agent
+process. It replaces the `agentmesh-node` sidecar for agents written for Node.js
or running in a browser page:
the agent enrolls with the control plane, joins the mesh through a router,
finds services and calls them, answers A2A requests for the agent itself,
and follows the control plane's keys, bans and policy while it runs. It
publishes no service; a tool or a model others should find by name runs
-behind a `sam-node`.
+behind a `agentmesh-node`.
Guide: [sam-mesh.dev/docs/guides/native-sdks](https://sam-mesh.dev/docs/guides/native-sdks/),
from an empty machine to two programs on a mesh.
-Source: [github.com/google/sam/tree/main/sdk/js](https://github.com/google/sam/tree/main/sdk/js).
+Source: [github.com/google/agentmesh/tree/main/sdk/js](https://github.com/google/agentmesh/tree/main/sdk/js).
## Install
```bash
-npm install @sam-mesh/sdk @modelcontextprotocol/sdk zod
+npm install @agentmesh-p2p/sdk @modelcontextprotocol/sdk zod
```
Requires Node.js 22.18 or later. In a browser, bundle it with the page
@@ -27,10 +27,10 @@ section has the details and an example page.
## Use
Both programs below are in
-[`examples/`](https://github.com/google/sam/tree/main/sdk/js/examples) and
+[`examples/`](https://github.com/google/agentmesh/tree/main/sdk/js/examples) and
run against a real mesh in the repository's tests. They read the mesh from
`AGENTMESH_CONTROL_PLANE_URL` and the enrollment token from
-`AGENTMESH_BOOTSTRAP_TOKEN_PATH`; the guide shows how to get both from `sam-one`
+`AGENTMESH_BOOTSTRAP_TOKEN_PATH`; the guide shows how to get both from `agentmesh-one`
or from the operator of an existing mesh.
Find a service and call it:
@@ -51,7 +51,7 @@ Find a service and call it:
// Kubernetes projected service account token), and keeps the identity and
// credential in AGENTMESH_STATE_DIR; later runs resume from there without it.
import { homedir } from "node:os";
-import { AgentMesh, type DiscoveredProvider } from "@sam-mesh/sdk";
+import { AgentMesh, type DiscoveredProvider } from "@agentmesh-p2p/sdk";
let argv = process.argv.slice(2);
// A first argument that is not a service target is the peer ID of an agent.
@@ -65,7 +65,7 @@ const mesh = await AgentMesh.enroll({
controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
jwtPath: process.env.AGENTMESH_JWT_PATH,
- stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/sam-mesh/caller`,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/caller`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
@@ -136,7 +136,7 @@ agent by its peer ID, the one it prints, through a router:
// credential in AGENTMESH_STATE_DIR; later runs resume from there, as the same
// peer, without it.
import { homedir } from "node:os";
-import { AgentMesh } from "@sam-mesh/sdk";
+import { AgentMesh } from "@agentmesh-p2p/sdk";
const [backendURL] = process.argv.slice(2);
@@ -144,7 +144,7 @@ const mesh = await AgentMesh.enroll({
controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
jwtPath: process.env.AGENTMESH_JWT_PATH,
- stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/sam-mesh/agent`,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/agent`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
@@ -180,4 +180,4 @@ A plaintext `http://` control plane is accepted only on loopback. Pass
## License
Apache-2.0. Issues and contributions at
-[github.com/google/sam](https://github.com/google/sam).
+[github.com/google/agentmesh](https://github.com/google/agentmesh).
diff --git a/sdk/js/examples/a2a-agent.ts b/sdk/js/examples/a2a-agent.ts
index c74d50d0..3d2f17f1 100644
--- a/sdk/js/examples/a2a-agent.ts
+++ b/sdk/js/examples/a2a-agent.ts
@@ -18,13 +18,13 @@ import express from "express";
import { A2A_PROTOCOL_VERSION, AGENT_CARD_PATH, Role, type AgentCard, type Message } from "@a2a-js/sdk";
import { AgentEvent, DefaultRequestHandler, InMemoryTaskStore, type AgentExecutor, type ExecutionEventBus, type RequestContext } from "@a2a-js/sdk/server";
import { UserBuilder, agentCardHandler, jsonRpcHandler } from "@a2a-js/sdk/server/express";
-import { AgentMesh, MeshSession } from "@sam-mesh/sdk";
+import { AgentMesh, MeshSession } from "@agentmesh-p2p/sdk";
const mesh = await AgentMesh.enroll({
controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
jwtPath: process.env.AGENTMESH_JWT_PATH,
- stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/sam-mesh/a2a-agent`,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/a2a-agent`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
diff --git a/sdk/js/examples/a2a-call.ts b/sdk/js/examples/a2a-call.ts
index 90227767..8890f6f1 100644
--- a/sdk/js/examples/a2a-call.ts
+++ b/sdk/js/examples/a2a-call.ts
@@ -14,7 +14,7 @@ import { homedir } from "node:os";
import { randomUUID } from "node:crypto";
import { Message, Role, type SendMessageRequest } from "@a2a-js/sdk";
import { ClientFactory, DefaultAgentCardResolver, JsonRpcTransportFactory } from "@a2a-js/sdk/client";
-import { AgentMesh, MeshSession } from "@sam-mesh/sdk";
+import { AgentMesh, MeshSession } from "@agentmesh-p2p/sdk";
const [peerId, text = "hello"] = process.argv.slice(2);
if (peerId === undefined) {
@@ -25,7 +25,7 @@ const mesh = await AgentMesh.enroll({
controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
jwtPath: process.env.AGENTMESH_JWT_PATH,
- stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/sam-mesh/a2a-caller`,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/a2a-caller`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
diff --git a/sdk/js/examples/agent.ts b/sdk/js/examples/agent.ts
index 696b695c..8c8a29a1 100644
--- a/sdk/js/examples/agent.ts
+++ b/sdk/js/examples/agent.ts
@@ -14,7 +14,7 @@
// credential in AGENTMESH_STATE_DIR; later runs resume from there, as the same
// peer, without it.
import { homedir } from "node:os";
-import { AgentMesh } from "@sam-mesh/sdk";
+import { AgentMesh } from "@agentmesh-p2p/sdk";
const [backendURL] = process.argv.slice(2);
@@ -22,7 +22,7 @@ const mesh = await AgentMesh.enroll({
controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
jwtPath: process.env.AGENTMESH_JWT_PATH,
- stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/sam-mesh/agent`,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/agent`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
diff --git a/sdk/js/examples/browser/app.js b/sdk/js/examples/browser/app.js
index 75276b73..915c62fd 100644
--- a/sdk/js/examples/browser/app.js
+++ b/sdk/js/examples/browser/app.js
@@ -25,7 +25,7 @@
import { A2A_PROTOCOL_VERSION, AGENT_CARD_PATH, Message, Role } from "@a2a-js/sdk";
import { ClientFactory, DefaultAgentCardResolver, JsonRpcTransportFactory } from "@a2a-js/sdk/client";
import { AgentEvent, DefaultRequestHandler, InMemoryTaskStore, JsonRpcTransportHandler, ServerCallContext } from "@a2a-js/sdk/server";
-import { AgentMesh, MeshSession } from "@sam-mesh/sdk";
+import { AgentMesh, MeshSession } from "@agentmesh-p2p/sdk";
const $ = (id) => document.getElementById(id);
const params = new URLSearchParams(location.search);
@@ -173,4 +173,4 @@ $("call-form").addEventListener("submit", (event) => {
});
// For scripts and tests driving the page.
-window.sam = { join, call, get session() { return session; } };
+window.agentmesh = { join, call, get session() { return session; } };
diff --git a/sdk/js/examples/browser/index.html b/sdk/js/examples/browser/index.html
index 1d60ca41..d1b27964 100644
--- a/sdk/js/examples/browser/index.html
+++ b/sdk/js/examples/browser/index.html
@@ -17,7 +17,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
- <title>SAM browser agent</title>
+ <title>Agent Mesh browser agent</title>
<style>
body { font: 14px system-ui, sans-serif; margin: 2rem; max-width: 48rem; }
label { display: block; margin-top: 0.75rem; }
@@ -28,7 +28,7 @@
</style>
</head>
<body>
- <h1>SAM browser agent</h1>
+ <h1>Agent Mesh browser agent</h1>
<p>
This page is a member of the mesh: it enrolls with the control plane, joins through a router over WebSocket and Noise,
answers A2A requests as <code>a2a://agent</code> and calls other agents by peer ID.
diff --git a/sdk/js/examples/call.ts b/sdk/js/examples/call.ts
index 8ee49673..324667cd 100644
--- a/sdk/js/examples/call.ts
+++ b/sdk/js/examples/call.ts
@@ -12,7 +12,7 @@
// Kubernetes projected service account token), and keeps the identity and
// credential in AGENTMESH_STATE_DIR; later runs resume from there without it.
import { homedir } from "node:os";
-import { AgentMesh, type DiscoveredProvider } from "@sam-mesh/sdk";
+import { AgentMesh, type DiscoveredProvider } from "@agentmesh-p2p/sdk";
let argv = process.argv.slice(2);
// A first argument that is not a service target is the peer ID of an agent.
@@ -26,7 +26,7 @@ const mesh = await AgentMesh.enroll({
controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
jwtPath: process.env.AGENTMESH_JWT_PATH,
- stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/sam-mesh/caller`,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/caller`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
diff --git a/sdk/js/package-lock.json b/sdk/js/package-lock.json
index cb73e45d..1a960a9d 100644
--- a/sdk/js/package-lock.json
+++ b/sdk/js/package-lock.json
@@ -1,11 +1,11 @@
{
- "name": "@sam-mesh/sdk",
+ "name": "@agentmesh-p2p/sdk",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
- "name": "@sam-mesh/sdk",
+ "name": "@agentmesh-p2p/sdk",
"version": "0.1.0",
"license": "Apache-2.0",
"dependencies": {
diff --git a/sdk/js/package.json b/sdk/js/package.json
index 3518c56f..7b6ba0f3 100644
--- a/sdk/js/package.json
+++ b/sdk/js/package.json
@@ -1,11 +1,11 @@
{
- "name": "@sam-mesh/sdk",
+ "name": "@agentmesh-p2p/sdk",
"version": "0.1.0",
- "description": "Native SDK for joining an Agent Mesh (SAM) from a Node.js agent process or a browser page",
+ "description": "Native SDK for joining an Agent Mesh from a Node.js agent process or a browser page",
"license": "Apache-2.0",
"repository": {
"type": "git",
- "url": "git+https://github.com/google/sam.git",
+ "url": "git+https://github.com/google/agentmesh.git",
"directory": "sdk/js"
},
"type": "module",
diff --git a/sdk/js/src/auth.ts b/sdk/js/src/auth.ts
index c61e82bc..78c6794a 100644
--- a/sdk/js/src/auth.ts
+++ b/sdk/js/src/auth.ts
@@ -81,7 +81,7 @@ export interface AuthServerOptions {
export const AUTH_HANDLER_OPTIONS = { runOnLimitedConnection: true };
/**
- * Server side of /mesh/auth/1.0.0, mirroring sam-node's HandleAuthHandshake:
+ * Server side of /mesh/auth/1.0.0, mirroring agentmesh-node's HandleAuthHandshake:
* verify the caller's biscuit against the control plane keys and its
* connection peer ID, then answer with our own. A failed verification gets
* no answer, only a closed stream, as on the Go side.
diff --git a/sdk/js/src/authorizer.ts b/sdk/js/src/authorizer.ts
index 6fd90eab..334c2d72 100644
--- a/sdk/js/src/authorizer.ts
+++ b/sdk/js/src/authorizer.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// The provider-side authorizer, mirroring internal/node.(*SamNode).Authorize.
+// The provider-side authorizer, mirroring internal/node.(*AgentMeshNode).Authorize.
// Every piece of Datalog it evaluates is text: the baseline generated from
// api/datalog.go (gen/datalog.ts) and the mesh policy rules the control
// plane renders (GET /policies). Nothing here derives rules from roles.
@@ -22,7 +22,7 @@ import { parseServiceTarget } from "./discovery.ts";
import { BASELINE_DATALOG } from "./gen/datalog.ts";
import { evaluateTaskRules, isSafeRequestHTTPPath } from "./tar.ts";
-/** What a caller asks for, as sam-node's RequestContext. */
+/** What a caller asks for, as agentmesh-node's RequestContext. */
export interface AuthorizeRequest {
/** The caller's biscuit, as it arrived in the AuthFrame or X-Mesh-Biscuit. */
biscuit: Uint8Array;
@@ -111,7 +111,7 @@ export async function authorizeCaller(req: AuthorizeRequest, options: ProviderAu
};
// The action: service(type, name). An empty target is the protocol itself
- // in the system namespace, as sam-node scopes its own catalog.
+ // in the system namespace, as agentmesh-node scopes its own catalog.
let svcType: string;
let svcName: string;
if (req.targetService === "") {
diff --git a/sdk/js/src/credential.ts b/sdk/js/src/credential.ts
index 588c969c..f0e435a4 100644
--- a/sdk/js/src/credential.ts
+++ b/sdk/js/src/credential.ts
@@ -38,14 +38,14 @@ export interface MeshCredential {
* The trusted set when the biscuit was issued. A key trusted now that was
* not in this set means a rotation happened since: the biscuit is signed
* by a retiring key and must be refreshed before that key leaves its
- * grace period (sam-node's identityPredatesRotation).
+ * grace period (agentmesh-node's identityPredatesRotation).
*/
issuedUnderKeys: Uint8Array[];
/** Router multiaddrs, `/p2p/<peer id>` suffixed, as handed out at enrollment. */
routerAddresses: string[];
/**
* What other implementations persist in the same file and this SDK does
- * not use: key receipt times and sam-node's OIDC session. Carried through
+ * not use: key receipt times and agentmesh-node's OIDC session. Carried through
* so a state directory survives a round trip untouched.
*/
extra?: { receiveTime: Map<string, Timestamp>; oidcSession?: OIDCSession };
@@ -126,8 +126,8 @@ export function decodeAuthResponse(bytes: Uint8Array): AuthResponse {
/**
* credential.json is the api.MemberCredential message as protojson with
- * proto field names, the layout `sam-node state export` writes and every
- * SDK reads. An unknown field is an error, as on every SAM surface.
+ * proto field names, the layout `agentmesh-node state export` writes and every
+ * SDK reads. An unknown field is an error, as on every Agent Mesh surface.
*/
export function credentialToJSON(c: MeshCredential): string {
const message = create(MemberCredentialSchema, {
diff --git a/sdk/js/src/discovery.ts b/sdk/js/src/discovery.ts
index 45c32f58..0ddee318 100644
--- a/sdk/js/src/discovery.ts
+++ b/sdk/js/src/discovery.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// Service discovery as sam-node does it (internal/node/service.go): a
+// Service discovery as agentmesh-node does it (internal/node/service.go): a
// provider record in the mesh DHT under a CID derived from the service key.
import { CID } from "multiformats/cid";
diff --git a/sdk/js/src/host.test.ts b/sdk/js/src/host.test.ts
index 590d1bb4..147fc4d4 100644
--- a/sdk/js/src/host.test.ts
+++ b/sdk/js/src/host.test.ts
@@ -21,7 +21,7 @@ import { Identity } from "./identity.ts";
const ECHO = "/test/echo/1.0.0";
-// A TLS-terminating edge in front of the router (sam-one behind a tunnel)
+// A TLS-terminating edge in front of the router (agentmesh-one behind a tunnel)
// selects the origin by the name in the TLS SNI and the Host header, so a
// /dns4 WebSocket address is dialed by its name, not by what it resolves to.
// Pinned on the Host header of the upgrade request; the SNI is the same string.
@@ -52,7 +52,7 @@ test("a /dns4 WebSocket address is dialed by its name", async () => {
}
});
-// A mesh host reaches a peer over WebSocket as it does over TCP: sam-one's
+// A mesh host reaches a peer over WebSocket as it does over TCP: agentmesh-one's
// router listens on /ws alone, on the port that also serves its HTTP API.
for (const listen of ["/ip4/127.0.0.1/tcp/0", "/ip4/127.0.0.1/tcp/0/ws"]) {
test(`a mesh host dials ${listen} and opens a TLS+yamux stream`, async () => {
diff --git a/sdk/js/src/host.ts b/sdk/js/src/host.ts
index 28f241d2..6953487e 100644
--- a/sdk/js/src/host.ts
+++ b/sdk/js/src/host.ts
@@ -13,7 +13,7 @@
// limitations under the License.
// The libp2p host a member joins the mesh with, configured the way
-// sam-node's is (internal/node/node.go): yamux the muxer, circuit relay v2
+// agentmesh-node's is (internal/node/node.go): yamux the muxer, circuit relay v2
// for reachability through the routers. Transports and the security
// protocol come from the runtime (platform/transports.ts): on Node TCP and
// WebSocket with TLS, in a browser WebSocket with Noise.
@@ -41,7 +41,7 @@ export interface MeshHostOptions {
listenAddrs?: string[];
/**
* Peers the control plane has banned. Consulted for every dial and every
- * inbound connection, as sam-node's connection gater; the session keeps
+ * inbound connection, as agentmesh-node's connection gater; the session keeps
* it current from /info and the gossip events.
*/
banned?: { has(peerId: string): boolean };
@@ -73,7 +73,7 @@ export async function createMeshHost(identity: Identity, options: MeshHostOption
// published them, and every connection is authenticated by peer ID
// whatever the address, so no address is refused for its shape. In a
// browser js-libp2p would otherwise skip loopback and plain ws://
- // addresses, which is what sam-one on the same machine advertises; a
+ // addresses, which is what agentmesh-one on the same machine advertises; a
// page on https cannot open ws:// anyway, the browser sees to that.
denyDialMultiaddr: () => false,
},
diff --git a/sdk/js/src/identity.ts b/sdk/js/src/identity.ts
index c5439a00..2fbb9e2c 100644
--- a/sdk/js/src/identity.ts
+++ b/sdk/js/src/identity.ts
@@ -13,7 +13,7 @@
// limitations under the License.
// A mesh identity is an ed25519 key pair. Its peer ID is the one libp2p
-// derives, so the same key works in the SDK, in sam-node and on the wire.
+// derives, so the same key works in the SDK, in agentmesh-node and on the wire.
// The arithmetic is @noble/curves, the implementation libp2p itself uses,
// so an identity is built and used the same way in Node and in a browser.
@@ -65,7 +65,7 @@ export function peerIdFromPublicKey(publicKeyRaw: Uint8Array): string {
/**
* The base58btc form of a peer ID written in any encoding libp2p accepts
- * (base58btc multihash, CIDv1). Every key, ban set and comparison in SAM is
+ * (base58btc multihash, CIDv1). Every key, ban set and comparison in Agent Mesh is
* on this form, as peer.ID.String() in Go; a string read off the wire or
* from a caller goes through here before it is used as one. Throws when the
* text is not a peer ID at all.
@@ -103,7 +103,7 @@ export class Identity {
return new Identity(seed);
}
- /** Loads the libp2p protobuf private key encoding, the format sam-node persists. */
+ /** Loads the libp2p protobuf private key encoding, the format agentmesh-node persists. */
static fromLibp2pPrivateKey(bytes: Uint8Array): Identity {
if (bytes.length !== LIBP2P_PRIVATE_KEY_PREFIX.length + 64 || !startsWith(bytes, LIBP2P_PRIVATE_KEY_PREFIX)) {
throw new Error("not a libp2p ed25519 private key");
diff --git a/sdk/js/src/libp2p-http-node.ts b/sdk/js/src/libp2p-http-node.ts
index 4fd237ff..84efb2a2 100644
--- a/sdk/js/src/libp2p-http-node.ts
+++ b/sdk/js/src/libp2p-http-node.ts
@@ -102,7 +102,7 @@ async function serveListener(req: http.IncomingMessage, res: http.ServerResponse
res.end(admission.text + "\n");
return;
}
- // The listener sees the request as a backend behind sam-node would: the
+ // The listener sees the request as a backend behind agentmesh-node would: the
// path relative to the service, the verified caller, never the biscuit.
// X-Peer-Id is set, not added, so an inbound value cannot pose as the
// verified peer.
diff --git a/sdk/js/src/libp2p-http.test.ts b/sdk/js/src/libp2p-http.test.ts
index dc3b695f..e518bcd0 100644
--- a/sdk/js/src/libp2p-http.test.ts
+++ b/sdk/js/src/libp2p-http.test.ts
@@ -14,7 +14,7 @@
// The A2A ingress in one process: this SDK's /libp2p-http handler for one
// agent behind a js-libp2p host, called with this SDK's clients, including
-// the fetch a session hands to clients built on fetch. The real sam-node as
+// the fetch a session hands to clients built on fetch. The real agentmesh-node as
// a caller is exercised by tests/integration.
import { yamux } from "@chainsafe/libp2p-yamux";
@@ -270,7 +270,7 @@ test("a fetch over the stream delivers an SSE body event by event", async () =>
);
});
-test("the card of an agent behind a node comes back rewritten for the mesh, as sam-node serves it", async () => {
+test("the card of an agent behind a node comes back rewritten for the mesh, as agentmesh-node serves it", async () => {
const conn = await dial();
const base = meshURL(agent.peerId.toString(), "a2a://agent");
const response = await fetchOverStream(conn, callerBiscuit, new Request(`${base}/${AGENT_CARD_PATH}`));
diff --git a/sdk/js/src/libp2p-http.ts b/sdk/js/src/libp2p-http.ts
index b32fb080..c7570257 100644
--- a/sdk/js/src/libp2p-http.ts
+++ b/sdk/js/src/libp2p-http.ts
@@ -14,7 +14,7 @@
// The /libp2p-http protocol (go-libp2p-http): the client that calls inference
// and A2A services on the mesh, and the ingress that accepts A2A requests for
-// this member's own agent, gated by the authorizer the way sam-node gates its
+// this member's own agent, gated by the authorizer the way agentmesh-node gates its
// ingress (StartIngressServer in internal/node). Requests and responses are
// framed by the codec in http1.ts on the libp2p stream itself, so bodies
// stream in both directions, an A2A message/stream (SSE) works, and none of
@@ -60,8 +60,8 @@ export const DEFAULT_A2A_NAME = "agent";
/**
* The path prefix of a mesh URL, http://mesh/mesh/<peer-id>/<type>/<name>/<path>:
- * the shape of sam-node's egress proxy and of an agent card rewritten for the
- * mesh, by sam-node or by this SDK. The host is ignored; the peer ID is in the
+ * the shape of agentmesh-node's egress proxy and of an agent card rewritten for the
+ * mesh, by agentmesh-node or by this SDK. The host is ignored; the peer ID is in the
* path because URL parsers lowercase the host and a peer ID is case-sensitive.
*/
export const MESH_PATH_PREFIX = "/mesh/";
@@ -92,7 +92,7 @@ export type NodeRequestListener = (req: any, res: any) => void;
* exactly one of url (an A2A server beside this process), handler or
* listener (in this process). Authorized requests arrive with the biscuit
* header stripped, X-Peer-Id naming the verified caller and the path
- * relative to /a2a/<name>, as sam-node forwards them. The endpoint is not
+ * relative to /a2a/<name>, as agentmesh-node forwards them. The endpoint is not
* announced anywhere; a caller reaches it by peer ID.
*/
export interface A2AEndpointSpec {
@@ -174,7 +174,7 @@ export interface IngressAdmission {
}
/**
- * Server-side admission of /libp2p-http, as sam-node's StartIngressServer:
+ * Server-side admission of /libp2p-http, as agentmesh-node's StartIngressServer:
* the path is /<type>/<name>[/<upstream>], the caller's biscuit is
* X-Mesh-Biscuit, and the request is authorized for <type>://<name> before
* anything is forwarded. Only the agent's own endpoint is answered; anything
@@ -269,7 +269,7 @@ export function agentHeaders(inbound: Headers, remotePeer: string, noTrailingSla
return headers;
}
-/** A plain-text refusal, as sam-node's ingress writes one. */
+/** A plain-text refusal, as agentmesh-node's ingress writes one. */
export function refusalResponse(refusal: IngressRefusal): Response {
return new Response(refusal.text + "\n", { status: refusal.status, headers: { "content-type": "text/plain; charset=utf-8" } });
}
@@ -412,7 +412,7 @@ function agentCardService(method: string, target: string): string | undefined {
}
/**
- * An agent card rebuilt for the mesh, as sam-node's egress proxy serves it:
+ * An agent card rebuilt for the mesh, as agentmesh-node's egress proxy serves it:
* HTTP interfaces point at base, gRPC ones go, signatures no longer match.
* Streaming stays as declared, this transport streams. Throws when no interface remains.
*/
@@ -437,7 +437,7 @@ function carriedOverHTTP(iface: unknown): boolean {
}
/**
- * Impersonates the agent's card endpoint as sam-node's egress proxy does: holds
+ * Impersonates the agent's card endpoint as agentmesh-node's egress proxy does: holds
* the client's request, fetches the card itself with identity encoding, and
* answers with it regenerated; the agent's own non-200 is relayed as it is.
*/
@@ -503,7 +503,7 @@ export interface HTTPStreamOptions {
* per request, plain HTTP/1.1 with Host set to the peer ID and the biscuit in
* X-Mesh-Biscuit. Resolves once the response headers are in; the body streams
* after, so an SSE response is consumed as the peer sends it. An agent card
- * is served rewritten for the mesh (rewriteAgentCard), as sam-node serves one.
+ * is served rewritten for the mesh (rewriteAgentCard), as agentmesh-node serves one.
*/
export async function fetchOverStream(conn: Connection, biscuit: Uint8Array, request: Request, options: HTTPStreamOptions = {}): Promise<Response> {
const { target } = splitMeshURL(new URL(request.url));
diff --git a/sdk/js/src/mcp.test.ts b/sdk/js/src/mcp.test.ts
index 999b0c27..80ef7adc 100644
--- a/sdk/js/src/mcp.test.ts
+++ b/sdk/js/src/mcp.test.ts
@@ -13,8 +13,8 @@
// limitations under the License.
// A provider in one process: a js-libp2p host that serves /mesh/mcp/1.0.0
-// the way sam-node does (AuthFrame in, AuthResponse out, then MCP over the
-// stream) with the official MCP server behind it. The real sam-node is
+// the way agentmesh-node does (AuthFrame in, AuthResponse out, then MCP over the
+// stream) with the official MCP server behind it. The real agentmesh-node is
// exercised by tests/integration/sdk_mesh_test.go.
import { create, fromBinary, toBinary } from "@bufbuild/protobuf";
@@ -70,7 +70,7 @@ function newHost(): Promise<Libp2p> {
});
}
-/** sam-node's WithBiscuitAuth(HandleMCPStream) in miniature. */
+/** agentmesh-node's WithBiscuitAuth(HandleMCPStream) in miniature. */
async function serveMCP(stream: Stream, connection: Connection): Promise<void> {
const auth = lpStream(stream, { maxDataLength: MAX_AUTH_FRAME_BYTES });
const frame = fromBinary(AuthFrameSchema, (await auth.read()).subarray());
@@ -82,7 +82,7 @@ async function serveMCP(stream: Stream, connection: Connection): Promise<void> {
}
const { type, name } = parseServiceTarget(frame.targetService);
if (type !== "" && name !== "calc") {
- // An unknown service closes the stream after the frame, as sam-node does.
+ // An unknown service closes the stream after the frame, as agentmesh-node does.
await auth.write(toBinary(AuthResponseSchema, create(AuthResponseSchema, { success: true, biscuit: providerBiscuit })));
await stream.close();
return;
@@ -169,7 +169,7 @@ test("required labels are checked on the provider's credential", async () => {
assert.throws(() => requireLabels({ peerId: "p", expiration: new Date(), verifyingKey: cpKey, roles: [], labels: {}, taskRules: [] }, { team: "x" }), /team=x/);
});
-test("a requirement of several labels is met only by every one of them, as sam-node's checkPeerLabels", () => {
+test("a requirement of several labels is met only by every one of them, as agentmesh-node's checkPeerLabels", () => {
// The cases of internal/node/labels_gate_test.go, run through the SDK's predicate.
const attesting = (labels: Record<string, string>) => ({ peerId: "p", expiration: new Date(), verifyingKey: cpKey, roles: [], labels, taskRules: [] });
// exact match
@@ -191,7 +191,7 @@ test("a requirement of several labels is met only by every one of them, as sam-n
requireLabels(attesting({}), undefined);
});
-test("the egress floor is met only by every one of its pairs, as sam-node's api.LabelCheck", () => {
+test("the egress floor is met only by every one of its pairs, as agentmesh-node's api.LabelCheck", () => {
const attesting = (labels: Record<string, string>) => ({ peerId: "p", expiration: new Date(), verifyingKey: cpKey, roles: [], labels, taskRules: [] });
requireEgressLabels(attesting({ region: "eu", team: "platform" }), { region: "eu" });
requireEgressLabels(attesting({ region: "eu", team: "platform" }), { region: "eu", team: "platform" });
@@ -234,7 +234,7 @@ test("a service the provider does not have ends the session before MCP starts",
await assert.rejects(openMCPSession(conn, frame("mcp://no-such-service"), [cpKey], { signal: AbortSignal.timeout(3000) }));
});
-test("only a node is a provider, as sam-node's checkPeerLabels requires", async () => {
+test("only a node is a provider, as agentmesh-node's checkPeerLabels requires", async () => {
// The provider answers with the credential it holds at the time; a router's, attesting the floor, is not a provider's.
const nodeBiscuit = providerBiscuit;
providerBiscuit = mint(provider.peerId.toString(), ROLE_ROUTER, { region: "eu" });
diff --git a/sdk/js/src/mcp.ts b/sdk/js/src/mcp.ts
index ed92f406..57e8fcf0 100644
--- a/sdk/js/src/mcp.ts
+++ b/sdk/js/src/mcp.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// MCP over a mesh stream, the client side of sam-node's /mesh/mcp/1.0.0
+// MCP over a mesh stream, the client side of agentmesh-node's /mesh/mcp/1.0.0
// (internal/node/gate.go): an AuthFrame naming the service, the provider's
// AuthResponse, then JSON-RPC messages each with a varint length prefix.
@@ -26,7 +26,7 @@ import { BiscuitVerificationError, requireRole, verifyPeerBiscuit, type Verified
import { ROLE_NODE } from "./controlplane.ts";
import { decodeAuthResponse } from "./credential.ts";
-/** go-msgio's default message cap, which sam-node's StreamTransport uses. */
+/** go-msgio's default message cap, which agentmesh-node's StreamTransport uses. */
export const MAX_MCP_MESSAGE_BYTES = 8 * 1024 * 1024;
/** The MCP client the SDK identifies itself as. */
@@ -129,7 +129,7 @@ function requireEveryPair(provider: VerifiedBiscuit, required: Record<string, st
/**
* A requirement is satisfied only when the provider attests every pair, as
- * sam-node's api.LabelCheck (`check if label(k1, v1), label(k2, v2)`), the
+ * agentmesh-node's api.LabelCheck (`check if label(k1, v1), label(k2, v2)`), the
* same rule as the egress floor. A map holds one value per key, so listing
* several pairs narrows the acceptable providers. Empty is no requirement.
*/
@@ -138,7 +138,7 @@ export function requireLabels(provider: VerifiedBiscuit, required: Record<string
}
/**
- * The session's egress floor, sam-node's egress.require_labels: the same
+ * The session's egress floor, agentmesh-node's egress.require_labels: the same
* rule as requireLabels, refused with a message that names the floor. Empty
* is no floor.
*/
diff --git a/sdk/js/src/mesh.test.ts b/sdk/js/src/mesh.test.ts
index b6ebcdc2..8dc8b156 100644
--- a/sdk/js/src/mesh.test.ts
+++ b/sdk/js/src/mesh.test.ts
@@ -146,7 +146,7 @@ function fakeControlPlane(
}
test("enroll persists identity and credential, load resumes them, refresh rotates", async () => {
- const dir = await mkdtemp(join(tmpdir(), "sam-sdk-"));
+ const dir = await mkdtemp(join(tmpdir(), "agentmesh-sdk-"));
try {
const cp = fakeControlPlane();
const tokenPath = join(dir, "bootstrap.token");
@@ -208,7 +208,7 @@ test("enroll resumes only a credential the control plane still vouches for", asy
// /keys, so the credential is resumed and the new key adopted. Past it, the
// control plane serves only keys the member never saw: the credential is
// dead, and the member enrolls again with the token it has, or says so.
- const dir = await mkdtemp(join(tmpdir(), "sam-sdk-"));
+ const dir = await mkdtemp(join(tmpdir(), "agentmesh-sdk-"));
try {
const cp = fakeControlPlane();
const stateDir = join(dir, "state");
@@ -246,7 +246,7 @@ test("enroll resumes only a credential the control plane still vouches for", asy
});
test("load needs both the identity and the credential", async () => {
- const dir = await mkdtemp(join(tmpdir(), "sam-sdk-"));
+ const dir = await mkdtemp(join(tmpdir(), "agentmesh-sdk-"));
try {
await assert.rejects(AgentMesh.load({ stateDir: dir }), /no identity/);
await writeFile(join(dir, "identity.key"), Identity.generate().toLibp2pPrivateKey());
@@ -268,9 +268,9 @@ test("enroll works without a state directory and keeps the enrollment key when /
// A session refreshes on its own schedule while a pull from the control
// plane may refresh too. The control plane redeems only the last biscuit it
// issued and both write the same state file, so refreshes must run one
-// after another (sam-node's refreshMu, the Python SDK's lock).
+// after another (agentmesh-node's refreshMu, the Python SDK's lock).
test("concurrent refreshes run one after the other", async () => {
- const dir = await mkdtemp(join(tmpdir(), "sam-sdk-"));
+ const dir = await mkdtemp(join(tmpdir(), "agentmesh-sdk-"));
try {
const opts = { strictRefresh: true, refreshDelayMs: 10, rejectNextRefresh: false };
const cp = fakeControlPlane(true, opts);
@@ -303,7 +303,7 @@ test("enroll refuses ambiguous credentials", async () => {
});
test("enroll reads a workload identity token from jwtPath and re-reads on refresh", async () => {
- const dir = await mkdtemp(join(tmpdir(), "sam-sdk-"));
+ const dir = await mkdtemp(join(tmpdir(), "agentmesh-sdk-"));
try {
const cp = fakeControlPlane();
const jwtPath = join(dir, "token");
diff --git a/sdk/js/src/mesh.ts b/sdk/js/src/mesh.ts
index 3712b460..c92da972 100644
--- a/sdk/js/src/mesh.ts
+++ b/sdk/js/src/mesh.ts
@@ -143,7 +143,7 @@ export class AgentMesh {
#credential: MeshCredential;
readonly #state: StateStore | undefined;
readonly #jwtSource: (() => Promise<string>) | undefined;
- // Refreshes run one after another, as sam-node's refreshMu: the control
+ // Refreshes run one after another, as agentmesh-node's refreshMu: the control
// plane redeems only the last biscuit it issued, so two in flight would
// leave the loser holding a spent one.
#refreshChain: Promise<unknown> = Promise.resolve();
@@ -241,7 +241,7 @@ export class AgentMesh {
// Widen trust from the one key the enrollment carries to every key the
// control plane currently signs with, so peers holding credentials from
- // a retiring key still verify. Best effort, as in sam-node.
+ // a retiring key still verify. Best effort, as in agentmesh-node.
let controlPlaneKeys = [enrollment.controlPlanePublicKey];
try {
controlPlaneKeys = await controlPlane.keys(controlPlaneKeys);
@@ -363,7 +363,7 @@ export class AgentMesh {
}
/**
- * The member's pull from the control plane, as sam-node's SyncControlPlane:
+ * The member's pull from the control plane, as agentmesh-node's SyncControlPlane:
* the signing keys (verified against the set already trusted, so whoever
* answers the URL cannot become the trust root), a credential refresh when
* a rotation happened since it was issued, and /info for the router
diff --git a/sdk/js/src/platform/state.browser.ts b/sdk/js/src/platform/state.browser.ts
index 06913964..fd2bb90b 100644
--- a/sdk/js/src/platform/state.browser.ts
+++ b/sdk/js/src/platform/state.browser.ts
@@ -28,7 +28,7 @@ function request<T>(req: IDBRequest<T>): Promise<T> {
}
function openDatabase(name: string): Promise<IDBDatabase> {
- const req = indexedDB.open(`sam-mesh:${name}`, 1);
+ const req = indexedDB.open(`agentmesh:${name}`, 1);
req.onupgradeneeded = () => {
req.result.createObjectStore(STORE);
};
diff --git a/sdk/js/src/platform/transports.browser.ts b/sdk/js/src/platform/transports.browser.ts
index e020de13..0ffaa4d0 100644
--- a/sdk/js/src/platform/transports.browser.ts
+++ b/sdk/js/src/platform/transports.browser.ts
@@ -13,7 +13,7 @@
// limitations under the License.
// How a member in a browser reaches the mesh: WebSocket, the one transport a
-// page can open to a router (sam-one's single port, or a router behind a
+// page can open to a router (agentmesh-one's single port, or a router behind a
// TLS-terminating proxy as wss), secured with Noise. A browser cannot run
// libp2p's TLS, which needs a self-signed certificate over a raw socket;
// routers and nodes accept Noise beside TLS, and both bind the connection to
diff --git a/sdk/js/src/session.test.ts b/sdk/js/src/session.test.ts
index 116e5c91..fe59c5f0 100644
--- a/sdk/js/src/session.test.ts
+++ b/sdk/js/src/session.test.ts
@@ -422,7 +422,7 @@ test("a resumed member adopts a rotated key before admitting routers", async ()
const rotatedRouterBiscuit = mint(rotatedRouter.peerId.toString(), ROLE_ROUTER, undefined, {}, rotated);
await rotatedRouter.handle(AUTH_PROTOCOL, authStreamHandler({ ownBiscuit: () => rotatedRouterBiscuit, trustedKeys: () => [cpKey, rotatedKey] }));
const rotatedRouterAddr = (rotatedRouter.getMultiaddrs()[0] as ReturnType<typeof multiaddr>).toString();
- const stateDir = await mkdtemp(join(tmpdir(), "sam-session-"));
+ const stateDir = await mkdtemp(join(tmpdir(), "agentmesh-session-"));
try {
// Enrolled before the rotation: the credential on disk trusts one key.
const before = await AgentMesh.enroll({ controlPlaneUrl: "http://127.0.0.1:1", bootstrapToken: "sbt", stateDir, fetch: fakeControlPlane([rotatedRouterAddr]) });
@@ -559,7 +559,7 @@ test("an egress floor stated at join is held on the HTTP path, and the provider
// A banned provider is refused before any handshake.
plain.banned.add(provider.peerId.toString(), Date.now());
await assert.rejects(plain.request(addrOf(provider), "a2a://agent", "/card"), /banned/);
- // Only nodes host services, as sam-node's checkPeerLabels requires.
+ // Only nodes host services, as agentmesh-node's checkPeerLabels requires.
await assert.rejects(held.request(addrOf(notANode), "a2a://agent", "/card"), /lacks expected role "mesh:role:node"/);
} finally {
await Promise.all([...sessions.map((s) => s.close()), provider.stop(), impostor.stop(), notANode.stop()]);
diff --git a/sdk/js/src/session.ts b/sdk/js/src/session.ts
index 00a06310..7f588907 100644
--- a/sdk/js/src/session.ts
+++ b/sdk/js/src/session.ts
@@ -67,7 +67,7 @@ export interface JoinOptions extends MeshHostOptions {
policySyncIntervalMs?: number;
/**
* How often keys, bans and router addresses are pulled from the control
- * plane (sam-node's --control-plane-sync-interval). Gossip events bring a
+ * plane (agentmesh-node's --control-plane-sync-interval). Gossip events bring a
* pull forward; 0 disables the loop.
*/
controlPlaneSyncIntervalMs?: number;
@@ -80,7 +80,7 @@ export interface JoinOptions extends MeshHostOptions {
*/
relayCheckIntervalMs?: number;
/**
- * sam-node's egress.require_labels for an SDK member: every provider this
+ * agentmesh-node's egress.require_labels for an SDK member: every provider this
* session calls must attest all of these pairs, on top of a call's
* requiredLabels. Held on every call, MCP and HTTP alike; no call waives it.
*/
@@ -135,14 +135,14 @@ const PEER_ROUTING_TIMEOUT_MS = 10_000;
const DEFAULT_REFRESH_LEAD_MS = 60 * 60 * 1000;
const DEFAULT_REFRESH_RETRY_MS = 30 * 1000;
const MIN_REFRESH_DELAY_MS = 2_000;
-/** sam-node's --control-plane-sync-interval default. */
+/** agentmesh-node's --control-plane-sync-interval default. */
const DEFAULT_POLICY_SYNC_MS = 15 * 60 * 1000;
-/** sam-node's --control-plane-sync-interval default, and its 2s first pull. */
+/** agentmesh-node's --control-plane-sync-interval default, and its 2s first pull. */
const DEFAULT_CONTROL_PLANE_SYNC_MS = 15 * 60 * 1000;
const FIRST_CONTROL_PLANE_SYNC_MS = 2_000;
const DEFAULT_CONTROL_PLANE_SYNC_JITTER_MS = 2_000;
const DEFAULT_RELAY_CHECK_MS = 30 * 1000;
-/** How long a provider's positive egress verdict is kept; sam-node's labelGateTTL. */
+/** How long a provider's positive egress verdict is kept; agentmesh-node's labelGateTTL. */
const EGRESS_VERDICT_TTL_MS = 5 * 60 * 1000;
/**
@@ -261,7 +261,7 @@ export class MeshSession {
/**
* The URL a fetch bound to this session (fetch()) takes for a service on a
* peer: http://mesh/mesh/<peer-id>/<type>/<name>/<path>, the shape of
- * sam-node's egress proxy and of an agent card it rewrote.
+ * agentmesh-node's egress proxy and of an agent card it rewrote.
*/
static meshURL(peerId: string, targetService: string, path = ""): string {
return meshURL(peerId, targetService, path);
@@ -489,7 +489,7 @@ export class MeshSession {
* Looks the DHT up for peers offering a service: `"mcp://calc"`, the
* same string callTool and request take, or a type alone (`"mcp"`) for
* every service of that type, or (type, name). Bounded by the timeout;
- * the DHT walk itself is what sam-node's discover does.
+ * the DHT walk itself is what agentmesh-node's discover does.
*/
async discover(service: string, name?: string, options: { timeoutMs?: number; limit?: number } = {}): Promise<DiscoveredProvider[]> {
const target = service.includes("://") ? parseServiceTarget(service) : { type: service, name };
@@ -735,7 +735,7 @@ export class MeshSession {
/**
* Calls an inference or A2A service on a provider over /libp2p-http, the
- * way sam-node's egress proxy does for /mesh/<peer>/<type>/<name>/<path>.
+ * way agentmesh-node's egress proxy does for /mesh/<peer>/<type>/<name>/<path>.
*/
async request(peer: Peer, targetService: string, path: string, options: HTTPRequestOptions = {}): Promise<HTTPResponse> {
const conn = await this.#egressConnection(peer, options.signal);
@@ -744,7 +744,7 @@ export class MeshSession {
/**
* The connection an HTTP call goes out on, its peer verified as an enrolled
- * node holding the floor before anything is sent (sam-node's VerifyPeerLabels).
+ * node holding the floor before anything is sent (agentmesh-node's VerifyPeerLabels).
*/
async #egressConnection(peer: Peer, signal?: AbortSignal): Promise<Connection> {
const conn = await this.connect(peer, signal);
@@ -787,7 +787,7 @@ export class MeshSession {
* handler or listener (in this process; an Express app with the A2A SDK's
* handlers is a listener). Nothing is announced: no DHT record, no
* catalog entry. A tool, a model or a service others should find by name
- * is published by a sam-node. Fetches the mesh policy first and keeps it
+ * is published by a agentmesh-node. Fetches the mesh policy first and keeps it
* current; a policy that cannot be read fails the call, since an agent
* without it could only authorize what callers carry in their own tokens.
* Returns the service target callers use. One agent per session.
@@ -848,7 +848,7 @@ export class MeshSession {
/** Implements AgentMesh.join(); lives here to keep mesh.ts free of libp2p. */
export async function joinMesh(mesh: AgentMesh, options: JoinOptions = {}): Promise<MeshSession> {
- // The pull sam-node makes before it starts: a member resuming from its
+ // The pull agentmesh-node makes before it starts: a member resuming from its
// state directory after a key rotation would otherwise verify the routers,
// which already hold credentials under the new key, against the keys it
// persisted, and the sync that would have brought the new key runs only
diff --git a/sdk/js/src/sync.ts b/sdk/js/src/sync.ts
index 42bd87f1..33d98767 100644
--- a/sdk/js/src/sync.ts
+++ b/sdk/js/src/sync.ts
@@ -13,7 +13,7 @@
// limitations under the License.
// What a member keeps in step with the control plane while it runs, as
-// sam-node's controlplane_sync.go: the ban set, reconciled from /info, and
+// agentmesh-node's controlplane_sync.go: the ban set, reconciled from /info, and
// the gossip events that bring the next pull forward.
import { fromBinary, toBinary } from "@bufbuild/protobuf";
@@ -87,7 +87,7 @@ export class BanSet {
export type VerifiedMeshEvent = MeshEvent & { eventTime: Timestamp };
/**
- * Verifies a MeshEvent as sam-node's verifyEvent does: the signature covers
+ * Verifies a MeshEvent as agentmesh-node's verifyEvent does: the signature covers
* the deterministic encoding of the event with the signature cleared, under
* any trusted control plane key. Returns the event, or undefined when it
* does not verify, is not fresh, or bans something that is not a peer ID.
diff --git a/sdk/python/README.md b/sdk/python/README.md
index 6fad8b3f..5dd01bf7 100644
--- a/sdk/python/README.md
+++ b/sdk/python/README.md
@@ -1,22 +1,22 @@
# sam-mesh (Python)
-Native Python SDK for joining an Agent Mesh (SAM) from inside the agent
-process. It replaces the `sam-node` sidecar for agents written in Python:
+Native Python SDK for joining an Agent Mesh from inside the agent
+process. It replaces the `agentmesh-node` sidecar for agents written in Python:
the agent enrolls with the control plane, joins the mesh through a router,
finds services and calls them, answers A2A requests for the agent itself,
and follows the control plane's keys, bans and policy while it runs. It
publishes no service; a tool or a model others should find by name runs
-behind a `sam-node`. Import it as
+behind a `agentmesh-node`. Import it as
`agent_mesh`.
Guide: [sam-mesh.dev/docs/guides/native-sdks](https://sam-mesh.dev/docs/guides/native-sdks/),
from an empty machine to two programs on a mesh.
-Source: [github.com/google/sam/tree/main/sdk/python](https://github.com/google/sam/tree/main/sdk/python).
+Source: [github.com/google/agentmesh/tree/main/sdk/python](https://github.com/google/agentmesh/tree/main/sdk/python).
## Install
```bash
-pip install sam-mesh
+pip install agentmesh-p2p
```
Python 3.11 or later. The SDK runs on trio (py-libp2p is trio-based); under
@@ -26,10 +26,10 @@ asyncio, use it through `anyio` with the trio backend. One dependency,
## Use
Both programs below are in
-[`examples/`](https://github.com/google/sam/tree/main/sdk/python/examples)
+[`examples/`](https://github.com/google/agentmesh/tree/main/sdk/python/examples)
and run against a real mesh in the repository's tests. They read the mesh
from `AGENTMESH_CONTROL_PLANE_URL` and the enrollment token from
-`AGENTMESH_BOOTSTRAP_TOKEN_PATH`; the guide shows how to get both from `sam-one`
+`AGENTMESH_BOOTSTRAP_TOKEN_PATH`; the guide shows how to get both from `agentmesh-one`
or from the operator of an existing mesh.
Find a service and call it:
@@ -188,4 +188,4 @@ A plaintext `http://` control plane is accepted only on loopback. Pass
## License
Apache-2.0. Issues and contributions at
-[github.com/google/sam](https://github.com/google/sam).
+[github.com/google/agentmesh](https://github.com/google/agentmesh).
diff --git a/sdk/python/pyproject.toml b/sdk/python/pyproject.toml
index a23e5bde..01439b70 100644
--- a/sdk/python/pyproject.toml
+++ b/sdk/python/pyproject.toml
@@ -3,9 +3,9 @@ requires = ["hatchling>=1.25"]
build-backend = "hatchling.build"
[project]
-name = "sam-mesh"
+name = "agentmesh-p2p"
version = "0.1.0"
-description = "Native SDK for joining an Agent Mesh (SAM) from inside a Python agent process"
+description = "Native SDK for joining an Agent Mesh from inside a Python agent process"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.11"
@@ -36,8 +36,8 @@ examples = [
]
[project.urls]
-Homepage = "https://github.com/google/sam"
-Source = "https://github.com/google/sam/tree/main/sdk/python"
+Homepage = "https://github.com/google/agentmesh"
+Source = "https://github.com/google/agentmesh/tree/main/sdk/python"
[tool.hatch.build.targets.wheel]
packages = ["src/agent_mesh"]
diff --git a/sdk/python/src/agent_mesh/__init__.py b/sdk/python/src/agent_mesh/__init__.py
index ce8cc6d2..4a2fb2f2 100644
--- a/sdk/python/src/agent_mesh/__init__.py
+++ b/sdk/python/src/agent_mesh/__init__.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Native SDK for joining an Agent Mesh (SAM) from inside a Python process."""
+"""Native SDK for joining an Agent Mesh from inside a Python process."""
from .auth import AUTH_PROTOCOL, MCP_PROTOCOL, AuthRejectedError, auth_stream_handler, authenticate_with_peer
from .authorizer import BASELINE_DATALOG, AuthorizationError, AuthorizeRequest, ProviderAuthorizerOptions, authorize_caller
diff --git a/sdk/python/src/agent_mesh/auth.py b/sdk/python/src/agent_mesh/auth.py
index ed85d2f0..4a182f67 100644
--- a/sdk/python/src/agent_mesh/auth.py
+++ b/sdk/python/src/agent_mesh/auth.py
@@ -92,7 +92,7 @@ def auth_stream_handler(
on_authenticated: Optional[Callable[[str, VerifiedBiscuit], None]] = None,
is_banned: Optional[Callable[[str], bool]] = None,
) -> Callable[[INetStream], "trio.lowlevel.Awaitable[None]"]:
- """Server side of /mesh/auth/1.0.0, mirroring sam-node's HandleAuthHandshake:
+ """Server side of /mesh/auth/1.0.0, mirroring agentmesh-node's HandleAuthHandshake:
verify the caller's biscuit against the control plane keys and its
connection peer ID, then answer with our own. A failed verification, or a
peer the control plane banned, gets no answer, only a closed stream, as on
diff --git a/sdk/python/src/agent_mesh/authorizer.py b/sdk/python/src/agent_mesh/authorizer.py
index b8d50881..c3c6d332 100644
--- a/sdk/python/src/agent_mesh/authorizer.py
+++ b/sdk/python/src/agent_mesh/authorizer.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""The provider-side authorizer, mirroring internal/node.(*SamNode).Authorize.
+"""The provider-side authorizer, mirroring internal/node.(*AgentMeshNode).Authorize.
Every piece of Datalog it evaluates is text: the baseline generated from
api/datalog.go (_gen/datalog.json) and the mesh policy rules the control
plane renders (GET /policies). Nothing here derives rules from roles."""
@@ -43,7 +43,7 @@ class AuthorizationError(Exception):
@dataclass(frozen=True)
class AuthorizeRequest:
- """What a caller asks for, as sam-node's RequestContext."""
+ """What a caller asks for, as agentmesh-node's RequestContext."""
# The caller's biscuit, as it arrived in the AuthFrame or X-Mesh-Biscuit.
biscuit: bytes
@@ -100,7 +100,7 @@ def authorize_caller(req: AuthorizeRequest, options: ProviderAuthorizerOptions)
b.set_limits(_limits())
# The action: service(type, name). An empty target is the protocol itself
- # in the system namespace, as sam-node scopes its own catalog.
+ # in the system namespace, as agentmesh-node scopes its own catalog.
if req.target_service == "":
svc_type, svc_name = BASELINE_DATALOG["system_namespace"], req.protocol
else:
diff --git a/sdk/python/src/agent_mesh/credential.py b/sdk/python/src/agent_mesh/credential.py
index fe4446a9..f7da7850 100644
--- a/sdk/python/src/agent_mesh/credential.py
+++ b/sdk/python/src/agent_mesh/credential.py
@@ -39,12 +39,12 @@ class MeshCredential:
# The trusted set when the biscuit was issued. A key trusted now that was
# not in this set means a rotation happened since: the biscuit is signed by
# a retiring key and must be refreshed before that key leaves its grace
- # period (sam-node's identityPredatesRotation).
+ # period (agentmesh-node's identityPredatesRotation).
issued_under_keys: list[bytes] = field(default_factory=list)
# Router multiaddrs, `/p2p/<peer id>` suffixed, as handed out at enrollment.
router_addresses: list[str] = field(default_factory=list)
# What other implementations persist in the same file and this SDK does
- # not use: when each key was learned (by key bytes) and sam-node's OIDC
+ # not use: when each key was learned (by key bytes) and agentmesh-node's OIDC
# session. Carried through so a state directory survives a round trip.
receive_times: dict[bytes, Timestamp] = field(default_factory=dict, compare=False)
oidc_session: Optional[pb.OIDCSession] = field(default=None, compare=False)
@@ -75,7 +75,7 @@ class MeshCredential:
def to_json(self) -> str:
"""credential.json: the api.MemberCredential message as protojson with
- proto field names, the layout `sam-node state export` writes and every
+ proto field names, the layout `agentmesh-node state export` writes and every
SDK reads."""
message = pb.MemberCredential(
control_plane_url=self.control_plane_url,
@@ -94,7 +94,7 @@ class MeshCredential:
@classmethod
def from_json(cls, text: str) -> "MeshCredential":
- """Reads credential.json. An unknown field is an error, as on every SAM surface."""
+ """Reads credential.json. An unknown field is an error, as on every Agent Mesh surface."""
try:
message = json_format.Parse(text, pb.MemberCredential())
except json_format.ParseError as err:
diff --git a/sdk/python/src/agent_mesh/discovery.py b/sdk/python/src/agent_mesh/discovery.py
index fff0a617..f4571746 100644
--- a/sdk/python/src/agent_mesh/discovery.py
+++ b/sdk/python/src/agent_mesh/discovery.py
@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Service discovery as sam-node does it (internal/node/service.go): a provider
+"""Service discovery as agentmesh-node does it (internal/node/service.go): a provider
record in the mesh DHT under a key derived from the service. The lookup is a
bounded Kademlia GET_PROVIDERS walk, and a peer lookup a FIND_NODE one,
spoken directly on go-libp2p-kad-dht's protocol: py-libp2p's DHT client
-(0.8 included) hardcodes the /ipfs prefix and the mesh uses /sam. An SDK
+(0.8 included) hardcodes the /ipfs prefix and the mesh uses /mesh. An SDK
member only looks records up; it announces none."""
from __future__ import annotations
diff --git a/sdk/python/src/agent_mesh/host.py b/sdk/python/src/agent_mesh/host.py
index c68b0f46..a0baad24 100644
--- a/sdk/python/src/agent_mesh/host.py
+++ b/sdk/python/src/agent_mesh/host.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""The libp2p host a member joins the mesh with, configured the way sam-node's
+"""The libp2p host a member joins the mesh with, configured the way agentmesh-node's
is (internal/node/node.go): TLS for the security protocol, which every peer
offers first, Noise accepted beside it, and yamux the muxer. py-libp2p is
trio-based, so everything here is trio async."""
@@ -71,7 +71,7 @@ def create_mesh_host(identity: Identity, listen_addrs: Sequence[str] = ()) -> tu
listen_addrs are for direct connections, e.g. "/ip4/0.0.0.0/tcp/0" or
"/ip4/0.0.0.0/tcp/0/ws"; an agent is normally reached through a router's
relay instead. The host dials TCP and WebSocket: the testnets' routers
- listen on TCP, sam-one's single port is a WebSocket listener."""
+ listen on TCP, agentmesh-one's single port is a WebSocket listener."""
key_pair = create_new_key_pair(identity.seed)
# No ALPN muxer list: py-libp2p's TLS transport advertises early muxer
# negotiation but cannot complete it (Python's ssl has no ALPN select
@@ -109,7 +109,7 @@ def create_mesh_host(identity: Identity, listen_addrs: Sequence[str] = ()) -> tu
def _dial_websockets_by_name(transport: WebsocketTransport) -> None:
"""py-libp2p resolves a `/dns4/<host>/tcp/443/wss` address to its IP
before dialing and then names the IP in the TLS SNI and the Host header,
- which a TLS-terminating edge (sam-one behind a tunnel) answers with 403.
+ which a TLS-terminating edge (agentmesh-one behind a tunnel) answers with 403.
The transport's own dial of an unresolved address keeps the name; the
dial here goes straight to it, as go-libp2p and js-libp2p do. Fixed
upstream by libp2p/py-libp2p#1549, not in 0.8; drop this with the
@@ -123,7 +123,7 @@ def _dial_websockets_by_name(transport: WebsocketTransport) -> None:
transport.dial = dial # type: ignore[method-assign]
-# sam-node's swarm dial timeout. py-libp2p has none of its own: a SYN to an
+# agentmesh-node's swarm dial timeout. py-libp2p has none of its own: a SYN to an
# address nobody answers waits on the kernel, about two minutes, and is then
# retried, and a provider record can name a pod a rollout just replaced. A
# router the control plane lists may be unreachable from where a member runs
@@ -192,7 +192,7 @@ async def dial_addrs(addr: multiaddr.Multiaddr) -> list[multiaddr.Multiaddr]:
dialing; py-libp2p's TCP transport does not, and would report no
transport for them. A WebSocket address keeps its DNS name: the name is
the TLS server name and the Host header, which a TLS-terminating edge in
- front of the router (sam-one behind a tunnel) selects the origin by.
+ front of the router (agentmesh-one behind a tunnel) selects the origin by.
Addresses on transports this host lacks are left out."""
protocols = [p.name for p in addr.protocols()]
first = protocols[0] if protocols else ""
diff --git a/sdk/python/src/agent_mesh/httpx_transport.py b/sdk/python/src/agent_mesh/httpx_transport.py
index 5077a088..7ba9d078 100644
--- a/sdk/python/src/agent_mesh/httpx_transport.py
+++ b/sdk/python/src/agent_mesh/httpx_transport.py
@@ -19,8 +19,8 @@ libp2p:
client = httpx.AsyncClient(transport=MeshTransport(session))
await client.post("http://mesh/mesh/<peer-id>/a2a/agent", json=...)
-The URL has the shape sam-node's egress proxy takes, /mesh/<peer-id>/<type>/
-<name>/<path>. The card of an agent behind a sam-node comes back rewritten to
+The URL has the shape agentmesh-node's egress proxy takes, /mesh/<peer-id>/<type>/
+<name>/<path>. The card of an agent behind a agentmesh-node comes back rewritten to
that shape, as the node's egress proxy serves it, so a stock A2A client
bootstraps from it unchanged. The host is ignored: httpx lowercases it, and a
peer ID is not case-insensitive. Response bodies stream, so `message/stream`
diff --git a/sdk/python/src/agent_mesh/identity.py b/sdk/python/src/agent_mesh/identity.py
index c85fdfe0..23fe664b 100644
--- a/sdk/python/src/agent_mesh/identity.py
+++ b/sdk/python/src/agent_mesh/identity.py
@@ -13,7 +13,7 @@
# limitations under the License.
"""A mesh identity is an ed25519 key pair. Its peer ID is the one libp2p
-derives, so the same key works in the SDK, in sam-node and on the wire."""
+derives, so the same key works in the SDK, in agentmesh-node and on the wire."""
from __future__ import annotations
@@ -51,7 +51,7 @@ def peer_id_from_public_key(public_key_raw: bytes) -> str:
def canonical_peer_id(text: str) -> str:
"""The base58btc form of a peer ID written in any encoding libp2p accepts
- (base58btc multihash, CIDv1). Every key, ban set and comparison in SAM is
+ (base58btc multihash, CIDv1). Every key, ban set and comparison in Agent Mesh is
on this form, as peer.ID.String() in Go; a string read off the wire or from
a caller goes through here before it is used as one. Raises ValueError when
the text is not a peer ID at all."""
@@ -98,7 +98,7 @@ class Identity:
@classmethod
def from_libp2p_private_key(cls, data: bytes) -> "Identity":
- """Loads the libp2p protobuf private key encoding, the format sam-node persists."""
+ """Loads the libp2p protobuf private key encoding, the format agentmesh-node persists."""
prefix = len(_LIBP2P_PRIVATE_KEY_PREFIX)
if len(data) != prefix + 64 or not data.startswith(_LIBP2P_PRIVATE_KEY_PREFIX):
raise ValueError("not a libp2p ed25519 private key")
diff --git a/sdk/python/src/agent_mesh/libp2p_http.py b/sdk/python/src/agent_mesh/libp2p_http.py
index f8c83f73..78f46b68 100644
--- a/sdk/python/src/agent_mesh/libp2p_http.py
+++ b/sdk/python/src/agent_mesh/libp2p_http.py
@@ -14,7 +14,7 @@
"""The /libp2p-http protocol (go-libp2p-http): the client that calls inference
and A2A services on the mesh, and the ingress that accepts A2A requests for
-this member's own agent, gated by the authorizer the way sam-node gates its
+this member's own agent, gated by the authorizer the way agentmesh-node gates its
ingress (StartIngressServer in internal/node)."""
from __future__ import annotations
@@ -53,8 +53,8 @@ HEADER_MESH_NO_TRAILING_SLASH = "x-mesh-no-trailing-slash"
DEFAULT_A2A_NAME = "agent"
# The path prefix of a mesh URL, http://mesh/mesh/<peer-id>/<type>/<name>/<path>:
-# the shape of sam-node's egress proxy and of an agent card rewritten for the
-# mesh, by sam-node or by this SDK. The peer ID is in the path, not the host.
+# the shape of agentmesh-node's egress proxy and of an agent card rewritten for the
+# mesh, by agentmesh-node or by this SDK. The peer ID is in the path, not the host.
MESH_PATH_PREFIX = "/mesh/"
# The well-known agent card location (A2A spec / RFC 8615).
@@ -107,7 +107,7 @@ class A2AEndpoint:
"""This member's agent as other members reach it: `a2a://<name>`, answered
by target, the base URL of an A2A server beside this process or a handler
in it. Authorized requests are forwarded with the biscuit header
- stripped and X-Peer-Id naming the verified caller, as sam-node does. The
+ stripped and X-Peer-Id naming the verified caller, as agentmesh-node does. The
endpoint is not announced anywhere; a caller reaches it by peer ID."""
target: Union[str, HTTPHandler]
@@ -181,7 +181,7 @@ async def _write_http_response(stream: INetStream, conn: h11.Connection, status:
def http_ingress_handler(endpoint: A2AEndpoint, options: ProviderOptions): # type: ignore[no-untyped-def]
- """Server side of /libp2p-http, as sam-node's StartIngressServer: the path
+ """Server side of /libp2p-http, as agentmesh-node's StartIngressServer: the path
is /<type>/<name>[/<upstream>], the caller's biscuit is X-Mesh-Biscuit, and
the request is authorized for <type>://<name> before anything is forwarded.
Only the agent's own endpoint is answered; anything else is 404 after
@@ -338,7 +338,7 @@ def _agent_card_service(method: str, target: str) -> Optional[str]:
def rewrite_agent_card(card: object, base: str) -> dict:
- """An agent card rebuilt for the mesh, as sam-node's egress proxy serves
+ """An agent card rebuilt for the mesh, as agentmesh-node's egress proxy serves
it: HTTP interfaces point at base, gRPC ones go, signatures no longer match.
Streaming stays as declared, this transport streams. Raises when no interface remains."""
if not isinstance(card, dict):
@@ -418,7 +418,7 @@ async def open_http_request(
biscuit in X-Mesh-Biscuit. Returns once the response headers are in; the
body streams after. The timeout bounds the headers, not the body. An
agent card is served rewritten for the mesh (rewrite_agent_card), as
- sam-node's egress proxy serves one."""
+ agentmesh-node's egress proxy serves one."""
service = _agent_card_service(method, target)
if service is None:
return await _open_http_request(host, peer_id, biscuit, method, target, headers=headers, body=body, timeout=timeout)
@@ -426,14 +426,14 @@ async def open_http_request(
async def _serve_agent_card(host: IHost, peer_id: ID, biscuit: bytes, headers: Optional[Mapping[str, str]], timeout: float, service: str) -> StreamedResponse:
- """Impersonates the agent's card endpoint as sam-node's egress proxy does:
+ """Impersonates the agent's card endpoint as agentmesh-node's egress proxy does:
holds the client's request, fetches the card itself with identity encoding,
and answers with it regenerated; the agent's own non-200 is relayed as it is."""
base = mesh_url(str(peer_id), service)
identity = {k: v for k, v in (headers or {}).items() if k.lower() != "accept-encoding"}
try:
response = await _open_http_request(host, peer_id, biscuit, "GET", mesh_http_target(service, AGENT_CARD_PATH), headers=identity, body=b"", timeout=timeout)
- except Exception as err: # noqa: BLE001 - answered as sam-node's 502
+ except Exception as err: # noqa: BLE001 - answered as agentmesh-node's 502
return _bad_gateway(f"agent card fetch failed: {err}")
if response.status != 200:
return response
@@ -442,7 +442,7 @@ async def _serve_agent_card(host: IHost, peer_id: ID, biscuit: bytes, headers: O
card = json.loads(await response.read(_MAX_AGENT_CARD_BYTES))
except (json.JSONDecodeError, UnicodeDecodeError):
return _bad_gateway("agent card is not valid JSON")
- except Exception as err: # noqa: BLE001 - answered as sam-node's 502
+ except Exception as err: # noqa: BLE001 - answered as agentmesh-node's 502
return _bad_gateway(f"agent card fetch failed: {err}")
finally:
await response.aclose()
diff --git a/sdk/python/src/agent_mesh/mcp_client.py b/sdk/python/src/agent_mesh/mcp_client.py
index 959de7c4..b60b486a 100644
--- a/sdk/python/src/agent_mesh/mcp_client.py
+++ b/sdk/python/src/agent_mesh/mcp_client.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""MCP over a mesh stream, the client side of sam-node's /mesh/mcp/1.0.0
+"""MCP over a mesh stream, the client side of agentmesh-node's /mesh/mcp/1.0.0
(internal/node/gate.go): an AuthFrame naming the service, the provider's
AuthResponse, then JSON-RPC messages each with a varint length prefix."""
@@ -46,7 +46,7 @@ from .host import open_stream
logger = logging.getLogger("agent_mesh")
-# go-msgio's default message cap, which sam-node's StreamTransport uses.
+# go-msgio's default message cap, which agentmesh-node's StreamTransport uses.
MAX_MCP_MESSAGE_BYTES = 8 * 1024 * 1024
MCP_CLIENT_INFO = mcp_types.Implementation(name="agent-mesh-sdk", version="0.1.0")
@@ -68,14 +68,14 @@ def _require_every_pair(provider: VerifiedBiscuit, required: Optional[Mapping[st
def require_labels(provider: VerifiedBiscuit, required: Optional[Mapping[str, str]]) -> None:
"""A requirement is satisfied only when the provider attests every pair, as
- sam-node's api.LabelCheck (`check if label(k1, v1), label(k2, v2)`), the
+ agentmesh-node's api.LabelCheck (`check if label(k1, v1), label(k2, v2)`), the
same rule as the egress floor. A map holds one value per key, so listing
several pairs narrows the acceptable providers. Empty is no requirement."""
_require_every_pair(provider, required, "does not attest every required label")
def require_egress_labels(provider: VerifiedBiscuit, required: Optional[Mapping[str, str]]) -> None:
- """The session's egress floor, sam-node's egress.require_labels: the same
+ """The session's egress floor, agentmesh-node's egress.require_labels: the same
rule as require_labels, refused with a message that names the floor. Empty
is no floor."""
_require_every_pair(provider, required, "does not attest the egress floor")
diff --git a/sdk/python/src/agent_mesh/mesh.py b/sdk/python/src/agent_mesh/mesh.py
index a336aa46..6e7d864d 100644
--- a/sdk/python/src/agent_mesh/mesh.py
+++ b/sdk/python/src/agent_mesh/mesh.py
@@ -186,7 +186,7 @@ class AgentMesh:
# Widen trust from the one key the enrollment carries to every key the
# control plane currently signs with, so peers holding credentials from
- # a retiring key still verify. Best effort, as in sam-node.
+ # a retiring key still verify. Best effort, as in agentmesh-node.
control_plane_keys = [enrollment.control_plane_public_key]
try:
control_plane_keys = control_plane.keys(control_plane_keys)
@@ -273,7 +273,7 @@ class AgentMesh:
return True
def sync_control_plane(self) -> ControlPlaneSync:
- """The member's pull from the control plane, as sam-node's SyncControlPlane:
+ """The member's pull from the control plane, as agentmesh-node's SyncControlPlane:
the signing keys (verified against the set already trusted, so whoever
answers the URL cannot become the trust root), a credential refresh when
a rotation happened since it was issued, and /info for the router
diff --git a/sdk/python/src/agent_mesh/session.py b/sdk/python/src/agent_mesh/session.py
index d4e2a37b..c4b4e940 100644
--- a/sdk/python/src/agent_mesh/session.py
+++ b/sdk/python/src/agent_mesh/session.py
@@ -77,13 +77,13 @@ RESERVATION_RENEW_LEAD = 2 * 60.0
# unreachable through that router at most before it notices and reserves
# again.
RESERVATION_CHECK_INTERVAL = 30.0
-# sam-node's --control-plane-sync-interval default.
+# agentmesh-node's --control-plane-sync-interval default.
DEFAULT_POLICY_SYNC = 15 * 60.0
-# sam-node's --control-plane-sync-interval default, and its 2s first pull.
+# agentmesh-node's --control-plane-sync-interval default, and its 2s first pull.
DEFAULT_CONTROL_PLANE_SYNC = 15 * 60.0
FIRST_CONTROL_PLANE_SYNC = 2.0
DEFAULT_CONTROL_PLANE_SYNC_JITTER = 2.0
-# How long a provider's positive egress verdict is kept; sam-node's labelGateTTL.
+# How long a provider's positive egress verdict is kept; agentmesh-node's labelGateTTL.
EGRESS_VERDICT_TTL = 5 * 60.0
# How a caller names the peer it wants to reach: a provider `discover` returned,
@@ -147,7 +147,7 @@ class MeshSession:
banned: BanSet = field(default_factory=BanSet)
# This member's agent, once accept_a2a was called.
endpoint: Optional[A2AEndpoint] = None
- # sam-node's egress.require_labels for an SDK member: every provider this
+ # agentmesh-node's egress.require_labels for an SDK member: every provider this
# session calls must attest all of these pairs, on top of a call's
# required_labels. Held on every call, MCP and HTTP alike; no call waives it.
egress_require_labels: Optional[Mapping[str, str]] = None
@@ -191,7 +191,7 @@ class MeshSession:
def mesh_url(peer_id: str, target_service: str, path: str = "") -> str:
"""The URL an httpx client on `MeshTransport` uses for a service on a
peer: http://mesh/mesh/<peer-id>/<type>/<name>/<path>, the shape of
- sam-node's egress proxy and of an agent card rewritten for the mesh."""
+ agentmesh-node's egress proxy and of an agent card rewritten for the mesh."""
return mesh_url(canonical_peer_id(peer_id), target_service, path)
@property
@@ -509,7 +509,7 @@ class MeshSession:
async def _sync_loop(self) -> None:
"""Pulls once shortly after join, then every interval and whenever
triggered; each periodic wait is stretched by up to a tenth and each
- trigger delayed by up to the jitter, as sam-node's loop does."""
+ trigger delayed by up to the jitter, as agentmesh-node's loop does."""
delay = min(FIRST_CONTROL_PLANE_SYNC, self.control_plane_sync_interval) if self.control_plane_sync_interval > 0 else None
while True:
triggered = False
@@ -596,7 +596,7 @@ class MeshSession:
body: bytes | str | None = None,
) -> HTTPResponse:
"""Calls an inference or A2A service on a provider over /libp2p-http,
- the way sam-node's egress proxy does for /mesh/<peer>/<type>/<name>/<path>."""
+ the way agentmesh-node's egress proxy does for /mesh/<peer>/<type>/<name>/<path>."""
peer_id = await self._egress_peer(peer)
return await http_request_over_stream(
self.host, peer_id, self.biscuit, target_service, path, method=method, headers=headers, body=body
@@ -604,7 +604,7 @@ class MeshSession:
async def _egress_peer(self, peer: Peer) -> ID:
"""The peer an HTTP call goes out to, verified as an enrolled node
- holding the floor before anything is sent (sam-node's VerifyPeerLabels)."""
+ holding the floor before anything is sent (agentmesh-node's VerifyPeerLabels)."""
peer_id = await self.connect(peer)
if self._egress_verdicts.get(str(peer_id), 0.0) > time.monotonic():
return peer_id
@@ -621,7 +621,7 @@ class MeshSession:
/libp2p-http with target, the base URL of an A2A server beside this
process or a handler in it. Nothing is announced: no DHT record, no
catalog entry. A tool, a model or a service others should find by
- name is published by a sam-node. Fetches the mesh policy first and
+ name is published by a agentmesh-node. Fetches the mesh policy first and
keeps it current; a policy that cannot be read fails the call, since
an agent without it could only authorize what callers carry in their
own tokens. Returns the service target callers use. One agent per
@@ -683,7 +683,7 @@ async def join_mesh(
credential lists; a peer behind another router is still reached, see
MeshSession.connect. egress_require_labels is the floor every provider
this member calls must attest, see MeshSession."""
- # The pull sam-node makes before it starts: a member resuming from its
+ # The pull agentmesh-node makes before it starts: a member resuming from its
# state directory after a key rotation would otherwise verify the routers,
# which already hold credentials under the new key, against the keys it
# persisted, and the sync that would have brought the new key runs only
@@ -755,7 +755,7 @@ async def join_mesh(
async def _admit(host: IHost, mesh: "AgentMesh", router_addrs: list[multiaddr.Multiaddr], reserve: bool) -> list[AdmittedRouter]:
"""Authenticates with every router the control plane named, as the JS SDK
- and sam-node do, and reserves a relay slot on the first that admits us.
+ and agentmesh-node do, and reserves a relay slot on the first that admits us.
A peer reserves on the first router of its own list, so a caller that
only knew one router could not reach a peer whose list started
elsewhere; `connect` tries the relayed path through each of these. The
diff --git a/sdk/python/src/agent_mesh/sync.py b/sdk/python/src/agent_mesh/sync.py
index 3feaea41..0e9e32b7 100644
--- a/sdk/python/src/agent_mesh/sync.py
+++ b/sdk/python/src/agent_mesh/sync.py
@@ -13,7 +13,7 @@
# limitations under the License.
"""What a member keeps in step with the control plane while it runs, as
-sam-node's controlplane_sync.go: the ban set, reconciled from /info, and the
+agentmesh-node's controlplane_sync.go: the ban set, reconciled from /info, and the
gossip events that bring the next pull forward."""
from __future__ import annotations
@@ -69,7 +69,7 @@ class BanSet:
def verify_mesh_event(data: bytes, trusted_keys: Sequence[bytes], now_ms: Optional[int] = None) -> Optional[pb.MeshEvent]:
- """Verifies a MeshEvent as sam-node's verifyEvent does: the signature covers
+ """Verifies a MeshEvent as agentmesh-node's verifyEvent does: the signature covers
the deterministic encoding of the event with the signature cleared, under
any trusted control plane key. Returns the event, with a banned peer's id in
canonical form, or None when it does not verify, is not fresh, or bans
diff --git a/sdk/python/tests/test_host.py b/sdk/python/tests/test_host.py
index fd6ab311..adcf173f 100644
--- a/sdk/python/tests/test_host.py
+++ b/sdk/python/tests/test_host.py
@@ -111,7 +111,7 @@ def test_a_concrete_address_passes_through():
def test_a_websocket_address_is_dialed_by_its_name():
- """A TLS-terminating edge in front of the router (sam-one behind a tunnel)
+ """A TLS-terminating edge in front of the router (agentmesh-one behind a tunnel)
selects the origin by the name in the TLS SNI and the Host header.
py-libp2p resolves the name first and sends the IP (libp2p/py-libp2p#1549
not yet released); the host sends the name. Pinned on the Host header of
@@ -140,7 +140,7 @@ def test_a_websocket_address_is_dialed_by_its_name():
def test_a_websocket_listener_is_reached_with_tls_and_yamux():
- """sam-one's router listens on /ws alone, on the port that also serves
+ """agentmesh-one's router listens on /ws alone, on the port that also serves
its HTTP API; a member reaches it as it reaches a TCP router."""
async def echo(stream):
diff --git a/sdk/python/tests/test_libp2p_http.py b/sdk/python/tests/test_libp2p_http.py
index 40d12aef..02d41ea4 100644
--- a/sdk/python/tests/test_libp2p_http.py
+++ b/sdk/python/tests/test_libp2p_http.py
@@ -14,7 +14,7 @@
"""The A2A ingress in one process: this SDK's /libp2p-http handler for one
agent behind a py-libp2p host, called with this SDK's client, the streaming
-client and an httpx client on MeshTransport. The real sam-node as a caller is
+client and an httpx client on MeshTransport. The real agentmesh-node as a caller is
exercised by tests/integration."""
import json
diff --git a/sdk/python/tests/test_mcp.py b/sdk/python/tests/test_mcp.py
index 80ec6d2c..e454ab02 100644
--- a/sdk/python/tests/test_mcp.py
+++ b/sdk/python/tests/test_mcp.py
@@ -13,8 +13,8 @@
# limitations under the License.
"""A provider in one process: a py-libp2p host that serves /mesh/mcp/1.0.0 the
-way sam-node does (AuthFrame in, AuthResponse out, then MCP over the stream)
-with the official MCP server behind it. The real sam-node is exercised by
+way agentmesh-node does (AuthFrame in, AuthResponse out, then MCP over the stream)
+with the official MCP server behind it. The real agentmesh-node is exercised by
tests/integration/sdk_mesh_test.go."""
import json
@@ -75,7 +75,7 @@ def catalog_server() -> MCPServer:
def mcp_stream_handler(provider_biscuit: bytes, served: list[str]):
- """sam-node's WithBiscuitAuth(HandleMCPStream) in miniature."""
+ """agentmesh-node's WithBiscuitAuth(HandleMCPStream) in miniature."""
async def handle(stream) -> None:
peer_id = str(stream.muxed_conn.peer_id)
@@ -88,7 +88,7 @@ def mcp_stream_handler(provider_biscuit: bytes, served: list[str]):
service_type, name = parse_service_target(frame.target_service)
await stream.write(encode_varint_prefixed(pb.AuthResponse(success=True, biscuit=provider_biscuit).SerializeToString()))
if service_type != "" and name != "calc":
- # An unknown service closes the stream after the frame, as sam-node does.
+ # An unknown service closes the stream after the frame, as agentmesh-node does.
await stream.close()
return
served.append(frame.target_service)
@@ -229,7 +229,7 @@ def test_tools_over_the_mesh_stream():
async with open_mcp_session(caller, pid, frame(caller_biscuit, "mcp://no-such-service"), [CP_KEY]):
pass
- # Only a node is a provider, as sam-node's checkPeerLabels requires: a router attesting the floor is not.
+ # Only a node is a provider, as agentmesh-node's checkPeerLabels requires: a router attesting the floor is not.
router, router_addr, _ = await start_provider(nursery, labels={"region": "eu"}, role=ROLE_ROUTER)
await caller.connect(info_from_p2p_addr(router_addr))
with pytest.raises(AuthRejectedError, match="lacks expected role 'mesh:role:node'"):
@@ -247,7 +247,7 @@ def test_tools_over_the_mesh_stream():
def test_a_requirement_of_several_labels_is_met_only_by_every_one_of_them():
"""The cases of internal/node/labels_gate_test.go, run through the SDK's
predicate: a caller naming several pairs requires all of them, as
- sam-node's checkPeerLabels and api.LabelCheck read it."""
+ agentmesh-node's checkPeerLabels and api.LabelCheck read it."""
from datetime import datetime, timezone
def attesting(labels: dict) -> VerifiedBiscuit:
@@ -278,7 +278,7 @@ def test_a_requirement_of_several_labels_is_met_only_by_every_one_of_them():
def test_the_egress_floor_is_met_only_by_every_one_of_its_pairs():
- """sam-node's api.LabelCheck for egress.require_labels, run through the
+ """agentmesh-node's api.LabelCheck for egress.require_labels, run through the
SDK's predicate: a floor takes no alternatives."""
from datetime import datetime, timezone
diff --git a/sdk/python/tests/test_session.py b/sdk/python/tests/test_session.py
index 60d6f948..12c55c2b 100644
--- a/sdk/python/tests/test_session.py
+++ b/sdk/python/tests/test_session.py
@@ -650,7 +650,7 @@ def test_a_router_that_came_back_on_another_address_is_reserved_on_again(monkeyp
def test_a_router_the_control_plane_lists_elsewhere_is_reserved_on_there():
- """A mesh that hands out literal addresses (sam-one, a kind cluster) has
+ """A mesh that hands out literal addresses (agentmesh-one, a kind cluster) has
no name to re-resolve: a router that came back on another address is
known only through the control plane's list, refreshed by every pull.
The reservation loop dials the router at the address that list names
@@ -802,7 +802,7 @@ def test_an_egress_floor_stated_at_join_is_held_on_the_http_path():
plain.banned.add(str(provider.get_id()), int(time.time() * 1000))
with pytest.raises(PermissionError, match="banned"):
await plain.request(provider_addr, "a2a://agent", "/card")
- # Only nodes host services, as sam-node's checkPeerLabels requires.
+ # Only nodes host services, as agentmesh-node's checkPeerLabels requires.
with pytest.raises(BiscuitVerificationError, match="lacks expected role 'mesh:role:node'"):
await held.request(not_a_node_addr, "a2a://agent", "/card")
nursery.cancel_scope.cancel()
diff --git a/site/content/docs/guides/native-sdks.md b/site/content/docs/guides/native-sdks.md
index 307c7ecc..dd905fed 100644
--- a/site/content/docs/guides/native-sdks.md
+++ b/site/content/docs/guides/native-sdks.md
@@ -5,7 +5,7 @@ weight: 6
---
An agent written in JavaScript or Python can be a member of the mesh itself,
-with no `sam-node` beside it. The SDK enrolls with the control plane, joins
+with no `agentmesh-node` beside it. The SDK enrolls with the control plane, joins
through a router, finds services, calls MCP tools and inference or A2A
endpoints, and answers A2A requests for the agent itself. Every caller of
the agent is checked against the mesh policy before anything reaches your
@@ -14,18 +14,18 @@ code.
This guide takes you from nothing to two programs on a mesh: an agent that
other members can call, and a caller that reaches a service by name and the
agent by its peer ID. Both programs are in the repository under
-[`sdk/js/examples`](https://github.com/google/sam/tree/main/sdk/js/examples)
+[`sdk/js/examples`](https://github.com/google/agentmesh/tree/main/sdk/js/examples)
and
-[`sdk/python/examples`](https://github.com/google/sam/tree/main/sdk/python/examples),
+[`sdk/python/examples`](https://github.com/google/agentmesh/tree/main/sdk/python/examples),
and the repository's tests run them against a real mesh, so what you read
here is what runs.
An SDK member calls what the mesh offers and accepts A2A requests for its
own agent. It does not publish services. A tool, a model or an agent that
-others should find by name runs behind a `sam-node`, which publishes it and
+others should find by name runs behind a `agentmesh-node`, which publishes it and
enforces the policy; see [Your own mesh](../../getting-started/your-own-mesh/).
The reasons are in the
-[SDK README](https://github.com/google/sam/blob/main/sdk/README.md#agents-not-services).
+[SDK README](https://github.com/google/agentmesh/blob/main/sdk/README.md#agents-not-services).
## 1. Get a mesh
@@ -34,30 +34,30 @@ You get them in one of two ways.
### Run your own
-`sam-one` runs a control plane, a router and a web console in one process.
+`agentmesh-one` runs a control plane, a router and a web console in one process.
The [install script](../../getting-started/quickstart/#1-install) provides
it. Start it with a directory for its state:
```bash
-sam-one --data-dir ~/sam-one
+agentmesh-one --data-dir ~/agentmesh-one
```
The banner it prints has the URL, and the token is written to
-`~/sam-one/join-token`:
+`~/agentmesh-one/join-token`:
```text
API URL: http://0.0.0.0:33775
Join Token: mesh_tok_…
```
-On first boot `sam-one` seeds an open development policy, so any enrolled
+On first boot `agentmesh-one` seeds an open development policy, so any enrolled
member may publish and call any service. That is right for trying the
programs below on your laptop. Before you share the mesh, replace it, as
[Your own mesh](../../getting-started/your-own-mesh/#5-before-you-share-it)
explains.
This mesh is reachable from your machine only. To let programs on other
-machines join, start `sam-one` with `--tunnel cloudflare`, which publishes
+machines join, start `agentmesh-one` with `--tunnel cloudflare`, which publishes
the port on a temporary public `https` hostname and prints that URL in the
banner instead. Use that URL as the control plane URL everywhere below. [Your
own mesh](../../getting-started/your-own-mesh/) covers the tunnel, a real
@@ -66,7 +66,7 @@ hostname and the console.
### Join a mesh someone else runs
Ask the operator for the control plane URL and a bootstrap token. Operators
-mint tokens in the console or with `sam-one token create`; a mesh with an
+mint tokens in the console or with `agentmesh-one token create`; a mesh with an
identity provider lets you mint your own from the console after logging in.
Save the token in a file that only you can read. Do not put it on a command
line: it would sit in `ps` output and shell history.
@@ -78,7 +78,7 @@ every terminal you use:
```bash
export SAM_CONTROL_PLANE_URL=http://127.0.0.1:33775 # the API URL from the banner
-export SAM_BOOTSTRAP_TOKEN_PATH=~/sam-one/join-token
+export SAM_BOOTSTRAP_TOKEN_PATH=~/agentmesh-one/join-token
```
A plain `http://` URL is accepted only for a control plane on the same
@@ -87,29 +87,29 @@ trust root of every member and the SDK refuses to fetch it over plaintext
from a remote address. Inside a network you already trust, such as a
Kubernetes cluster where the control plane is a cluster-local service, set
`SAM_INSECURE_CONTROL_PLANE=true` (`allowInsecure` in code), the same choice
-as `sam-node --insecure-control-plane`.
+as `agentmesh-node --insecure-control-plane`.
On a platform that issues workload identity tokens, a program needs no
bootstrap token. A mesh whose control plane trusts the platform's issuer
enrolls the program from that token instead; on Kubernetes that is a
projected service account token, as [Headless enrollment](../headless-enrollment/)
-shows for `sam-node`. Set `SAM_JWT_PATH` (`jwtPath` / `jwt_path`) to the
+shows for `agentmesh-node`. Set `SAM_JWT_PATH` (`jwtPath` / `jwt_path`) to the
token file rather than `SAM_BOOTSTRAP_TOKEN_PATH`, or pass a `jwt` callback
(`() => string | Promise<string>` in JS, `Callable[[], str]` in Python) that
fetches a fresh token (for example, from a cloud metadata server). On every
credential refresh, the SDK re-reads `jwtPath` or invokes the `jwt` callback
and sends the fresh token in `TokenRefreshRequest.jwt` so the control plane
re-attests the member in place. That is how the public testnets run these
-same programs as canaries beside the `sam-node` ones.
+same programs as canaries beside the `agentmesh-node` ones.
## 2. Install the SDK
```bash
-npm install @sam-mesh/sdk # Node.js 22 or later
+npm install @agentmesh-p2p/sdk # Node.js 22 or later
```
```bash
-pip install sam-mesh # Python 3.11 or later
+pip install agentmesh-p2p # Python 3.11 or later
```
The Python package is imported as `agent_mesh`. It runs on trio, because
@@ -140,24 +140,24 @@ JavaScript, `agent.js`:
// node agent.js # answered by the handler below
// node agent.js http://127.0.0.1:9999 # forwarded to an A2A server beside it
//
-// SAM_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
-// SAM_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or
-// SAM_JWT_PATH (a workload identity token your platform issues, such as a
+// AGENTMESH_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
+// AGENTMESH_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or
+// AGENTMESH_JWT_PATH (a workload identity token your platform issues, such as a
// Kubernetes projected service account token), and keeps the identity and
-// credential in SAM_STATE_DIR; later runs resume from there, as the same
+// credential in AGENTMESH_STATE_DIR; later runs resume from there, as the same
// peer, without it.
import { homedir } from "node:os";
-import { AgentMesh } from "@sam-mesh/sdk";
+import { AgentMesh } from "@agentmesh-p2p/sdk";
const [backendURL] = process.argv.slice(2);
const mesh = await AgentMesh.enroll({
- controlPlaneUrl: process.env.SAM_CONTROL_PLANE_URL ?? "https://mesh.example.com",
- bootstrapTokenPath: process.env.SAM_BOOTSTRAP_TOKEN_PATH,
- jwtPath: process.env.SAM_JWT_PATH,
- stateDir: process.env.SAM_STATE_DIR ?? `${homedir()}/.config/sam-mesh/agent`,
+ controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
+ bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
+ jwtPath: process.env.AGENTMESH_JWT_PATH,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/agent`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
- allowInsecure: process.env.SAM_INSECURE_CONTROL_PLANE === "true",
+ allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
const session = await mesh.join();
@@ -189,11 +189,11 @@ before anything reaches this code.
python agent.py # answered by the handler below
python agent.py http://127.0.0.1:9999 # forwarded to an A2A server beside it
-SAM_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
-SAM_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or SAM_JWT_PATH
+AGENTMESH_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
+AGENTMESH_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or AGENTMESH_JWT_PATH
(a workload identity token your platform issues, such as a Kubernetes
projected service account token), and keeps the identity and credential in
-SAM_STATE_DIR; later runs resume from there, as the same peer, without it.
+AGENTMESH_STATE_DIR; later runs resume from there, as the same peer, without it.
"""
import json
@@ -206,12 +206,12 @@ from agent_mesh import AgentMesh, HTTPRequest, HTTPResponse, VerifiedBiscuit
backend_url = sys.argv[1] if len(sys.argv) > 1 else None
mesh = AgentMesh.enroll(
- os.environ.get("SAM_CONTROL_PLANE_URL", "https://mesh.example.com"),
- bootstrap_token_path=os.environ.get("SAM_BOOTSTRAP_TOKEN_PATH"),
- jwt_path=os.environ.get("SAM_JWT_PATH"),
- state_dir=os.environ.get("SAM_STATE_DIR", "~/.config/sam-mesh/agent"),
+ os.environ.get("AGENTMESH_CONTROL_PLANE_URL", "https://mesh.example.com"),
+ bootstrap_token_path=os.environ.get("AGENTMESH_BOOTSTRAP_TOKEN_PATH"),
+ jwt_path=os.environ.get("AGENTMESH_JWT_PATH"),
+ state_dir=os.environ.get("AGENTMESH_STATE_DIR", "~/.config/agentmesh/agent"),
# A plaintext http:// control plane is otherwise accepted only on loopback.
- allow_insecure=os.environ.get("SAM_INSECURE_CONTROL_PLANE") == "true",
+ allow_insecure=os.environ.get("AGENTMESH_INSECURE_CONTROL_PLANE") == "true",
)
@@ -246,10 +246,10 @@ accepting a2a://agent as 12D3KooWQmB5…
```
The program spent the token, saved its identity and credential under
-`~/.config/sam-mesh/agent`, joined through the router and started answering.
+`~/.config/agentmesh/agent`, joined through the router and started answering.
Run it again and it resumes from that directory, as the same peer; the token
is no longer needed. Keep the peer ID: it is how the agent is reached, from
-another program written with an SDK, a `sam-node` on any machine, or a
+another program written with an SDK, a `agentmesh-node` on any machine, or a
phone.
## 4. Call it
@@ -270,13 +270,13 @@ JavaScript, `call.js`:
// node call.js inference://ollama /v1/models
// node call.js 12D3KooW... a2a://agent /card
//
-// SAM_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
-// SAM_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or
-// SAM_JWT_PATH (a workload identity token your platform issues, such as a
+// AGENTMESH_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
+// AGENTMESH_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or
+// AGENTMESH_JWT_PATH (a workload identity token your platform issues, such as a
// Kubernetes projected service account token), and keeps the identity and
-// credential in SAM_STATE_DIR; later runs resume from there without it.
+// credential in AGENTMESH_STATE_DIR; later runs resume from there without it.
import { homedir } from "node:os";
-import { AgentMesh, type DiscoveredProvider } from "@sam-mesh/sdk";
+import { AgentMesh, type DiscoveredProvider } from "@agentmesh-p2p/sdk";
let argv = process.argv.slice(2);
// A first argument that is not a service target is the peer ID of an agent.
@@ -287,12 +287,12 @@ if (argv[0] !== undefined && !argv[0].includes("://")) {
const [service = peerId !== undefined ? "a2a://agent" : "mcp://everything", toolOrPath = peerId !== undefined ? "/card" : "echo", args = '{"message": "hi"}'] = argv;
const mesh = await AgentMesh.enroll({
- controlPlaneUrl: process.env.SAM_CONTROL_PLANE_URL ?? "https://mesh.example.com",
- bootstrapTokenPath: process.env.SAM_BOOTSTRAP_TOKEN_PATH,
- jwtPath: process.env.SAM_JWT_PATH,
- stateDir: process.env.SAM_STATE_DIR ?? `${homedir()}/.config/sam-mesh/caller`,
+ controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
+ bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
+ jwtPath: process.env.AGENTMESH_JWT_PATH,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/caller`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
- allowInsecure: process.env.SAM_INSECURE_CONTROL_PLANE === "true",
+ allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
const session = await mesh.join();
console.log(`on the mesh as ${session.peerId}`);
@@ -352,11 +352,11 @@ published nothing, reached by its peer ID.
python call.py inference://ollama /v1/models
python call.py 12D3KooW... a2a://agent /card
-SAM_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
-SAM_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or SAM_JWT_PATH
+AGENTMESH_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
+AGENTMESH_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or AGENTMESH_JWT_PATH
(a workload identity token your platform issues, such as a Kubernetes
projected service account token), and keeps the identity and credential in
-SAM_STATE_DIR; later runs resume from there without it.
+AGENTMESH_STATE_DIR; later runs resume from there without it.
"""
import json
@@ -376,12 +376,12 @@ tool_or_path = argv[1] if len(argv) > 1 else ("/card" if peer_id else "echo")
args = json.loads(argv[2]) if len(argv) > 2 else {"message": "hi"}
mesh = AgentMesh.enroll(
- os.environ.get("SAM_CONTROL_PLANE_URL", "https://mesh.example.com"),
- bootstrap_token_path=os.environ.get("SAM_BOOTSTRAP_TOKEN_PATH"),
- jwt_path=os.environ.get("SAM_JWT_PATH"),
- state_dir=os.environ.get("SAM_STATE_DIR", "~/.config/sam-mesh/caller"),
+ os.environ.get("AGENTMESH_CONTROL_PLANE_URL", "https://mesh.example.com"),
+ bootstrap_token_path=os.environ.get("AGENTMESH_BOOTSTRAP_TOKEN_PATH"),
+ jwt_path=os.environ.get("AGENTMESH_JWT_PATH"),
+ state_dir=os.environ.get("AGENTMESH_STATE_DIR", "~/.config/agentmesh/caller"),
# A plaintext http:// control plane is otherwise accepted only on loopback.
- allow_insecure=os.environ.get("SAM_INSECURE_CONTROL_PLANE") == "true",
+ allow_insecure=os.environ.get("AGENTMESH_INSECURE_CONTROL_PLANE") == "true",
)
@@ -437,8 +437,8 @@ a2a://agent is served by 12D3KooWQmB5…
200 {"name": "agent", "path": "/card", "caller": "12D3KooWHZ2M…"}
```
-A service a `sam-node` publishes is found by name instead. On a mesh with
-the `everything` canary of the public testnets, or your own `sam-node` with
+A service a `agentmesh-node` publishes is found by name instead. On a mesh with
+the `everything` canary of the public testnets, or your own `agentmesh-node` with
an MCP server behind it:
```bash
@@ -454,7 +454,7 @@ Echo: hi
The caller and the agent are two identities on the mesh with their own
state directories, `caller` and `agent`. Each spent a token on its first
-run; the standing join token of `sam-one` admits any number of members.
+run; the standing join token of `agentmesh-one` admits any number of members.
## 5. Agents that speak A2A
@@ -470,8 +470,8 @@ plug the mesh in as its transport.
agent card, and what an A2A client on the mesh is given. The peer ID is in
the path because URL parsers lowercase the host and a peer ID is
case-sensitive.
-- An agent behind a `sam-node` serves a card naming its own address. The
- SDK hands the client that card rewritten for the mesh, as `sam-node`'s
+- An agent behind a `agentmesh-node` serves a card naming its own address. The
+ SDK hands the client that card rewritten for the mesh, as `agentmesh-node`'s
egress proxy does, so a stock A2A client given the mesh URL bootstraps
from it unchanged.
- The A2A JavaScript SDK takes a `fetch` for its client and mounts its server
@@ -511,11 +511,11 @@ JavaScript, `a2a-agent.js`:
//
// node a2a-agent.js
//
-// SAM_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
-// SAM_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or
-// SAM_JWT_PATH (a workload identity token your platform issues, such as a
+// AGENTMESH_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
+// AGENTMESH_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or
+// AGENTMESH_JWT_PATH (a workload identity token your platform issues, such as a
// Kubernetes projected service account token), and keeps the identity and
-// credential in SAM_STATE_DIR; later runs resume from there, as the same
+// credential in AGENTMESH_STATE_DIR; later runs resume from there, as the same
// peer, without it.
import { homedir } from "node:os";
import { randomUUID } from "node:crypto";
@@ -523,15 +523,15 @@ import express from "express";
import { A2A_PROTOCOL_VERSION, AGENT_CARD_PATH, Role, type AgentCard, type Message } from "@a2a-js/sdk";
import { AgentEvent, DefaultRequestHandler, InMemoryTaskStore, type AgentExecutor, type ExecutionEventBus, type RequestContext } from "@a2a-js/sdk/server";
import { UserBuilder, agentCardHandler, jsonRpcHandler } from "@a2a-js/sdk/server/express";
-import { AgentMesh, MeshSession } from "@sam-mesh/sdk";
+import { AgentMesh, MeshSession } from "@agentmesh-p2p/sdk";
const mesh = await AgentMesh.enroll({
- controlPlaneUrl: process.env.SAM_CONTROL_PLANE_URL ?? "https://mesh.example.com",
- bootstrapTokenPath: process.env.SAM_BOOTSTRAP_TOKEN_PATH,
- jwtPath: process.env.SAM_JWT_PATH,
- stateDir: process.env.SAM_STATE_DIR ?? `${homedir()}/.config/sam-mesh/a2a-agent`,
+ controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
+ bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
+ jwtPath: process.env.AGENTMESH_JWT_PATH,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/a2a-agent`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
- allowInsecure: process.env.SAM_INSECURE_CONTROL_PLANE === "true",
+ allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
const session = await mesh.join();
@@ -608,11 +608,11 @@ ones, and the SDK turns the rest away before a request reaches the app.
python a2a_agent.py
-SAM_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
-SAM_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or SAM_JWT_PATH
+AGENTMESH_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
+AGENTMESH_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or AGENTMESH_JWT_PATH
(a workload identity token your platform issues, such as a Kubernetes
projected service account token), and keeps the identity and credential in
-SAM_STATE_DIR; later runs resume from there, as the same peer, without it.
+AGENTMESH_STATE_DIR; later runs resume from there, as the same peer, without it.
"""
import os
@@ -632,12 +632,12 @@ from agent_mesh import AgentMesh, MeshSession
from starlette.applications import Starlette
mesh = AgentMesh.enroll(
- os.environ.get("SAM_CONTROL_PLANE_URL", "https://mesh.example.com"),
- bootstrap_token_path=os.environ.get("SAM_BOOTSTRAP_TOKEN_PATH"),
- jwt_path=os.environ.get("SAM_JWT_PATH"),
- state_dir=os.environ.get("SAM_STATE_DIR", "~/.config/sam-mesh/a2a-agent"),
+ os.environ.get("AGENTMESH_CONTROL_PLANE_URL", "https://mesh.example.com"),
+ bootstrap_token_path=os.environ.get("AGENTMESH_BOOTSTRAP_TOKEN_PATH"),
+ jwt_path=os.environ.get("AGENTMESH_JWT_PATH"),
+ state_dir=os.environ.get("AGENTMESH_STATE_DIR", "~/.config/agentmesh/a2a-agent"),
# A plaintext http:// control plane is otherwise accepted only on loopback.
- allow_insecure=os.environ.get("SAM_INSECURE_CONTROL_PLANE") == "true",
+ allow_insecure=os.environ.get("AGENTMESH_INSECURE_CONTROL_PLANE") == "true",
)
@@ -720,16 +720,16 @@ JavaScript, `a2a-call.js`:
//
// node a2a-call.js 12D3KooW... "hello"
//
-// SAM_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
-// SAM_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or
-// SAM_JWT_PATH (a workload identity token your platform issues, such as a
+// AGENTMESH_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
+// AGENTMESH_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or
+// AGENTMESH_JWT_PATH (a workload identity token your platform issues, such as a
// Kubernetes projected service account token), and keeps the identity and
-// credential in SAM_STATE_DIR; later runs resume from there without it.
+// credential in AGENTMESH_STATE_DIR; later runs resume from there without it.
import { homedir } from "node:os";
import { randomUUID } from "node:crypto";
import { Message, Role, type SendMessageRequest } from "@a2a-js/sdk";
import { ClientFactory, DefaultAgentCardResolver, JsonRpcTransportFactory } from "@a2a-js/sdk/client";
-import { AgentMesh, MeshSession } from "@sam-mesh/sdk";
+import { AgentMesh, MeshSession } from "@agentmesh-p2p/sdk";
const [peerId, text = "hello"] = process.argv.slice(2);
if (peerId === undefined) {
@@ -737,12 +737,12 @@ if (peerId === undefined) {
}
const mesh = await AgentMesh.enroll({
- controlPlaneUrl: process.env.SAM_CONTROL_PLANE_URL ?? "https://mesh.example.com",
- bootstrapTokenPath: process.env.SAM_BOOTSTRAP_TOKEN_PATH,
- jwtPath: process.env.SAM_JWT_PATH,
- stateDir: process.env.SAM_STATE_DIR ?? `${homedir()}/.config/sam-mesh/a2a-caller`,
+ controlPlaneUrl: process.env.AGENTMESH_CONTROL_PLANE_URL ?? "https://mesh.example.com",
+ bootstrapTokenPath: process.env.AGENTMESH_BOOTSTRAP_TOKEN_PATH,
+ jwtPath: process.env.AGENTMESH_JWT_PATH,
+ stateDir: process.env.AGENTMESH_STATE_DIR ?? `${homedir()}/.config/agentmesh/a2a-caller`,
// A plaintext http:// control plane is otherwise accepted only on loopback.
- allowInsecure: process.env.SAM_INSECURE_CONTROL_PLANE === "true",
+ allowInsecure: process.env.AGENTMESH_INSECURE_CONTROL_PLANE === "true",
});
const session = await mesh.join();
console.log(`on the mesh as ${session.peerId}`);
@@ -784,11 +784,11 @@ router with this member's credential.
python a2a_call.py 12D3KooW... "hello"
-SAM_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
-SAM_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or SAM_JWT_PATH
+AGENTMESH_CONTROL_PLANE_URL names the mesh. The first run enrolls with the file
+AGENTMESH_BOOTSTRAP_TOKEN_PATH (a token the mesh operator gave you) or AGENTMESH_JWT_PATH
(a workload identity token your platform issues, such as a Kubernetes
projected service account token), and keeps the identity and credential in
-SAM_STATE_DIR; later runs resume from there without it.
+AGENTMESH_STATE_DIR; later runs resume from there without it.
"""
import os
@@ -807,12 +807,12 @@ peer_id = sys.argv[1]
text = sys.argv[2] if len(sys.argv) > 2 else "hello"
mesh = AgentMesh.enroll(
- os.environ.get("SAM_CONTROL_PLANE_URL", "https://mesh.example.com"),
- bootstrap_token_path=os.environ.get("SAM_BOOTSTRAP_TOKEN_PATH"),
- jwt_path=os.environ.get("SAM_JWT_PATH"),
- state_dir=os.environ.get("SAM_STATE_DIR", "~/.config/sam-mesh/a2a-caller"),
+ os.environ.get("AGENTMESH_CONTROL_PLANE_URL", "https://mesh.example.com"),
+ bootstrap_token_path=os.environ.get("AGENTMESH_BOOTSTRAP_TOKEN_PATH"),
+ jwt_path=os.environ.get("AGENTMESH_JWT_PATH"),
+ state_dir=os.environ.get("AGENTMESH_STATE_DIR", "~/.config/agentmesh/a2a-caller"),
# A plaintext http:// control plane is otherwise accepted only on loopback.
- allow_insecure=os.environ.get("SAM_INSECURE_CONTROL_PLANE") == "true",
+ allow_insecure=os.environ.get("AGENTMESH_INSECURE_CONTROL_PLANE") == "true",
)
@@ -875,16 +875,16 @@ and the routers it may use. The identity key and the credential live in the
state directory, so the next run resumes without a token, and the SDK
renews the credential before it expires. Delete the directory to enroll
afresh, for instance with other labels. The directory has the same layout
-in both SDKs and in `sam-node`: a program in one language resumes a
-directory written by the other, and `sam-node state import` runs the same
-identity as a node (see the [sam-node reference](../../reference/sam-node/#state)).
+in both SDKs and in `agentmesh-node`: a program in one language resumes a
+directory written by the other, and `agentmesh-node state import` runs the same
+identity as a node (see the [agentmesh-node reference](../../reference/agentmesh-node/#state)).
`join` connected to the routers named in the credential, proved the
program's identity to each and verified the router's own credential, and
reserved a relay slot so that other members reach the program through the
router. The program opens no port of its own. While the session is open,
the SDK follows the control plane: keys, bans and router addresses on
-`sam-node`'s schedule, and sooner when the control plane announces a change
+`agentmesh-node`'s schedule, and sooner when the control plane announces a change
over the mesh.
`discover` looked a service up by name in a table the routers host. An
@@ -894,10 +894,10 @@ circuit because it admitted the agent too. Either way the SDK verifies the
peer's credential before sending anything, and `requiredLabels`
(`required_labels` in Python) refuses a peer whose control-plane-attested
labels do not carry every pair you ask for, as `X-Mesh-Required-Labels` does
-on a `sam-node`. A floor uses the same rule for the whole session:
+on a `agentmesh-node`. A floor uses the same rule for the whole session:
`join({ egressRequireLabels })` (`join(egress_require_labels=)`) names
labels every peer the session calls must attest, as `egress.require_labels`
-does for a `sam-node`. It is stated once at `join` and held for the
+does for a `agentmesh-node`. It is stated once at `join` and held for the
session, on every call and however the peer was named; the agent's calls
cannot waive or widen it. The floor belongs to the program that calls
`join`; no configuration outside the process sets it.
@@ -906,14 +906,14 @@ cannot waive or widen it. The floor belongs to the program that calls
Every caller must present a credential signed by a trusted control plane
key, bound to the connection's peer and unexpired, and its role must be
granted `a2a://agent` by the policy. The check runs on the same Datalog
-text a `sam-node` evaluates. A caller the policy does not admit is turned
+text a `agentmesh-node` evaluates. A caller the policy does not admit is turned
away before the request reaches your handler or your A2A server. Your
handler sees the verified caller as `caller.peerId` (`caller.peer_id`) and
a forwarded server as the `X-Peer-Id` header; the caller's credential is
never forwarded. The connection is encrypted end to end between the two
peers; the router forwards ciphertext.
-Under the open development policy of `sam-one`, every member holds the
+Under the open development policy of `agentmesh-one`, every member holds the
`node` role and that role may call any service. On a shared mesh the policy
grants a role the services it may call (`allowed_services: ["a2a://agent"]`
or a pattern) and the members it may reach; see
@@ -926,7 +926,7 @@ or a pattern) and the members it may reach; see
With a peer id alone the SDK goes through the routers.
- **Every service of a type.** `discover("mcp")` lists every MCP provider
on the mesh; `discover("mcp://everything")` those of one service.
-- **A member's own catalog.** `listTools(peer, "")` returns a `sam-node`'s
+- **A member's own catalog.** `listTools(peer, "")` returns a `agentmesh-node`'s
`list_local_services` tool.
- **Another agent name.** `acceptA2A({ name: "reviewer", ... })` and
`accept_a2a(target, name="reviewer")` answer as `a2a://reviewer`; callers
@@ -943,7 +943,7 @@ the page reaches the mesh and where it keeps its state:
- The page connects to a router over WebSocket and secures the connection
with Noise. Routers and nodes offer TLS first and accept Noise, so a
Node, Python or Go member reached through a relay meets the page on
- Noise, end to end. `sam-one` listens on WebSocket by default; behind
+ Noise, end to end. `agentmesh-one` listens on WebSocket by default; behind
`--tunnel` or any TLS-terminating proxy it advertises the router as
`wss`, which a page served over `https` needs.
- The control plane answers the page's requests from any origin. Enrollment
@@ -970,21 +970,21 @@ and serve `build/browser-example`. The `browser` field of `package.json`
tells a bundler which files to swap for the browser; `@biscuit-auth/biscuit-wasm`
imports its `.wasm` as a module, which webpack (`asyncWebAssembly`), Vite
(`vite-plugin-wasm`) and the script above resolve. `tests/ui/browser-sdk.spec.js`
-runs the page in Chromium against `sam-one`, once directly and once behind
+runs the page in Chromium against `agentmesh-one`, once directly and once behind
a TLS-terminating edge, with Node members calling it and being called.
## What the SDKs do not do
- They do not publish services. An MCP server, a model or an agent that
- others should find by name runs behind a `sam-node`, which publishes it
+ others should find by name runs behind a `agentmesh-node`, which publishes it
to the discovery table and reports it to the console.
- They do not run a local HTTP/gRPC gateway or credential broker. A workload
that needs `ext_authz`, `ext_proc`, RFC 8693 `/oauth/token`, or cloud egress
- credential brokering runs beside a `sam-node`.
+ credential brokering runs beside a `agentmesh-node`.
- They do not serve the discovery table. A member is a client of it; the
routers hold the records.
- The Python SDK does not run in a browser; the JS SDK does, see
[In a browser](#in-a-browser).
The wire contract and the interoperability facts the tests pin are in
-[`sdk/README.md`](https://github.com/google/sam/blob/main/sdk/README.md).
+[`sdk/README.md`](https://github.com/google/agentmesh/blob/main/sdk/README.md).